mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-25 16:56:42 +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: <promise> | null,
|
||||
//
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
//
|
||||
@ -1572,28 +1574,25 @@ module.parser = {
|
||||
// content handler...
|
||||
handler ??=
|
||||
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 =
|
||||
function(text, i, l){
|
||||
return [
|
||||
handler.call(that,
|
||||
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),
|
||||
handler.call(that, page, text, state),
|
||||
// join...
|
||||
(args.join
|
||||
&& i < l.length - 1) ?
|
||||
that.expand(page, args.join, state)
|
||||
: []
|
||||
: [],
|
||||
].flat() }
|
||||
var resultHandler =
|
||||
function(pages){
|
||||
|
||||
@ -17,6 +17,7 @@ module.exports.PAGES = {
|
||||
'/page': 'Page',
|
||||
'/async/page': Promise.resolve('Page'),
|
||||
'/includePage': '@include(/page)',
|
||||
'/isolated': '@slot(slot original)'
|
||||
}
|
||||
|
||||
var P =
|
||||
@ -177,6 +178,7 @@ test.Setups({
|
||||
// XXX
|
||||
|
||||
// include...
|
||||
// XXX see inside...
|
||||
include: function(assert, path='/blank', expected){
|
||||
return {
|
||||
page: P,
|
||||
@ -197,6 +199,25 @@ test.Setups({
|
||||
return this.include(assert, '/includePage', 'Page') },
|
||||
include_async: function(assert){
|
||||
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