mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-25 08:46:43 +00:00
added <content/> to @include(..) -- not yet sure if this is a good idea...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
12d77832a5
commit
97fb6ee856
@ -1456,9 +1456,13 @@ module.parser = {
|
|||||||
// @include(src=<path> isolated recursive=<text>)
|
// @include(src=<path> isolated recursive=<text>)
|
||||||
//
|
//
|
||||||
// <include src=<path> .. >
|
// <include src=<path> .. >
|
||||||
// <text>
|
// ...
|
||||||
|
// <concent/>
|
||||||
|
// ...
|
||||||
// </include>
|
// </include>
|
||||||
//
|
//
|
||||||
|
// NOTE: if body is not empty and <content/> is not present, the
|
||||||
|
// included page will not be placed.
|
||||||
// NOTE: there can be two ways of recursion in pWiki:
|
// NOTE: there can be two ways of recursion in pWiki:
|
||||||
// - flat recursion
|
// - flat recursion
|
||||||
// /A -> /A -> /A -> ..
|
// /A -> /A -> /A -> ..
|
||||||
@ -1473,15 +1477,12 @@ module.parser = {
|
|||||||
// not 100% correct manner focusing on path depth and ignoring
|
// not 100% correct manner focusing on path depth and ignoring
|
||||||
// the context, this potentially can lead to false positives.
|
// the context, this potentially can lead to false positives.
|
||||||
//
|
//
|
||||||
// XXX might be a good idea to add a <content/> tag to place the
|
// XXX do we need the <context/> nested macro???
|
||||||
// loaded text...
|
// XXX should this resolve join and/or body in the context of the
|
||||||
|
// included page or the outer page (current)???
|
||||||
// XXX add path recursion test to data -- fail if two paths resolve
|
// XXX add path recursion test to data -- fail if two paths resolve
|
||||||
// to the same context...
|
// to the same context...
|
||||||
// XXX need a way to make encode option transparent...
|
// XXX need a way to make encode option transparent...
|
||||||
// XXX need a way to wrap the included page...
|
|
||||||
// - template page...
|
|
||||||
// - prefix/sufix...
|
|
||||||
// XXX store a page cache in state...
|
|
||||||
// XXX do we want to load a specific slot/block???
|
// XXX do we want to load a specific slot/block???
|
||||||
// XXX UPDATE...
|
// XXX UPDATE...
|
||||||
include: Macro(
|
include: Macro(
|
||||||
@ -1565,13 +1566,21 @@ module.parser = {
|
|||||||
|
|
||||||
var pageHandler =
|
var pageHandler =
|
||||||
function(text){
|
function(text){
|
||||||
// XXX NOTE: if body set and contains to <content/> macro
|
var content_handled = false
|
||||||
// then the included value will not be displayed...
|
|
||||||
return body ?
|
return body ?
|
||||||
|
// handle body / <content/>...
|
||||||
|
Promise.awaitOrRun(
|
||||||
that.expand(page, body, state,
|
that.expand(page, body, state,
|
||||||
{ content: function(){
|
{ content: function(){
|
||||||
handler_called = true
|
content_handled = true
|
||||||
return text = handler.call(that, page, text, state) } })
|
return text = handler.call(that, page, text, state) } }),
|
||||||
|
function(text){
|
||||||
|
// if no <content/> present we still
|
||||||
|
// need to handle the included page...
|
||||||
|
content_handled
|
||||||
|
|| handler.call(that, page, text, state)
|
||||||
|
return text })
|
||||||
|
// place as-is...
|
||||||
: handler.call(that, page, text, state) }
|
: handler.call(that, page, text, state) }
|
||||||
var resultHandler =
|
var resultHandler =
|
||||||
function(pages){
|
function(pages){
|
||||||
|
|||||||
@ -225,8 +225,17 @@ test.Setups({
|
|||||||
'original overloaded',
|
'original overloaded',
|
||||||
],
|
],
|
||||||
} },
|
} },
|
||||||
|
// content...
|
||||||
|
include_content: function(assert){
|
||||||
|
return {
|
||||||
|
page: P,
|
||||||
|
code: [
|
||||||
|
'<include "/page">[[ <content/> ]]</include>',
|
||||||
|
'[[ '+ P.get('/page').raw +' ]]', ], } },
|
||||||
|
// XXX
|
||||||
|
|
||||||
// recursion...
|
// recursion...
|
||||||
// XXX test path recursion: /A -> /A/A -> /A/A/A -> ...
|
// XXX handle test path recursion: /A -> /A/A -> /A/A/A -> ...
|
||||||
include_recursive_a: function(assert){
|
include_recursive_a: function(assert){
|
||||||
return {
|
return {
|
||||||
page: P,
|
page: P,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user