mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-24 16:26:42 +00:00
cleanup and fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
dd1ac686f3
commit
2d2345a589
@ -249,6 +249,7 @@ module.BaseParser = {
|
|||||||
|
|
||||||
// place join block between block elements...
|
// place join block between block elements...
|
||||||
joinBlocks: function(page, blocks, join, state){
|
joinBlocks: function(page, blocks, join, state){
|
||||||
|
var that = this
|
||||||
if(typeof(blocks) == 'string'
|
if(typeof(blocks) == 'string'
|
||||||
|| join == null){
|
|| join == null){
|
||||||
return blocks }
|
return blocks }
|
||||||
@ -256,10 +257,18 @@ module.BaseParser = {
|
|||||||
.map(function(block, i, l){
|
.map(function(block, i, l){
|
||||||
return [
|
return [
|
||||||
block,
|
block,
|
||||||
this.expand(page, join, state),
|
...(i < l.length-1 ?
|
||||||
|
that.expand(page, join, state)
|
||||||
|
: []),
|
||||||
] })
|
] })
|
||||||
.flat() },
|
.flat() },
|
||||||
|
filterBlocks: function(page, blocks, filter, state){
|
||||||
|
if(filter == null){
|
||||||
|
return blocks }
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
|
||||||
|
return blocks },
|
||||||
|
|
||||||
// Strip comments...
|
// Strip comments...
|
||||||
//
|
//
|
||||||
@ -1649,9 +1658,7 @@ module.parser = {
|
|||||||
// i.e. for @include(PATH) the paths within the included page
|
// i.e. for @include(PATH) the paths within the included page
|
||||||
// are resolved relative to PATH while for @source(PATH)
|
// are resolved relative to PATH while for @source(PATH)
|
||||||
// relative to the page containing the @source(..) statement...
|
// relative to the page containing the @source(..) statement...
|
||||||
// XXX UPDATE...
|
|
||||||
source: Macro(
|
source: Macro(
|
||||||
// XXX should this have the same args as include???
|
|
||||||
['src', 'recursive', 'join',
|
['src', 'recursive', 'join',
|
||||||
['s', 'strict']],
|
['s', 'strict']],
|
||||||
//['src'],
|
//['src'],
|
||||||
@ -1689,7 +1696,6 @@ module.parser = {
|
|||||||
function(src){
|
function(src){
|
||||||
var text =
|
var text =
|
||||||
src ?
|
src ?
|
||||||
// can be async...
|
|
||||||
page.get(src).raw
|
page.get(src).raw
|
||||||
: body ?
|
: body ?
|
||||||
body
|
body
|
||||||
@ -1697,7 +1703,15 @@ module.parser = {
|
|||||||
return Promise.awaitOrRun(
|
return Promise.awaitOrRun(
|
||||||
text,
|
text,
|
||||||
function(text){
|
function(text){
|
||||||
return that.joinBlocks(page, text, args.join, state) }) }) })),
|
return that.joinBlocks(
|
||||||
|
page,
|
||||||
|
that.filterBlocks(
|
||||||
|
page,
|
||||||
|
text,
|
||||||
|
args.filter,
|
||||||
|
state),
|
||||||
|
args.join,
|
||||||
|
state) }) }) })),
|
||||||
|
|
||||||
//
|
//
|
||||||
// @quote(<src>)
|
// @quote(<src>)
|
||||||
|
|||||||
@ -17,7 +17,10 @@ module.exports.PAGES = {
|
|||||||
'/page': 'Page',
|
'/page': 'Page',
|
||||||
'/async/page': Promise.resolve('Page'),
|
'/async/page': Promise.resolve('Page'),
|
||||||
'/includePage': '@include(/page)',
|
'/includePage': '@include(/page)',
|
||||||
'/isolated': '@slot(slot original)'
|
'/isolated': '@slot(slot original)',
|
||||||
|
'/includeSelf': '@include(/includeSelf)',
|
||||||
|
'/async/includeSelf': Promise.resolve('@include(/includeSelf)'),
|
||||||
|
'/multi/page': [ 'A', 'B', 'C' ],
|
||||||
}
|
}
|
||||||
|
|
||||||
var P =
|
var P =
|
||||||
@ -218,6 +221,8 @@ test.Setups({
|
|||||||
} },
|
} },
|
||||||
// XXX recursion...
|
// XXX recursion...
|
||||||
// XXX
|
// XXX
|
||||||
|
|
||||||
|
// quote...
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user