From 0ce77b42ef71d59279e767aad32ecbdce4f27caf Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 2 Nov 2022 16:31:14 +0300 Subject: [PATCH] now macro attributes are available as macro: vars... Signed-off-by: Alex A. Naanou --- pwiki/page.js | 60 ++++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/pwiki/page.js b/pwiki/page.js index aa9aa4b..96ed757 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -1484,6 +1484,26 @@ object.Constructor('Page', BasePage, { // only depends on page count... depends.add(match.path) + // populate macrovars... + var macrovars = {} + for(var [key, value] + of Object.entries( + Object.assign( + args, + iargs, + { + strict, + isolated, + inheritmacros, + inheritvars, + }))){ + macrovars['macro:'+ key] = + value === true ? + 'yes' + : value === false ? + 'no' + : value } + // expand matches... var first = true for await(var page of match.asPages(strict)){ @@ -1499,8 +1519,9 @@ object.Constructor('Page', BasePage, { {__proto__: macros} : {}, vars: inheritvars ? - {__proto__: vars} - : {}, + {__proto__: vars, + ...macrovars} + : {...macrovars}, } yield this.__parser__.parse(page, this.__parser__.expand(page, @@ -2086,10 +2107,6 @@ module.System = { +'' +'' +''}, - //*/ - //* XXX textarea or contenteditable -- the later has annoying editor features... - // ...while the former can't self-resize and forcing it to messes - // with scrolling... edit: { // XXX not sure if we should use .title or .name here... text: object.doc` @@ -2124,37 +2141,6 @@ module.System = { `}, - /*/ - edit: { - // XXX not sure if we should use .title or .name here... - text: object.doc` - - @source(../title) (edit) - - - ../.. - @source(../location/!) - - - -

- - @source(./title) - -

- -
-
`}, - //*/ - // // XXX EXPERIMENTAL... ed: { text: object.doc` @source(../ed-visual) `},