Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-07-19 02:47:44 +03:00
parent 54edbc70b1
commit cf580422f5

43
wiki.js
View File

@ -549,22 +549,13 @@ var macro = {
context: null, context: null,
// XXX this is preliminary... // Maacros...
// XXX add wikiword... //
// filter(text) -> html // stage 1...
filter: { // XXX do not like how args are defined...
default: 'html', // ...putting them in the same pot as the macro-handlers is
// error-prone, need a bit more separation -- constructor?
html: function(text){ return $('<div>').html(text).html() }, // Macro( <doc>, <args>, <func> )
json: 'text',
text: function(text){ return $('<div>').text(text).html() },
wikiword: function(text){ return setWikiWords(text) },
},
// macro stage 1...
// XXX do not like how args are defined....
macro: { macro: {
// select filter to post-process text... // select filter to post-process text...
filter_args: ['name'], filter_args: ['name'],
@ -606,8 +597,7 @@ var macro = {
} }
}, },
}, },
// stage 2...
// macro stage 2...
// XXX rename... // XXX rename...
macro2: { macro2: {
slot_args: ['name'], slot_args: ['name'],
@ -623,6 +613,22 @@ var macro = {
}, },
}, },
// Filters...
//
// XXX this is preliminary...
// XXX add wikiword...
// filter(text) -> html
filter: {
default: 'html',
html: function(text){ return $('<div>').html(text).html() },
json: 'text',
text: function(text){ return $('<div>').text(text).html() },
wikiword: function(text){ return setWikiWords(text) },
},
parseElem: function(text, stage){ parseElem: function(text, stage){
var res = {} var res = {}
@ -657,7 +663,6 @@ var macro = {
return res return res
}, },
// XXX do we need to parse the contents of tags here??? (nested patterns?)
parse: function(text, context){ parse: function(text, context){
var that = this var that = this
var filters = [] var filters = []