diff --git a/pwiki/page.js b/pwiki/page.js index b2dcc96..d3e3848 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -126,14 +126,16 @@ object.Constructor('BasePage', { }, resolvePathVars: function(path='', context={}){ var that = this - return pwpath.normalize( - Object.entries(this.path_vars) - .reduce(function(res, [key, func]){ - return res - .replace( - new RegExp('(\\${'+key+'}|\\$'+key+')', 'g'), - func.call(that, context)) - }, path)) }, + return path == '.' ? + path + : pwpath.normalize( + Object.entries(this.path_vars) + .reduce(function(res, [key, func]){ + return res + .replace( + new RegExp('(\\${'+key+'}|\\$'+key+')', 'g'), + func.call(that, context)) + }, path)) }, // page location... // @@ -990,7 +992,8 @@ object.Constructor('Page', BasePage, { depends, renderer: state.renderer, })} - : this.get(src) + //: this.get(src) + : this .parse(state) } var first = true @@ -2064,7 +2067,12 @@ module.System = { type: @source(../type)
- tags: @source(../tags join=", ")
+ tags: + + @source(.) +
+ related tags: +
ctime: @source(../ctime)
mtime: @source(../mtime)
diff --git a/pwiki/store/base.js b/pwiki/store/base.js index 2cf8172..5028caf 100755 --- a/pwiki/store/base.js +++ b/pwiki/store/base.js @@ -283,13 +283,14 @@ module.BaseStore = { return this.__tags() }, relatedTags: function*(...tags){ - var cur = tags + var cur = new Set(tags) var {tags, paths} = this.tags var seen = new Set() for(var tag of cur){ for(var p of tags[tag] ?? []){ for(var t of paths[p] ?? []){ - if(!seen.has(t)){ + if(!seen.has(t) + && !cur.has(t)){ seen.add(t) yield t } } } } }, diff --git a/pwiki2.js b/pwiki2.js index e23f679..469b9c8 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -18,6 +18,15 @@ * - CLI - * * +* XXX BUG: parser: +* This will break: +* @source(.)
+* This will not: +* @source(.)
+* XXX LIST BUG: : sourcing an element of a list does not work... +* Example: +* await pwiki.parse('@source(.)') +* XXX do we need a way to index a list item via path??? * XXX TAGS * - add tags to page -- macro/filter * - .text -> .tags (cached on .update(..))