Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-08 01:56:55 +03:00
parent 6f4e2caa7a
commit c2eddd9d9d
3 changed files with 16 additions and 42 deletions

View File

@ -24,6 +24,7 @@ var markdown = require('./filters/markdown')
var relProxy =
function(name){
var func = function(path='.:$ARGS', ...args){
path = this.resolvePathVars(path)
return this.store[name](
pwpath.relative(this.path, path),
...args) }
@ -35,6 +36,7 @@ function(name){
if(path === true || path === false){
strict = path
path = '.:$ARGS' }
path = this.resolvePathVars(path)
return this.store[name](
pwpath.relative(this.path, path),
strict) }
@ -755,9 +757,7 @@ object.Constructor('Page', BasePage, {
['name', 'default', ['local']],
function(args){
return this.macros.arg.call(this, args) }),
// XXX do we need this???
args: function(){
console.log('!!!!')
return pwpath.obj2args(this.args) },
//
// @filter(<filter-spec>)
@ -1859,6 +1859,7 @@ module.System = {
(<a href="#@source(../resolved)/edit">edit</a>)<br>
Referrer: @source(../referrer)
(<a href="#@source(../referrer)/edit">edit</a>)<br>
Args: <args/><br>
type: @source(../type)<br>

View File

@ -83,7 +83,7 @@ module.BaseParser = {
// @(arg ..)
'\\\\?@\\((?<argsUnnamed>UNNAMED_ARGS)\\)',
// <macro ..> | <macro ../>
'<\\s*(?<nameOpen>MACROS)(?<argsOpen>ARGS)?\\s*/?>',
'<\\s*(?<nameOpen>MACROS)(?<argsOpen>\\sARGS)?\\s*/?>',
// </macro>
'</\\s*(?<nameClose>MACROS)\\s*>',
].join('|'))+')',

View File

@ -1,55 +1,28 @@
/**********************************************************************
*
*
* XXX BUG: this does not call the args macro...
* await pwiki.get('/path/testDirect:x:y:z').parse('<args/>')
* ...syntax checking is done correctly though...
* XXX ARGS: arg passing is a mess...
* - need a consistent way to access args
* - global
* .root.args?
* - render root
* - local
* use:
* testDirect - direct action
* testDirect! - energetic direct action
* testPage - page
* testAction - page action
* testAction! - energetic page action
* examples:
* // NOTE: .text is redered via _view and thus is on a different
* // level to .raw...
* // XXX should renderer.args be the same in .text and .parse(..)???
* // XXX for .text and .parse(..), the action is called twice...
* XXX BUG?: the action is called twice here:
* await pwiki.get('/path/testDirect:x:y:z').parse('@include(.:$ARGS)')
* and:
* await pwiki.get('/path/testDirect:x:y:z').text
* XXX ARGS: should the arg locations in these be the same???
* // root path: /System/testAction:a:b:c
* await pwiki.get('/path/testDirect:x:y:z').raw
* .args - x y z
* .renderer.args - a b c
* .root.args - a b c
* await pwiki.get('/path/testAction:x:y:z').raw
* .args - x y z
* .renderer.args - a b c
* .renderer.args - a b c (XXX seems logical)
* .root.args - a b c
* await pwiki.get('/path/testDirect:x:y:z').parse('@include(.:$ARGS)')
* .args - x y z
* .renderer.args - a b c
* .renderer.args - a b c (XXX odd)
* .root.args - a b c
* XXX triggered twice...
* await pwiki.get('/path/testAction:x:y:z').parse('@include(.:$ARGS)')
* .args - x y z
* .renderer.args - a b c
* .root.args - a b c
* XXX triggered twice...
* await pwiki.get('/path/testDirect:x:y:z').text
* .args - x y z
* .renderer.args - x y z
* .renderer.args - x y z (XXX logical)
* .root.args - a b c
* XXX triggered twice...
* await pwiki.get('/path/testAction:x:y:z').text
* .args - x y z
* .renderer.args - x y z
* .root.args - a b c
* XXX triggered twice...
* ...this essentially boils down to how .renderer is handled...
* currently it is inherited and since all pages are clones of the
* root page and the root is rendered it is always the .renderer
* unless we explicitly reassign it (.text)
* XXX CACHE need to explicitly prevent caching of some actions/pages...
* XXX FEATURE tags and accompanying API...
* - add tags to page -- macro/filter