mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 02:20:08 +00:00
updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
09dce66dde
commit
f5d2ec7b7b
30
wiki.js
30
wiki.js
@ -75,6 +75,7 @@ var macro = {
|
|||||||
// ..text..
|
// ..text..
|
||||||
// </macro>
|
// </macro>
|
||||||
//
|
//
|
||||||
|
//
|
||||||
__macro__pattern__:
|
__macro__pattern__:
|
||||||
/<([a-zA-Z-_:]+)(.|[\n\r])*?(>(.|[\n\r])*?<\/\1>|\/>)|@([a-zA-Z-_]+)\(([^)]*)\)/mg,
|
/<([a-zA-Z-_:]+)(.|[\n\r])*?(>(.|[\n\r])*?<\/\1>|\/>)|@([a-zA-Z-_]+)\(([^)]*)\)/mg,
|
||||||
|
|
||||||
@ -85,9 +86,8 @@ var macro = {
|
|||||||
'wikiword',
|
'wikiword',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Maacros...
|
// Macros...
|
||||||
//
|
//
|
||||||
// stage 1...
|
|
||||||
// XXX do not like how args are defined...
|
// XXX do not like how args are defined...
|
||||||
// ...putting them in the same pot as the macro-handlers is
|
// ...putting them in the same pot as the macro-handlers is
|
||||||
// error-prone, need a bit more separation -- constructor?
|
// error-prone, need a bit more separation -- constructor?
|
||||||
@ -169,7 +169,9 @@ var macro = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// stage 2...
|
|
||||||
|
// Post macros...
|
||||||
|
//
|
||||||
post_macro: {
|
post_macro: {
|
||||||
slot_args: ['name'],
|
slot_args: ['name'],
|
||||||
slot: function(context, args, text, state){
|
slot: function(context, args, text, state){
|
||||||
@ -202,6 +204,20 @@ var macro = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Parsing:
|
||||||
|
// 1) expand macros
|
||||||
|
// 2) apply filters
|
||||||
|
// 3) merge and parse included pages:
|
||||||
|
// 1) expand macros
|
||||||
|
// 2) apply filters
|
||||||
|
// 4) expand post-macros
|
||||||
|
//
|
||||||
|
// NOTE: stage 4 parsing is executed on the final merged page only
|
||||||
|
// once. i.e. it is not performed on the included pages.
|
||||||
|
// NOTE: included pages are parsed in their own context.
|
||||||
|
// NOTE: slots are parsed in the context of their containing page
|
||||||
|
// and not in the location they are being placed.
|
||||||
|
//
|
||||||
parseElem: function(text, stage){
|
parseElem: function(text, stage){
|
||||||
var res = {}
|
var res = {}
|
||||||
|
|
||||||
@ -258,10 +274,10 @@ var macro = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// macro stage 1...
|
// macro...
|
||||||
text = _parse(context, text, this.macro)
|
text = _parse(context, text, this.macro)
|
||||||
|
|
||||||
// filter stage....
|
// filter...
|
||||||
state.filters
|
state.filters
|
||||||
.concat(this.__filters__)
|
.concat(this.__filters__)
|
||||||
// unique -- leave last occurance..
|
// unique -- leave last occurance..
|
||||||
@ -308,7 +324,7 @@ var macro = {
|
|||||||
.outerHTML
|
.outerHTML
|
||||||
})
|
})
|
||||||
|
|
||||||
// macro stage 2...
|
// post macro...
|
||||||
if(!skip_post){
|
if(!skip_post){
|
||||||
text = _parse(context, text, this.post_macro)
|
text = _parse(context, text, this.post_macro)
|
||||||
}
|
}
|
||||||
@ -688,8 +704,6 @@ var Wiki = {
|
|||||||
return this.title == 'raw' ? this.raw
|
return this.title == 'raw' ? this.raw
|
||||||
: macro.parse(this, this.raw, state, skip_post)
|
: macro.parse(this, this.raw, state, skip_post)
|
||||||
},
|
},
|
||||||
// XXX not sure if this should return special function result as-is...
|
|
||||||
// ...might be better to just special-case the 'raw' in path...
|
|
||||||
get text(){
|
get text(){
|
||||||
return this.parse() },
|
return this.parse() },
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user