diff --git a/pwiki/page.js b/pwiki/page.js index b852452..f2a1e62 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -840,7 +840,6 @@ object.Constructor('Page', BasePage, { base.get(this.QUOTE_ACTION_PAGE).raw : await page.raw - page.path && depends.add(page.path) @@ -1059,13 +1058,13 @@ object.Constructor('Page', BasePage, { [text, join] = state.macros[name] } } if(src){ - var match = this.get(await base.parse(src, state)) - join = _getBlock('join') ?? join join = join && await base.parse(join, state) + var match = this.get(await base.parse(src, state)) + // NOTE: thie does not introduce a dependency on each // of the iterated pages, that is handled by the // respective include/source/.. macros, this however @@ -1217,6 +1216,10 @@ object.Constructor('Page', BasePage, { // // NOTE: this uses .PAGE_TEMPLATE to render the page. // NOTE: writing to .raw is the same as writing to .text... + // + // NOTE: .__debug_last_render_state is mainly exposed for introspection + // and debugging, set comment it out to disable... + //__debug_last_render_state: undefined, get text(){ return (async function(){ var path = pwpath.split(this.path) path.at(-1)[0] == '_' @@ -1235,6 +1238,9 @@ object.Constructor('Page', BasePage, { // render template in context of page... var depends = this.depends = new Set([tpl]) var state = {depends} + // this is here for debugging and introspection... + '__debug_last_render_state' in this + && (this.__debug_last_render_state = state) var data = { render_root: this } return this.get(path, data) .parse( @@ -1255,7 +1261,8 @@ object.Constructor('Page', BasePage, { //--------------------------------------------------------------------- -var getCachedProp = function(obj, name){ +var getCachedProp = +function(obj, name){ var that = obj var value = obj.cache ? obj.cache[name] @@ -1264,7 +1271,8 @@ var getCachedProp = function(obj, name){ && value.then(function(value){ that.cache = {[name]: value} }) return value } -var setCachedProp = function(obj, name, value){ +var setCachedProp = +function(obj, name, value){ return object.parentProperty(CachedPage.prototype, name).set.call(obj, value) } // XXX this is good enough on the front-side to think about making the diff --git a/pwiki/store/base.js b/pwiki/store/base.js index 0e5ed03..cd88af5 100755 --- a/pwiki/store/base.js +++ b/pwiki/store/base.js @@ -136,6 +136,13 @@ module.BaseStore = { ...await this.__names(), } }, + // XXX sort paths based on search order into three groups: + // - non-system + // ...sorted by length? + // - system + // ...sort based on system search order? + __sort_names: function(){}, + __cache_add: function(path){ if(this.__paths_cache){ this.__paths_cache.includes(path) diff --git a/pwiki2.js b/pwiki2.js index fde46cb..9a619e3 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -1,6 +1,14 @@ /********************************************************************** * * +* XXX page search: make things invariant via .names +* - if a page is in a system path and there are no alternatives +* just return it and do not search. +* - if there are alternatives rank them +* - check the non-system ones (common sub-path?) +* - return the first system +* XXX sort paths in .names +* XXX remove/mark shadowed paths??? * XXX NORMCACHE .normalize(..) cache normalized strings... * ...seems to have little impact... * XXX MATCH limit candidates to actual page name matches -- this will @@ -27,8 +35,9 @@ * mark the normalized string and return it as-is on * renormalization... * ...initial experiment made things slower... -* XXX need a uniform way to track some state in links in pwiki for things -* like paging and the like with simple user/macro access (???)... +* XXX FEATURE eed a uniform way to track some state in links in pwiki +* for things like paging and the like with simple user/macro +* access (???)... * ...the simplest that comes to mind is to store in in path * somehow: * - ?=&... @@ -76,6 +85,8 @@ * ...might be a good idea to make filters local only... * XXX slots/macros might also pose a problem... * 2) all the macros that can source pages to produce generators (DONE) +* XXX might be a good idea to parse a page into an executable/function +* that would render self in a given context... * XXX the parser should handle all action return values, including: * - lists -- DONE * - iterators -- DONE