diff --git a/pwiki/page.js b/pwiki/page.js index aedcdad..b3b460d 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -424,7 +424,6 @@ object.Constructor('BasePage', { [await this.find(path)] : paths //*/ - for(var path of paths){ yield this.get('/'+ path) } }, [Symbol.asyncIterator]: async function*(){ @@ -837,7 +836,8 @@ object.Constructor('Page', BasePage, { // not 100% correct manner focusing on path depth and ignoring // the context, this potentially can lead to false positives. include: Macro( - ['src', 'recursive', 'join', ['strict', 'nonstrict', 'isolated']], + ['src', 'recursive', 'join', + ['strict', 'nonstrict', 'isolated', 'all']], async function*(args, body, state, key='included', handler){ var macro = 'include' if(typeof(args) == 'string'){ @@ -924,7 +924,10 @@ object.Constructor('Page', BasePage, { // include is rendered in the context of its page but with // the same state... source: Macro( - ['src'], + // XXX should this have the same args as include??? + ['src', 'recursive', 'join', + ['strict', 'nonstrict', 'isolated', 'all']], + //['src'], async function*(args, body, state){ yield* this.macros.include.call(this, 'source', @@ -952,7 +955,8 @@ object.Constructor('Page', BasePage, { // // XXX need a way to escape macros -- i.e. include in a quoted text... quote: Macro( - ['src', 'filter', 'text', 'join', ['expandactions']], + ['src', 'filter', 'text', 'join', + ['expandactions', 'all']], async function*(args, body, state){ var src = args.src //|| args[0] var base = this.get(this.path.split(/\*/).shift()) @@ -1157,11 +1161,13 @@ object.Constructor('Page', BasePage, { // // XXX SORT sorting not implemented yet.... macro: Macro( - ['name', 'src', 'sort', 'text', 'join', 'else', ['strict', 'nonstrict']], + ['name', 'src', 'sort', 'text', 'join', 'else', + ['strict', 'nonstrict', 'all']], async function*(args, body, state){ var that = this var name = args.name //?? args[0] var src = args.src + var all = args.all var base = this.get(this.path.split(/\*/).shift()) var sort = (args.sort ?? '') .split(/\s+/g) @@ -1819,7 +1825,7 @@ module.System = { @source(../path) - + @source(./name) @@ -1836,7 +1842,7 @@ module.System = { // XXX this is really slow... tree: { text: object.doc` - +
@source(./name) @@ -1844,12 +1850,12 @@ module.System = { ×
- @source(./tree) + @source("./tree:@(all)")
` }, all: { - text: `@include(../**/path join="@source(line-separator)")`}, + text: `@include("../**/path:@(all)" join="@source(line-separator)")`}, info: { text: object.doc` Path: @source(../path) @@ -2012,6 +2018,10 @@ module.Test = { 'list/static': { text: [...'abcdef'] }, + // this is shown by most listers by adding an :all argument to the url... + '.hidden': { + text: 'Hidden page...' }, + slots: { text: object.doc` Sequential: diff --git a/pwiki/store/base.js b/pwiki/store/base.js index e325b17..2540745 100755 --- a/pwiki/store/base.js +++ b/pwiki/store/base.js @@ -324,6 +324,7 @@ module.BaseStore = { || path.includes('**')){ var order = (this.metadata(path) ?? {}).order || [] var {path, args} = pwpath.splitArgs(path) + var all = args.all args = pwpath.joinArgs('', args) // NOTE: we are matching full paths only here so leading and // trainling '/' are optional... @@ -351,6 +352,9 @@ module.BaseStore = { // skip metadata paths... if(p.includes('*')){ return res } + if(pwpath.basename(p)[0] == '.' + && !all){ + return res } var m = p.match(pattern) m && (!strict @@ -389,6 +393,7 @@ module.BaseStore = { if(path.includes('*') || path.includes('**')){ var p = pwpath.splitArgs(path) + var all = p.args.all var args = pwpath.joinArgs('', p.args) p = pwpath.split(p.path) var tail = [] @@ -396,8 +401,12 @@ module.BaseStore = { tail.unshift(p.pop()) } tail = tail.join('/') if(tail.length > 0){ - return (await this.match(p.join('/'), strict)) + return (await this.match( + p.join('/') + (all ? ':all' : ''), + strict)) .map(function(p){ + all && + (p = p.replace(/:all/, '')) return pwpath.join(p, tail) + args }) } } // direct... return this.match(path, strict) }, diff --git a/pwiki2.js b/pwiki2.js index e277761..de609fa 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -1,6 +1,8 @@ /********************************************************************** * * +* XXX BUG: '@include(@(arg))' does not parse correctly while @include("@(arg)") does... +* ...likely due to the regexp not counting the brace balance... * XXX BUG CHROME: can't .get(..) a generator... * https://bugs.chromium.org/p/chromium/issues/detail?id=1361981 * when done test: