').html(text).html() },
json: 'text',
text: function(text){ return $('
').text(text).html() },
wikiword: function(text){ return setWikiWords(text) },
},
parseElem: function(text, stage){
var res = {}
// @
()
if(text[0] == '@'){
var d = text.match(/@([a-zA-Z-_:]*)\(([^)]*)\)/)
res.text = ''
res.name = d[1]
var args = res.args = {}
var a = d[2].split(/\s+/g)
a.forEach(function(e, i){
args[(stage[res.name + '_args'] || [])[i]] = e
})
// html-like...
} else {
var elem = res.elem = $('').html(text).children().eq(0)
res.name = elem.prop('tagName').toLowerCase()
var args = res.args = {}
var a = elem.prop('attributes')
for(var i=0; i
look inside...
: m.elem && m.text != ''?
m.elem.html(_parse(m.text, macro))[0].outerHTML
// else nothing changed...
: match
})
}
// macro stage 1...
text = _parse(text, this.macro)
// macro stage 2...
text = _parse(text, this.macro2)
// filter stage....
filters
.concat(this.__filters__)
// unique -- leave last occurance..
.filter(function(k, i, lst){
return k[0] != '-'
// filter dupplicates...
&& lst.slice(i+1).indexOf(k) == -1
// filter disabled...
&& lst.slice(0, i).indexOf('-' + k) == -1
})
// unique -- leave first occurance..
//.filter(function(k, i, lst){ return lst.slice(0, i).indexOf(k) == -1 })
// apply the filters...
.forEach(function(k){
// get filter aliases...
var seen = []
while(typeof(k) == typeof('str') && seen.indexOf(k) == -1){
seen.push(k)
k = that.filter[k]
}
// call the filter
text = k.call(that, text)
})
return text
},
}
/**********************************************************************
* vim:set ts=4 sw=4 : */