Remove runic.

This commit is contained in:
kor 2018-11-02 00:19:45 +13:00
parent f85d0df87a
commit 3f1556c6bc
4 changed files with 21 additions and 191 deletions

View File

@ -25,9 +25,9 @@ Memex supports:
- projects - projects
- themes - themes
To change theme simply drag a [theme svg file](https://github.com/hundredrabbits/Themes/tree/master/themes) onto the Memex webpage or app. To change theme simply drag a [theme svg file](https://github.com/hundredrabbits/Themes/tree/master/themes) onto the Memex webpage or app
More information on themes can be found [here](https://github.com/hundredrabbits/Themes). More information on themes can be found [here](https://github.com/hundredrabbits/Themes)
### Live Examples ### Live Examples
@ -40,11 +40,11 @@ More information on themes can be found [here](https://github.com/hundredrabbits
git clone git@github.com:kormyen/memex.git git clone git@github.com:kormyen/memex.git
``` ```
Then open `memex/docs/index.html` in any web browser. Then open `memex/docs/index.html` in any web browser
The web content is isolated in a folder to seperate it from Electron (app-building) files. The web content is isolated in a folder to seperate it from Electron (app-building) files
The folder is called 'docs' so that the 'Github Pages' feature can host it, another folder name doesn't seem supported. The folder is called 'docs' so that the 'Github Pages' feature can host it, another folder name doesn't seem supported
### App Development ### App Development
``` ```
@ -93,7 +93,6 @@ Stored in a human-readable, flat-file database called [Indental](https://wiki.xx
### Dependencies ### Dependencies
- Database parser: [Indental](https://wiki.xxiivv.com/#indental) - Database parser: [Indental](https://wiki.xxiivv.com/#indental)
- Template parser: [Runic](https://wiki.xxiivv.com/#runic)
- Theming: [Themes](https://github.com/hundredrabbits/Themes) - Theming: [Themes](https://github.com/hundredrabbits/Themes)
- Grid layout: [Masonry](https://masonry.desandro.com/) - Grid layout: [Masonry](https://masonry.desandro.com/)
- App builder: [Electron](https://electronjs.org/) - App builder: [Electron](https://electronjs.org/)

View File

@ -4155,7 +4155,23 @@ CSS LOADERS
TAGS : web, design, code, inspiration TAGS : web, design, code, inspiration
BOOK OF SHADERS BOOK OF SHADERS
DATE : 12018-11-01
LINK LINK
> https://thebookofshaders.com/ > https://thebookofshaders.com/
> https://github.com/patriciogonzalezvivo/thebookofshaders > https://github.com/patriciogonzalezvivo/thebookofshaders
TYRES WHEEL SIZE GRIP
DATE : 12018-11-01
LINK : https://www.youtube.com/watch?v=s79ID1SsE-8
TAGS : car
NOTE
> Bigger wheels generally allow for wider tyres
> Bigger wheels are generally heavier
> Wider tyres gives more grip
> Generally the more powerful an engine, the bigger and wider tyre you need in order to put the power down (not spin)
> Tyres size affects gear ratio
MAKE IT
DATE : 12018-11-01
QOTE : "If you feel like you've made it, what is the motivation to keep going?"
` `

View File

@ -21,7 +21,6 @@
<script src="logic/lib/imagesloaded.js"></script> <script src="logic/lib/imagesloaded.js"></script>
<script src="logic/lib/masonry.js"></script> <script src="logic/lib/masonry.js"></script>
<script src="logic/lib/runic.js"></script>
<script src="logic/lib/indental.js"></script> <script src="logic/lib/indental.js"></script>
<script src="content/data.ndtl"></script> <script src="content/data.ndtl"></script>

View File

@ -1,184 +0,0 @@
function Runic(raw)
{
this.raw = raw;
this.runes = {
"&":{glyph:"&",tag:"p",class:""},
"~":{glyph:"~",tag:"list",sub:"ln",class:"parent",stash:true},
"-":{glyph:"-",tag:"list",sub:"ln",class:"",stash:true},
"=":{glyph:"=",tag:"list",sub:"ln",class:"mini",stash:true},
"!":{glyph:"!",tag:"table",sub:"tr",wrap:"th",class:"outline",stash:true},
"|":{glyph:"|",tag:"table",sub:"tr",wrap:"td",class:"outline",stash:true},
"#":{glyph:"#",tag:"code",sub:"ln",class:"",stash:true},
"%":{glyph:"%"}, // media
"?":{glyph:"?",tag:"note",class:""},
":":{glyph:":",tag:"info",class:""},
"*":{glyph:"*",tag:"h3",class:""},
">":{glyph:">",tag:"",class:""},
"@":{glyph:"@",tag:"quote",class:""}
}
this.stash = {
rune : "",
all : [],
add : function(rune,item){
this.rune = this.copy(rune)
this.all.push({rune:rune,item:item});
},
pop : function(){
var copy = this.copy(this.all);
this.all = [];
return copy;
},
is_pop : function(rune){
return this.all.length > 0 && rune.tag != this.rune.tag;
},
length: function()
{
return this.all.length;
},
copy : function(data){
return JSON.parse(JSON.stringify(data));
}
}
this.parse = function(raw = this.raw)
{
if(!raw){ return ""; }
var html = "";
var lines = raw;
var lines = !Array.isArray(raw) ? raw.split("\n") : raw;
for(let id in lines)
{
var char = lines[id].substr(0,1).trim().toString()
var rune = this.runes[char];
var trail = lines[id].substr(1,1);
if(char == "%"){
if(this.stash.is_pop(rune)){ html += this.render_stash(); }
html += this.media(lines[id].substr(2));
continue;
}
if(char == "@"){
if(this.stash.is_pop(rune)){ html += this.render_stash(); }
html += this.media(lines[id].substr(2));
continue;
}
var line = lines[id].substr(2).to_markup();
if(!line || line.trim() == ""){ continue; }
if(!rune){ console.log(`Unknown rune:${char} : ${line}`); }
if(trail != " "){ console.warn("Runic","Non-rune["+trail+"] at:"+id+"("+line+")"); continue; }
if(this.stash.is_pop(rune)){ html += this.render_stash(); }
if(rune.stash === true){ this.stash.add(rune,line) ; continue; }
html += this.render(line,rune);
}
if(this.stash.length() > 0){ html += this.render_stash(); }
return html;
}
this.render_stash = function()
{
var rune = this.stash.rune;
var stash = this.stash.pop();
var html = "";
for(let id in stash){
var rune = stash[id].rune;
var line = stash[id].item;
html += rune.wrap ? `<${rune.sub}><${rune.wrap}>${line.replace(/\|/g,`</${rune.wrap}><${rune.wrap}>`).trim()}</${rune.wrap}></${rune.sub}>` : `<${rune.sub}>${line}</${rune.sub}>`;
}
return `<${rune.tag} class='${rune.class}'>${html}</${rune.tag}>`
}
this.render = function(line = "",rune = null)
{
if(rune && rune.tag == "img"){ return `<img src='media/${line}'/>`; }
if(rune && rune.tag == "table"){ return "HEY"; }
return rune ? (rune.tag ? `<${rune.tag} class='${rune.class}'>${line}</${rune.tag}>` : line) : "";
}
this.media = function(val)
{
var service = val.split(" ")[0];
let id = val.split(" ")[1];
if(service == "itchio"){
return `<iframe frameborder="0" src="https://itch.io/embed/${id}?bg_color=262626&amp;fg_color=e4e4e3&amp;link_color=e4e4e3&amp;border_color=262626&amp" width="600" height="167"></iframe>`;
}
if(service == "bandcamp"){
return `<iframe style="border: 0; width: 600px; height: 274px;" src="https://bandcamp.com/EmbeddedPlayer/album=${id}/size=large/bgcol=ffffff/linkcol=333333/artwork=small/transparent=true/" seamless></iframe>`;
}
if(service == "youtube"){
return `<iframe width="600" height="315" src="https://www.youtube.com/embed/${id}?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>`;
}
if(service == "custom"){
return `<iframe src='${id}' style='width:100%;height:350px;'></iframe>`;
}
return `<img src='content/images/${service}' class='${id}'/>`
}
this.quote = function(content)
{
var parts = content.split(" | ")
var text = parts[0]
var author = parts[1]
var source = parts[2]
var link = parts[3]
return `<quote><p class='text'>${text}</p>${author ? `<p class='attrib'>${link ? `${author}, <a href='${link}'>${source}</a>` : `${author}`}</p>` : ''}</quote>`
}
this.html = function()
{
return this.parse(raw);
}
this.toString = function()
{
return this.html();
}
}
String.prototype.capitalize = function()
{
return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
}
String.prototype.to_url = function()
{
return this.toLowerCase().replace(/ /g,"+").replace(/[^0-9a-z\+]/gi,"").trim();
}
String.prototype.to_path = function()
{
return this.toLowerCase().replace(/ /g,".").replace(/[^0-9a-z\.]/gi,"").trim();
}
String.prototype.to_markup = function()
{
html = this;
html = html.replace(/{_/g,"<i>").replace(/_}/g,"</i>")
html = html.replace(/{\*/g,"<b>").replace(/\*}/g,"</b>")
html = html.replace(/{\#/g,"<code class='inline'>").replace(/\#}/g,"</code>")
var parts = html.split("{{")
for(let id in parts){
var part = parts[id];
if(part.indexOf("}}") == -1){ continue; }
var content = part.split("}}")[0];
var target = content.indexOf("|") > -1 ? content.split("|")[1] : content;
var name = content.indexOf("|") > -1 ? content.split("|")[0] : content;
var external = (target.indexOf("https:") > -1 || target.indexOf("http:") > -1 || target.indexOf("dat:") > -1);
html = html.replace(`{{${content}}}`,external ? `<a href='${target}' class='external' target='_blank'>${name}</a>` : `<a class='local' href='#${target.to_url()}'>${name}</a>`)
}
return html;
}
String.prototype.toProperCase = function ()
{
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}