` - } - - 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,"").replace(/_}/g,"") - html = html.replace(/{\*/g,"").replace(/\*}/g,"") - html = html.replace(/{\#/g,"${text}
${author ? `${link ? `${author}, ${source}` : `${author}`}
` : ''}
").replace(/\#}/g,"
")
-
- 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 ? `${name}` : `${name}`)
- }
- return html;
-}
-
-String.prototype.toProperCase = function ()
-{
- return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
-}
\ No newline at end of file