mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-25 00:36:41 +00:00
tweaking and tests...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5dda9c3f49
commit
8675c92b66
@ -530,6 +530,8 @@ module.BaseParser = {
|
|||||||
//
|
//
|
||||||
// // wait for all...
|
// // wait for all...
|
||||||
// wait: <promise> | null,
|
// wait: <promise> | null,
|
||||||
|
//
|
||||||
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -1572,28 +1574,25 @@ module.parser = {
|
|||||||
// content handler...
|
// content handler...
|
||||||
handler ??=
|
handler ??=
|
||||||
function(page, text, state){
|
function(page, text, state){
|
||||||
return this.expand(page, text, state) }
|
// XXX should this be the difference between
|
||||||
|
// @include(..) and @source(..)???
|
||||||
|
return args.isolated ?
|
||||||
|
this.resolve(page, text,
|
||||||
|
args.isolated == 'partial' ?
|
||||||
|
// XXX
|
||||||
|
serialize.partialDeepCopy(state)
|
||||||
|
: {})
|
||||||
|
: this.expand(page, text, state)}
|
||||||
|
|
||||||
var pageHandler =
|
var pageHandler =
|
||||||
function(text, i, l){
|
function(text, i, l){
|
||||||
return [
|
return [
|
||||||
handler.call(that,
|
handler.call(that, page, text, state),
|
||||||
page,
|
|
||||||
text,
|
|
||||||
// isolated up -- will see all
|
|
||||||
// the state but can have no
|
|
||||||
// side-effects...
|
|
||||||
args.isolated == 'partial' ?
|
|
||||||
serialize.partialDeepCopy(state)
|
|
||||||
// fully isolated...
|
|
||||||
: args.isolated ?
|
|
||||||
{}
|
|
||||||
: state),
|
|
||||||
// join...
|
// join...
|
||||||
(args.join
|
(args.join
|
||||||
&& i < l.length - 1) ?
|
&& i < l.length - 1) ?
|
||||||
that.expand(page, args.join, state)
|
that.expand(page, args.join, state)
|
||||||
: []
|
: [],
|
||||||
].flat() }
|
].flat() }
|
||||||
var resultHandler =
|
var resultHandler =
|
||||||
function(pages){
|
function(pages){
|
||||||
|
|||||||
@ -17,6 +17,7 @@ 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)'
|
||||||
}
|
}
|
||||||
|
|
||||||
var P =
|
var P =
|
||||||
@ -177,6 +178,7 @@ test.Setups({
|
|||||||
// XXX
|
// XXX
|
||||||
|
|
||||||
// include...
|
// include...
|
||||||
|
// XXX see inside...
|
||||||
include: function(assert, path='/blank', expected){
|
include: function(assert, path='/blank', expected){
|
||||||
return {
|
return {
|
||||||
page: P,
|
page: P,
|
||||||
@ -197,6 +199,25 @@ test.Setups({
|
|||||||
return this.include(assert, '/includePage', 'Page') },
|
return this.include(assert, '/includePage', 'Page') },
|
||||||
include_async: function(assert){
|
include_async: function(assert){
|
||||||
return this.include(assert, '/async/page', 'Page') },
|
return this.include(assert, '/async/page', 'Page') },
|
||||||
|
// islotaed...
|
||||||
|
include_nonisolated: function(assert){
|
||||||
|
return {
|
||||||
|
page: P,
|
||||||
|
code:[
|
||||||
|
'@include("/isolated") @slot(slot overloaded)',
|
||||||
|
'overloaded ',
|
||||||
|
],
|
||||||
|
} },
|
||||||
|
include_isolated: function(assert){
|
||||||
|
return {
|
||||||
|
page: P,
|
||||||
|
code:[
|
||||||
|
'@include(isolated /isolated) @slot(slot overloaded)',
|
||||||
|
'original overloaded',
|
||||||
|
],
|
||||||
|
} },
|
||||||
|
// XXX recursion...
|
||||||
|
// XXX
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user