mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +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.)...
|
||||
if(!page.isPattern){
|
||||
var raw = await page.raw
|
||||
if(raw == null){
|
||||
return }
|
||||
yield* raw instanceof Array ?
|
||||
raw
|
||||
.map(function(p){
|
||||
@ -1425,6 +1427,7 @@ module.System = {
|
||||
<macro src="../*">
|
||||
<div>
|
||||
<a href="#@source(./path)">@source(./name)</a>
|
||||
<macro src="./isAction">*</macro>
|
||||
<a href="#@source(./path)/delete">×</a>
|
||||
<div style="padding-left: 30px">
|
||||
@source(./tree)
|
||||
@ -1494,10 +1497,21 @@ module.System = {
|
||||
var p = this.get('..')
|
||||
return p.title
|
||||
?? p.name },
|
||||
ctime: function(){
|
||||
return this.get('..').data.ctime ?? '' },
|
||||
mtime: function(){
|
||||
return this.get('..').data.mtime ?? '' },
|
||||
ctime: async function(){
|
||||
return (await this.get('..').data).ctime ?? '' },
|
||||
mtime: async function(){
|
||||
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...
|
||||
|
||||
@ -221,6 +221,9 @@ module.BaseParser = {
|
||||
// NOTE: this internally uses page.macros' keys to generate the
|
||||
// lexing pattern.
|
||||
lex: function*(page, str){
|
||||
str = typeof(str) != 'string' ?
|
||||
str+''
|
||||
: str
|
||||
// XXX we can't get .raw from the page without going async...
|
||||
//str = str
|
||||
// ?? page.raw
|
||||
@ -325,7 +328,7 @@ module.BaseParser = {
|
||||
// XXX we can't get .raw from the page without going async...
|
||||
//lex = lex
|
||||
// ?? this.lex(page)
|
||||
lex = typeof(lex) == 'string' ?
|
||||
lex = typeof(lex) != 'object' ?
|
||||
this.lex(page, lex)
|
||||
: lex
|
||||
|
||||
@ -403,7 +406,7 @@ module.BaseParser = {
|
||||
ast = ast == null ?
|
||||
//this.group(page)
|
||||
this.group(page, await page.raw ?? '')
|
||||
: typeof(ast) == 'string' ?
|
||||
: typeof(ast) != 'object' ?
|
||||
this.group(page, ast)
|
||||
: ast instanceof types.Generator ?
|
||||
ast
|
||||
@ -448,7 +451,7 @@ module.BaseParser = {
|
||||
resolve: async function*(page, ast, state={}){
|
||||
ast = ast
|
||||
?? this.expand(page, null, state)
|
||||
ast = typeof(ast) == 'string' ?
|
||||
ast = typeof(ast) != 'object' ?
|
||||
this.expand(page, ast, state)
|
||||
: ast
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user