added .hide_pages list...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-10 19:07:25 +03:00
parent eda30ab087
commit b29248bf49
3 changed files with 29 additions and 2 deletions

View File

@ -140,6 +140,11 @@ module.BaseStore = {
// XXX revise naming...
next: undefined,
// XXX HIDE name??
hide_paths: [
'System',
],
// NOTE: .data is not part of the spec and can be implementation-specific,
// only .__<name>__(..) use it internally... (XXX check this)
__data: undefined,
@ -319,6 +324,7 @@ module.BaseStore = {
// match all sub-paths.
//
match: async function(path, strict=false){
var that = this
// pattern match * / **
if(path.includes('*')
|| path.includes('**')){
@ -352,7 +358,13 @@ module.BaseStore = {
// skip metadata paths...
if(p.includes('*')){
return res }
if(pwpath.basename(p)[0] == '.'
if((pwpath.basename(p)[0] == '.'
// XXX CACHE this???
|| (that.hide_paths
&& that.hide_paths
.reduce(function(res, h){
return res === true
|| p.startsWith(h) }, false)))
&& !all){
return res }
var m = p.match(pattern)

View File

@ -224,7 +224,9 @@ require(['./browser'], function(browser){
// when the hash is actually changed...
for(var lnk of this.dom.querySelectorAll(`a[href="${location.hash}"]`)){
lnk.addEventListener('click', function(evt){
that.refresh() }) } })
startSpinner()
setTimeout(function(){
that.refresh() }, 0) }) } })
// wait for stuff to finish...
browser.setup.then(function(){

View File

@ -1,6 +1,8 @@
/**********************************************************************
*
*
* XXX changing the URL does not start the spinner...
* XXX HIDE revise .hide_paths...
* XXX Q: can we access fs from a pwa???
* XXX start writing docs in pwiki
* - WYSIWYG markdown editor/viewer (ASAP)
@ -20,6 +22,17 @@
* ...likely no...
* ...would depend on where we iterate pages and on whether
* we can/should reach that spot from within the parser...
* XXX page access mothods (.get(..) / .__get__(..) via path + args)
* - path -- DONE
* - tags --
* - search --
* Syntax:
* /path/to/*:tags=a,b,c:search=some text
* +--------+ . . . . . . . . . . . . . . . . path
* +--------+ . . . . . . . . . . . tags
* +--------------+ . . search
* order is not relevant here...
* each of the methods narrows down the previous' results
* XXX FEATURE tags and accompanying API...
* - add tags to page -- macro/filter
* - <page>.text -> <page>.tags (cached on .update(..))