mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-03 04:20:08 +00:00
stalled due to a bug in Chrome...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
c63cf9faba
commit
4929905460
@ -845,8 +845,8 @@ object.Constructor('Page', BasePage, {
|
|||||||
key = key ?? 'included' }
|
key = key ?? 'included' }
|
||||||
var base = this.get(this.path.split(/\*/).shift())
|
var base = this.get(this.path.split(/\*/).shift())
|
||||||
var src = args.src
|
var src = args.src
|
||||||
//&& await base.parse(args.src, state)
|
&& this.resolvePathVars(
|
||||||
&& this.resolvePathVars(await base.parse(args.src, state))
|
await base.parse(args.src, state))
|
||||||
if(!src){
|
if(!src){
|
||||||
return }
|
return }
|
||||||
var recursive = args.recursive ?? body
|
var recursive = args.recursive ?? body
|
||||||
@ -884,7 +884,6 @@ object.Constructor('Page', BasePage, {
|
|||||||
var parent_seen = 'seen' in state
|
var parent_seen = 'seen' in state
|
||||||
var seen = state.seen =
|
var seen = state.seen =
|
||||||
new Set(state.seen ?? [])
|
new Set(state.seen ?? [])
|
||||||
// recursion detected...
|
|
||||||
if(seen.has(full)
|
if(seen.has(full)
|
||||||
// nesting path recursion...
|
// nesting path recursion...
|
||||||
|| (full.length % (this.NESTING_RECURSION_TEST_THRESHOLD || 50) == 0
|
|| (full.length % (this.NESTING_RECURSION_TEST_THRESHOLD || 50) == 0
|
||||||
@ -1384,13 +1383,21 @@ object.Constructor('Page', BasePage, {
|
|||||||
// actions...
|
// actions...
|
||||||
//
|
//
|
||||||
// XXX revise name...
|
// XXX revise name...
|
||||||
|
// XXX NOEXPANDACTION
|
||||||
|
asPages: async function*(path='.:$ARGS', strict=false){
|
||||||
|
/*/
|
||||||
asPages: async function*(path='.:$ARGS', strict=false, noexpandactions=false){
|
asPages: async function*(path='.:$ARGS', strict=false, noexpandactions=false){
|
||||||
|
//*/
|
||||||
// options...
|
// options...
|
||||||
var args = [...arguments]
|
var args = [...arguments]
|
||||||
var opts = typeof(args.at(-1)) == 'object' ?
|
var opts = typeof(args.at(-1)) == 'object' ?
|
||||||
args.pop()
|
args.pop()
|
||||||
: {}
|
: {}
|
||||||
|
// XXX NOEXPANDACTION
|
||||||
|
var {path, strict} = {
|
||||||
|
/*/
|
||||||
var {path, strict, noexpandactions} = {
|
var {path, strict, noexpandactions} = {
|
||||||
|
//*/
|
||||||
...opts,
|
...opts,
|
||||||
path: typeof(args[0]) == 'string' ?
|
path: typeof(args[0]) == 'string' ?
|
||||||
args.shift()
|
args.shift()
|
||||||
@ -1400,8 +1407,27 @@ object.Constructor('Page', BasePage, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var page = this.get(path, strict)
|
var page = this.get(path, strict)
|
||||||
|
// each...
|
||||||
|
if(page.isPattern){
|
||||||
|
yield* page
|
||||||
// handle lists in pages (actions, ... etc.)...
|
// handle lists in pages (actions, ... etc.)...
|
||||||
if(!page.isPattern){
|
} else {
|
||||||
|
// XXX NOEXPANDACTION
|
||||||
|
var data = await page.data
|
||||||
|
data = typeof(data) == 'function' ?
|
||||||
|
data
|
||||||
|
: 'text' in data ?
|
||||||
|
data.text
|
||||||
|
: null
|
||||||
|
if(data instanceof Array
|
||||||
|
|| data instanceof types.Generator){
|
||||||
|
yield* data
|
||||||
|
.map(function(p){
|
||||||
|
return page.virtual({text: p}) })
|
||||||
|
return }
|
||||||
|
|
||||||
|
yield page } },
|
||||||
|
/*/
|
||||||
if(noexpandactions
|
if(noexpandactions
|
||||||
&& await page.type == 'action'){
|
&& await page.type == 'action'){
|
||||||
//yield this.get(this.QUOTE_ACTION_PAGE)
|
//yield this.get(this.QUOTE_ACTION_PAGE)
|
||||||
@ -1414,10 +1440,8 @@ object.Constructor('Page', BasePage, {
|
|||||||
raw
|
raw
|
||||||
.map(function(p){
|
.map(function(p){
|
||||||
return page.virtual({text: p}) })
|
return page.virtual({text: p}) })
|
||||||
: [page]
|
: [page] } },
|
||||||
// each...
|
//*/
|
||||||
} else {
|
|
||||||
yield* page } },
|
|
||||||
|
|
||||||
// expanded page text...
|
// expanded page text...
|
||||||
//
|
//
|
||||||
@ -2002,9 +2026,14 @@ module.System = {
|
|||||||
|
|
||||||
var Test =
|
var Test =
|
||||||
module.Test = {
|
module.Test = {
|
||||||
'list/action': function(){
|
// XXX do we support this???
|
||||||
return [...'abcdef'] },
|
//'list/action': function(){
|
||||||
'list/statuc': {
|
// return [...'abcdef'] },
|
||||||
|
// XXX BUG CHROME: this hangs under chrome...
|
||||||
|
// (see: pwiki2.js)
|
||||||
|
'list/generator': function*(){
|
||||||
|
yield* [...'abcdef'] },
|
||||||
|
'list/static': {
|
||||||
text: [...'abcdef'] },
|
text: [...'abcdef'] },
|
||||||
|
|
||||||
slots: {
|
slots: {
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX BUG?: the action is called twice here:
|
* XXX add support for generator actions...
|
||||||
* await pwiki.get('/path/testDirect:x:y:z').parse('@include(.:$ARGS)')
|
* XXX BUG CHROME: can't .get(..) a generator...
|
||||||
* and:
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=1361981
|
||||||
* await pwiki.get('/path/testDirect:x:y:z').text
|
|
||||||
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
||||||
* XXX FEATURE tags and accompanying API...
|
* XXX FEATURE tags and accompanying API...
|
||||||
* - add tags to page -- macro/filter
|
* - add tags to page -- macro/filter
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user