Merge branch 'master' of github.com:flynx/pWiki

This commit is contained in:
Alex A. Naanou 2022-09-14 12:59:53 +03:00
commit 869cb08cba
4 changed files with 41 additions and 59 deletions

View File

@ -1911,20 +1911,19 @@ module.System = {
// page actions...
//
/* XXX broken...
// XXX broken...
// XXX this does not work as energetic...
// XXX for some reason this is called twice...
time: async function(){
var t = Date.now()
var text = await this.get('../_text').text
var time = Date.now() - t
var t = Date.now()
var text = await this.get('../_text').text
var time = Date.now() - t
console.log('RENDER TIME:', time)
console.log('RENDER TIME:', time)
return object.doc`
Time to render: ${time}ms <br>
<ht>
${text}`},
return object.doc`
Time to render: ${time}ms <br>
<ht>
${text}`},
//*/
// XXX EXPERIMENTAL -- page types...
@ -2011,8 +2010,6 @@ module.Test = {
// XXX do we support this???
//'list/action': function(){
// return [...'abcdef'] },
// XXX BUG CHROME: this hangs under chrome...
// (see: pwiki2.js)
'list/generator': function*(){
yield* [...'abcdef'] },
'list/static': {

View File

@ -334,16 +334,17 @@ module.BaseStore = {
args = pwpath.joinArgs('', args)
// NOTE: we are matching full paths only here so leading and
// trainling '/' are optional...
// NOTE: we ensure that we match full names and always split
// at '/' only...
var pattern = new RegExp(`^\\/?${
path
.replace(/^\/|\/$/g, '')
.replace(/\//g, '\\/')
//.replace(/\*\*/g, '.*')
.replace(/([\\\/]?)\*\*/g, '($1.*)')
.replace(/(?<=^|[\\\/]+|[^.])\*/g, '[^\\/]*')
}(?=[\\\\\/]|$)`)
var pattern = new RegExp(`^\\/?`
+RegExp.quoteRegExp(
// remove leading/trailing '/'
path.replace(/^\/|\/$/g, ''))
// pattern: **
.replace(/\\\*\\\*/g, '(.*)')
// pattern: *
// NOTE: we are prepping the leading '.' of a pattern
// dir for hidden tests...
.replace(/(^|\\\/+)(\\\.|)([^\/]*)\\\*/g, '$1$2($3[^\\/]*)')
+'(?=[\\/]|$)', 'g')
/*/ XXX CACHED....
var name = pwpath.basename(path)
return [...(name.includes('*') ?
@ -359,14 +360,17 @@ module.BaseStore = {
// skip metadata paths...
if(p.includes('*')){
return res }
/*/ XXX HIDE this is wrong -- need to check for
// hidden paths within the match...
if(pwpath.basename(p)[0] == '.'
&& !all){
return res }
//*/
var m = p.match(pattern)
m
var m = [...p.matchAll(pattern)]
m.length > 0
&& (!all ?
// test if we need to hide things....
m.reduce(function(res, m){
return res === false ?
res
: !/(^\.|[\\\/]\.)/.test(m[1])
}, true)
: true)
&& (m = m[0])
&& (!strict
|| m[0] == p)
&& res.add(
@ -464,9 +468,6 @@ module.BaseStore = {
// this can be the result of matching a/* in a a/b/c
// and returning a a/b which can be undefined...
return that.get(p, strict) })
// XXX BUG CHROME: this hangs on Chrome when getting a
// generator function...
// ...should not require any editing when bug fixed.
: (await this.__get__(path)
?? ((this.next || {}).__get__
&& this.next.get(path, strict))) },

View File

@ -166,6 +166,7 @@ require.config({
document.pwikiloaded = new Event('pwikiloaded')
REFRESH_DELAY = 20
// start loading pWiki...
require(['./browser'], function(browser){
@ -186,8 +187,9 @@ require(['./browser'], function(browser){
: '/'+path
startSpinner()
// NOTE: setTimeout(..) to allow the spinner to start...
// NOTE: this seems not to work if the REFRESH_DELAY is too small...
setTimeout(function(){
pwiki.location = [path, hash] }, 0) })
pwiki.location = [path, hash] }, REFRESH_DELAY) })
pwiki
.onBeforeNavigate(function(){
saveNow() })
@ -226,7 +228,7 @@ require(['./browser'], function(browser){
lnk.addEventListener('click', function(evt){
startSpinner()
setTimeout(function(){
that.refresh() }, 0) }) } })
that.refresh() }, REFRESH_DELAY) }) } })
// wait for stuff to finish...
browser.setup.then(function(){

View File

@ -1,18 +1,14 @@
/**********************************************************************
*
*
* XXX BUG: .hide_paths:
* - hidden dir should hide all the children -- BROKEN
* (see /.hidden/suppage)
* - listing a hidden subtree should work regardless of :all -- BROKEN
* (see: /.hidden/tree)
* XXX BUG:
* /System/info
* and:
* /System/info/_view
* are not the same...
* ...bug likely in .text
* XXX might also be a good idea to investigate a .tree directory index
* as a supplement to .paths()
* XXX BUG: changing the URL does not start the spinner...
* chech:
* - url (hashchange)
* - click link
* - history back/foreward
* XXX Q: can we access fs from a pwa???
* XXX start writing docs in pwiki
* - WYSIWYG markdown editor/viewer (ASAP)
@ -62,20 +58,6 @@
* i.e. a way to pass tags through path...
* /some/path:tags=a,b,c
* XXX FEATURE images...
* XXX BUG CHROME: can't .get(..) a generator...
* affected code:
* BaseStore's .get(..)
* bug report:
* https://bugs.chromium.org/p/chromium/issues/detail?id=1361981
* when done test:
* .get('/test/list/generator').asPages()
* .get('/test/list/generator').raw
* .get('/test/list/generator').data
* .get('/test/list/generator').text
* potential temporaty fix:
* wrap all .__get__(..) call in an async function testing if
* it's return value is a generator function (return) or anything
* else (await)...
* XXX rename??
* System -> .system
* Config -> .pwiki