From 51be8b9dff3cb3f9cff9949bafd61aecfb54e9f0 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 12 Apr 2022 22:35:06 +0300 Subject: [PATCH] ... Signed-off-by: Alex A. Naanou --- pwiki2.js | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/pwiki2.js b/pwiki2.js index 7b32b7b..a41aa44 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -12,6 +12,7 @@ /*********************************************************************/ +// XXX might be a good idea to make this compatible with node's path API... var pWikiPath = module.pWikiPath = { @@ -110,9 +111,11 @@ module.pWikiPath = { //--------------------------------------------------------------------- -// XXX should we support page symlinking??? -// XXX store keys must be normalized... +// NOTE: store keys must be normalized... +// // XXX must support store stacks... +// XXX path macros??? +// XXX should we support page symlinking??? var store = module.store = { exists: function(path){ @@ -230,7 +233,40 @@ module.page = { //--------------------------------------------------------------------- +// Abstract macro syntax: +// Inline macro: +// @macro(arg ..) +// +// HTML-like: +// +// +// HTML-like with body: +// +// ..text.. +// +// +// XXX should inline macros support named args??? +var MACRO_PATTERN = + [[ + // @macro(arg ..) + '\\\\?@([a-zA-Z-_]+)\\(([^)]*)\\)', + + // | + '<\\s*($MACROS)(\\s+[^>]*)?/?>', + // + '', + ].join('|'), 'mg'], + +var WIKIWORD_PATTERN = + RegExp('('+[ + //'\\\\?(\\/|\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*', + '\\\\?\\/?(\\./|\\.\\./|>>|[A-Z][_a-z0-9]+[A-Z/])[_a-zA-Z0-9/]*', + '\\\\?\\[[^\\]]+\\]', + ].join('|') +')', 'g'), + var macros = { + now: function(){}, + macro: function(){}, } var expandPage = function(page){ }