Skip to content

Commit

Permalink
extention -> extension
Browse files Browse the repository at this point in the history
  • Loading branch information
afelix committed Dec 14, 2011
1 parent 6199fb1 commit e8b1dfb
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 52 deletions.
30 changes: 15 additions & 15 deletions lib/shmakowiki.js
Expand Up @@ -956,7 +956,7 @@ if (global === ometajs_) {
}
}.call(this);
});
return [ "extention", s[1], ShmakoWiki["extentions"].hasOwnProperty(s[1]) ? ShmakoWiki["extentions"][s[1]](c, s[2]) : c, s[2] ];
return [ "extension", s[1], ShmakoWiki["extensions"].hasOwnProperty(s[1]) ? ShmakoWiki["extensions"][s[1]](c, s[2]) : c, s[2] ];
}.call(this);
},
allBlock: function() {
Expand All @@ -982,12 +982,12 @@ if (global === ometajs_) {
});
}
});
ShmakoWiki["extentions"] = {
ShmakoWiki["extensions"] = {
ohl: function(c, p) {
return OmetaHighlighter.matchAll(c, p);
}
};
ShmakoWiki["extentions"]["hl"] = ShmakoWiki["extentions"]["ohl"];
ShmakoWiki["extensions"]["hl"] = ShmakoWiki["extensions"]["ohl"];
ShmakoWiki["arrJoin"] = function(arr1, arr2) {
var newArr = ShmakoWiki.arrCopy(arr1);
for (var i = 0; i < arr2["length"]; i++) {
Expand Down Expand Up @@ -1103,12 +1103,12 @@ if (global === ometajs_) {
return "ulist";
case "lineBreak":
return "lineBreak";
case "extention":
return "extention";
case "superscript_":
return "superscript_";
case "link":
return "link";
case "extension":
return "extension";
case "bold":
return "bold";
default:
Expand Down Expand Up @@ -1366,13 +1366,13 @@ if (global === ometajs_) {
return "<li>" + c + "</li>";
}.call(this);
},
extention: function() {
extension: function() {
var $elf = this, _fromIdx = this.input.idx, t, c, p;
return function() {
t = this._apply("anything");
c = this._apply("anything");
p = this._apply("anything");
return ShmakoWikiToHtml["extentions"].hasOwnProperty(t) ? ShmakoWikiToHtml["extentions"][t](c, p) : "<div>" + ShmakoWikiToHtml._escape(c) + "</div>";
return ShmakoWikiToHtml["extensions"].hasOwnProperty(t) ? ShmakoWikiToHtml["extensions"][t](c, p) : "<div>" + ShmakoWikiToHtml._escape(c) + "</div>";
}.call(this);
},
topLevel: function() {
Expand All @@ -1383,7 +1383,7 @@ if (global === ometajs_) {
}.call(this);
}
});
ShmakoWikiToHtml["extentions"] = {
ShmakoWikiToHtml["extensions"] = {
html: function(c) {
return c;
},
Expand All @@ -1394,7 +1394,7 @@ if (global === ometajs_) {
return '<pre><code class="' + p + '">' + ShmakoWikiToHtml._escape(c) + "</code></pre>";
}
};
ShmakoWikiToHtml["extentions"]["hl"] = ShmakoWikiToHtml["extentions"]["ohl"];
ShmakoWikiToHtml["extensions"]["hl"] = ShmakoWikiToHtml["extensions"]["ohl"];
ShmakoWikiToHtml["_escape"] = function() {
var amp = new RegExp("&", "g"), lt = new RegExp("<", "g"), gt = new RegExp(">", "g"), apos = new RegExp("'", "g"), quot = new RegExp('"', "g");
return function(s) {
Expand Down Expand Up @@ -1491,12 +1491,12 @@ if (global === ometajs_) {
return "ulist";
case "lineBreak":
return "lineBreak";
case "extention":
return "extention";
case "superscript_":
return "superscript_";
case "link":
return "link";
case "extension":
return "extension";
case "bold":
return "bold";
default:
Expand Down Expand Up @@ -1864,13 +1864,13 @@ if (global === ometajs_) {
};
}.call(this);
},
extention: function() {
extension: function() {
var $elf = this, _fromIdx = this.input.idx, t, c, p;
return function() {
t = this._apply("anything");
c = this._apply("anything");
p = this._apply("anything");
return ShmakoWikiToBemjson["extentions"].hasOwnProperty(t) ? ShmakoWikiToBemjson["extentions"][t](c, p) : {
return ShmakoWikiToBemjson["extensions"].hasOwnProperty(t) ? ShmakoWikiToBemjson["extensions"][t](c, p) : {
tag: "div",
content: ShmakoWikiToBemjson._escape(c)
};
Expand All @@ -1887,7 +1887,7 @@ if (global === ometajs_) {
}.call(this);
}
});
ShmakoWikiToBemjson["extentions"] = {
ShmakoWikiToBemjson["extensions"] = {
html: function(c) {
return c;
},
Expand All @@ -1902,7 +1902,7 @@ if (global === ometajs_) {
};
}
};
ShmakoWikiToBemjson["extentions"]["hl"] = ShmakoWikiToBemjson["extentions"]["ohl"];
ShmakoWikiToBemjson["extensions"]["hl"] = ShmakoWikiToBemjson["extensions"]["ohl"];
ShmakoWikiToBemjson["_escape"] = function() {
var amp = new RegExp("&", "g"), lt = new RegExp("<", "g"), gt = new RegExp(">", "g"), apos = new RegExp("'", "g"), quot = new RegExp('"', "g");
return function(s) {
Expand Down
8 changes: 4 additions & 4 deletions src/shmakowiki.ometajs
Expand Up @@ -111,20 +111,20 @@ ometa ShmakoWiki {

extBlock = extBlockStart:s
((~extBlockEnd(s[0]) char)+:cc -> cc.join('')):c
extBlockEnd(s[0]) (blockEnd | '\n') -> [`extention, s[1],
(ShmakoWiki.extentions.hasOwnProperty(s[1]) ? ShmakoWiki.extentions[s[1]](c, s[2]) : c), s[2]],
extBlockEnd(s[0]) (blockEnd | '\n') -> [`extension, s[1],
(ShmakoWiki.extensions.hasOwnProperty(s[1]) ? ShmakoWiki.extensions[s[1]](c, s[2]) : c), s[2]],

allBlock = extBlock | (anyList:l blockEnd) -> l | header | para,

topLevel = allBlock+
}

ShmakoWiki.extentions = {
ShmakoWiki.extensions = {
'ohl': function(c, p) {
return OmetaHighlighter.matchAll(c, p);
}
};
ShmakoWiki.extentions.hl = ShmakoWiki.extentions.ohl;
ShmakoWiki.extensions.hl = ShmakoWiki.extensions.ohl;

ShmakoWiki.arrJoin = function(arr1, arr2) {
var newArr = ShmakoWiki.arrCopy(arr1);
Expand Down
6 changes: 3 additions & 3 deletions src/shmakowiki.ometajs.js
Expand Up @@ -949,7 +949,7 @@ if (global === ometajs_) {
}
}.call(this);
});
return [ "extention", s[1], ShmakoWiki["extentions"].hasOwnProperty(s[1]) ? ShmakoWiki["extentions"][s[1]](c, s[2]) : c, s[2] ];
return [ "extension", s[1], ShmakoWiki["extensions"].hasOwnProperty(s[1]) ? ShmakoWiki["extensions"][s[1]](c, s[2]) : c, s[2] ];
}.call(this);
},
allBlock: function() {
Expand All @@ -975,12 +975,12 @@ if (global === ometajs_) {
});
}
});
ShmakoWiki["extentions"] = {
ShmakoWiki["extensions"] = {
ohl: function(c, p) {
return OmetaHighlighter.matchAll(c, p);
}
};
ShmakoWiki["extentions"]["hl"] = ShmakoWiki["extentions"]["ohl"];
ShmakoWiki["extensions"]["hl"] = ShmakoWiki["extensions"]["ohl"];
ShmakoWiki["arrJoin"] = function(arr1, arr2) {
var newArr = ShmakoWiki.arrCopy(arr1);
for (var i = 0; i < arr2["length"]; i++) {
Expand Down
10 changes: 5 additions & 5 deletions src/shmakowiki2bemjson.ometajs
Expand Up @@ -13,7 +13,7 @@ ometa ShmakoWikiToBemjson {
| 'link' | 'link_'
| 'lineBreak'
| 'escaped'
| 'extention',
| 'extension',

token = [keyword:t apply(t):ans] -> ans
| :c -> ShmakoWikiToBemjson._escape(c),
Expand Down Expand Up @@ -63,14 +63,14 @@ ometa ShmakoWikiToBemjson {
olistItem tokens:c -> { elem: 'li', content: c },
ulistItem tokens:c -> { elem: 'li', content: c },

extention :t :c :p -> (ShmakoWikiToBemjson.extentions.hasOwnProperty(t) ?
ShmakoWikiToBemjson.extentions[t](c, p) :
extension :t :c :p -> (ShmakoWikiToBemjson.extensions.hasOwnProperty(t) ?
ShmakoWikiToBemjson.extensions[t](c, p) :
{ tag: 'div', content: ShmakoWikiToBemjson._escape(c) }),

topLevel = tokens:c -> { block: 'b-text', content: c }
}

ShmakoWikiToBemjson.extentions = {
ShmakoWikiToBemjson.extensions = {
'html': function(c) { return c },
'ohl': function(c, p) { return OmetaHighlighterToBemjson.match(c, 'topLevel') },
'hljs': function(c, p) {
Expand All @@ -81,7 +81,7 @@ ShmakoWikiToBemjson.extentions = {
};
}
};
ShmakoWikiToBemjson.extentions.hl = ShmakoWikiToBemjson.extentions.ohl;
ShmakoWikiToBemjson.extensions.hl = ShmakoWikiToBemjson.extensions.ohl;

ShmakoWikiToBemjson._escape = (function() {
var amp = new RegExp('&', 'g'),
Expand Down
12 changes: 6 additions & 6 deletions src/shmakowiki2bemjson.ometajs.js
Expand Up @@ -88,12 +88,12 @@ if (global === ometajs_) {
return "ulist";
case "lineBreak":
return "lineBreak";
case "extention":
return "extention";
case "superscript_":
return "superscript_";
case "link":
return "link";
case "extension":
return "extension";
case "bold":
return "bold";
default:
Expand Down Expand Up @@ -461,13 +461,13 @@ if (global === ometajs_) {
};
}.call(this);
},
extention: function() {
extension: function() {
var $elf = this, _fromIdx = this.input.idx, t, c, p;
return function() {
t = this._apply("anything");
c = this._apply("anything");
p = this._apply("anything");
return ShmakoWikiToBemjson["extentions"].hasOwnProperty(t) ? ShmakoWikiToBemjson["extentions"][t](c, p) : {
return ShmakoWikiToBemjson["extensions"].hasOwnProperty(t) ? ShmakoWikiToBemjson["extensions"][t](c, p) : {
tag: "div",
content: ShmakoWikiToBemjson._escape(c)
};
Expand All @@ -484,7 +484,7 @@ if (global === ometajs_) {
}.call(this);
}
});
ShmakoWikiToBemjson["extentions"] = {
ShmakoWikiToBemjson["extensions"] = {
html: function(c) {
return c;
},
Expand All @@ -499,7 +499,7 @@ if (global === ometajs_) {
};
}
};
ShmakoWikiToBemjson["extentions"]["hl"] = ShmakoWikiToBemjson["extentions"]["ohl"];
ShmakoWikiToBemjson["extensions"]["hl"] = ShmakoWikiToBemjson["extensions"]["ohl"];
ShmakoWikiToBemjson["_escape"] = function() {
var amp = new RegExp("&", "g"), lt = new RegExp("<", "g"), gt = new RegExp(">", "g"), apos = new RegExp("'", "g"), quot = new RegExp('"', "g");
return function(s) {
Expand Down
10 changes: 5 additions & 5 deletions src/shmakowiki2html.ometajs
Expand Up @@ -13,7 +13,7 @@ ometa ShmakoWikiToHtml {
| 'link' | 'link_'
| 'lineBreak'
| 'escaped'
| 'extention',
| 'extension',

token = [keyword:t apply(t):ans] -> ans
| :c -> ShmakoWikiToHtml._escape(c),
Expand Down Expand Up @@ -63,14 +63,14 @@ ometa ShmakoWikiToHtml {
olistItem tokens:c -> ('<li>' + c + '</li>'),
ulistItem tokens:c -> ('<li>' + c + '</li>'),

extention :t :c :p -> (ShmakoWikiToHtml.extentions.hasOwnProperty(t) ?
ShmakoWikiToHtml.extentions[t](c, p) :
extension :t :c :p -> (ShmakoWikiToHtml.extensions.hasOwnProperty(t) ?
ShmakoWikiToHtml.extensions[t](c, p) :
'<div>' + ShmakoWikiToHtml._escape(c) + '</div>'),

topLevel = tokens:c -> ('<div class="shmakowiki">' + c + '</div>')
}

ShmakoWikiToHtml.extentions = {
ShmakoWikiToHtml.extensions = {
'html': function(c) { return c },
'ohl': function(c, p) { return OmetaHighlighterToHtml.match(c, 'topLevel') },
'hljs': function(c, p) {
Expand All @@ -79,7 +79,7 @@ ShmakoWikiToHtml.extentions = {
'</code></pre>'
}
};
ShmakoWikiToHtml.extentions.hl = ShmakoWikiToHtml.extentions.ohl;
ShmakoWikiToHtml.extensions.hl = ShmakoWikiToHtml.extensions.ohl;

ShmakoWikiToHtml._escape = (function() {
var amp = new RegExp('&', 'g'),
Expand Down
12 changes: 6 additions & 6 deletions src/shmakowiki2html.ometajs.js
Expand Up @@ -88,12 +88,12 @@ if (global === ometajs_) {
return "ulist";
case "lineBreak":
return "lineBreak";
case "extention":
return "extention";
case "superscript_":
return "superscript_";
case "link":
return "link";
case "extension":
return "extension";
case "bold":
return "bold";
default:
Expand Down Expand Up @@ -351,13 +351,13 @@ if (global === ometajs_) {
return "<li>" + c + "</li>";
}.call(this);
},
extention: function() {
extension: function() {
var $elf = this, _fromIdx = this.input.idx, t, c, p;
return function() {
t = this._apply("anything");
c = this._apply("anything");
p = this._apply("anything");
return ShmakoWikiToHtml["extentions"].hasOwnProperty(t) ? ShmakoWikiToHtml["extentions"][t](c, p) : "<div>" + ShmakoWikiToHtml._escape(c) + "</div>";
return ShmakoWikiToHtml["extensions"].hasOwnProperty(t) ? ShmakoWikiToHtml["extensions"][t](c, p) : "<div>" + ShmakoWikiToHtml._escape(c) + "</div>";
}.call(this);
},
topLevel: function() {
Expand All @@ -368,7 +368,7 @@ if (global === ometajs_) {
}.call(this);
}
});
ShmakoWikiToHtml["extentions"] = {
ShmakoWikiToHtml["extensions"] = {
html: function(c) {
return c;
},
Expand All @@ -379,7 +379,7 @@ if (global === ometajs_) {
return '<pre><code class="' + p + '">' + ShmakoWikiToHtml._escape(c) + "</code></pre>";
}
};
ShmakoWikiToHtml["extentions"]["hl"] = ShmakoWikiToHtml["extentions"]["ohl"];
ShmakoWikiToHtml["extensions"]["hl"] = ShmakoWikiToHtml["extensions"]["ohl"];
ShmakoWikiToHtml["_escape"] = function() {
var amp = new RegExp("&", "g"), lt = new RegExp("<", "g"), gt = new RegExp(">", "g"), apos = new RegExp("'", "g"), quot = new RegExp('"', "g");
return function(s) {
Expand Down
16 changes: 8 additions & 8 deletions tests/tests.js
Expand Up @@ -382,23 +382,23 @@ var tests = [
'in': 'line1\n%%\next1\n%%\n%%A%\next2\n%A%%\n%%A%html\n<b>bol%%d</b>\n%A%%\n\n%%bla\nblabla\n%%',
'out': [
['para', ['line1']],
['extention', '', 'ext1', ''],
['extention', '', 'ext2', ''],
['extention', 'html', '<b>bol%%d</b>', ''],
['extention', 'bla', 'blabla', '']
['extension', '', 'ext1', ''],
['extension', '', 'ext2', ''],
['extension', 'html', '<b>bol%%d</b>', ''],
['extension', 'bla', 'blabla', '']
]
},
{
'in': '%%ext params\nextcont\n%%',
'out': [
['extention', 'ext', 'extcont', 'params']
['extension', 'ext', 'extcont', 'params']
]
},
{
'in': '%%ohl js\nvar b = \'bla\';\n%%',
'out': [
[
'extention', 'ohl',
'extension', 'ohl',
[
'js',
[
Expand All @@ -422,7 +422,7 @@ var tests = [
'in': '%%hl js\nvar b = \'bla\';\n%%',
'out': [
[
'extention', 'hl',
'extension', 'hl',
[
'js',
[
Expand All @@ -444,7 +444,7 @@ var tests = [
'in': 'bla\n%%hljs javascript\nfunction() { return true }\n%%\nbla',
'out': [
['para', ['bla']],
['extention', 'hljs', 'function() { return true }', 'javascript'],
['extension', 'hljs', 'function() { return true }', 'javascript'],
['para', ['bla']]
]
},
Expand Down

0 comments on commit e8b1dfb

Please sign in to comment.