mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 18:40:08 +00:00
experimenting with actions + fixed actions return value errors (mtime/ctime/..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
136cd294f4
commit
b638f85732
@ -1167,6 +1167,8 @@ object.Constructor('Page', BasePage, {
|
|||||||
// handle lists in pages (actions, ... etc.)...
|
// handle lists in pages (actions, ... etc.)...
|
||||||
if(!page.isPattern){
|
if(!page.isPattern){
|
||||||
var raw = await page.raw
|
var raw = await page.raw
|
||||||
|
if(raw == null){
|
||||||
|
return }
|
||||||
yield* raw instanceof Array ?
|
yield* raw instanceof Array ?
|
||||||
raw
|
raw
|
||||||
.map(function(p){
|
.map(function(p){
|
||||||
@ -1425,6 +1427,7 @@ module.System = {
|
|||||||
<macro src="../*">
|
<macro src="../*">
|
||||||
<div>
|
<div>
|
||||||
<a href="#@source(./path)">@source(./name)</a>
|
<a href="#@source(./path)">@source(./name)</a>
|
||||||
|
<macro src="./isAction">*</macro>
|
||||||
<a href="#@source(./path)/delete">×</a>
|
<a href="#@source(./path)/delete">×</a>
|
||||||
<div style="padding-left: 30px">
|
<div style="padding-left: 30px">
|
||||||
@source(./tree)
|
@source(./tree)
|
||||||
@ -1494,10 +1497,21 @@ module.System = {
|
|||||||
var p = this.get('..')
|
var p = this.get('..')
|
||||||
return p.title
|
return p.title
|
||||||
?? p.name },
|
?? p.name },
|
||||||
ctime: function(){
|
ctime: async function(){
|
||||||
return this.get('..').data.ctime ?? '' },
|
return (await this.get('..').data).ctime ?? '' },
|
||||||
mtime: function(){
|
mtime: async function(){
|
||||||
return this.get('..').data.mtime ?? '' },
|
return (await this.get('..').data).mtime ?? '' },
|
||||||
|
|
||||||
|
// XXX EXPERIMENTAL...
|
||||||
|
type: async function(){
|
||||||
|
// XXX also check if a page is a store...
|
||||||
|
return typeof(await this.get('..').data) == 'function' ?
|
||||||
|
'action'
|
||||||
|
: 'page' },
|
||||||
|
isAction: async function(){
|
||||||
|
return typeof(await this.get('..').data) == 'function' ?
|
||||||
|
['action']
|
||||||
|
: undefined },
|
||||||
|
|
||||||
|
|
||||||
// utils...
|
// utils...
|
||||||
|
|||||||
@ -221,6 +221,9 @@ module.BaseParser = {
|
|||||||
// NOTE: this internally uses page.macros' keys to generate the
|
// NOTE: this internally uses page.macros' keys to generate the
|
||||||
// lexing pattern.
|
// lexing pattern.
|
||||||
lex: function*(page, str){
|
lex: function*(page, str){
|
||||||
|
str = typeof(str) != 'string' ?
|
||||||
|
str+''
|
||||||
|
: str
|
||||||
// XXX we can't get .raw from the page without going async...
|
// XXX we can't get .raw from the page without going async...
|
||||||
//str = str
|
//str = str
|
||||||
// ?? page.raw
|
// ?? page.raw
|
||||||
@ -325,7 +328,7 @@ module.BaseParser = {
|
|||||||
// XXX we can't get .raw from the page without going async...
|
// XXX we can't get .raw from the page without going async...
|
||||||
//lex = lex
|
//lex = lex
|
||||||
// ?? this.lex(page)
|
// ?? this.lex(page)
|
||||||
lex = typeof(lex) == 'string' ?
|
lex = typeof(lex) != 'object' ?
|
||||||
this.lex(page, lex)
|
this.lex(page, lex)
|
||||||
: lex
|
: lex
|
||||||
|
|
||||||
@ -403,7 +406,7 @@ module.BaseParser = {
|
|||||||
ast = ast == null ?
|
ast = ast == null ?
|
||||||
//this.group(page)
|
//this.group(page)
|
||||||
this.group(page, await page.raw ?? '')
|
this.group(page, await page.raw ?? '')
|
||||||
: typeof(ast) == 'string' ?
|
: typeof(ast) != 'object' ?
|
||||||
this.group(page, ast)
|
this.group(page, ast)
|
||||||
: ast instanceof types.Generator ?
|
: ast instanceof types.Generator ?
|
||||||
ast
|
ast
|
||||||
@ -448,7 +451,7 @@ module.BaseParser = {
|
|||||||
resolve: async function*(page, ast, state={}){
|
resolve: async function*(page, ast, state={}){
|
||||||
ast = ast
|
ast = ast
|
||||||
?? this.expand(page, null, state)
|
?? this.expand(page, null, state)
|
||||||
ast = typeof(ast) == 'string' ?
|
ast = typeof(ast) != 'object' ?
|
||||||
this.expand(page, ast, state)
|
this.expand(page, ast, state)
|
||||||
: ast
|
: ast
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user