mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
notes, tweaking and experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d21565ab64
commit
652ccfae88
@ -838,8 +838,9 @@ object.Constructor('Page', BasePage, {
|
|||||||
// -> <func>(<state>)
|
// -> <func>(<state>)
|
||||||
// -> ...
|
// -> ...
|
||||||
//
|
//
|
||||||
|
// XXX do we need to make .macro.__proto__ module level object???
|
||||||
// XXX ASYNC make these support async page getters...
|
// XXX ASYNC make these support async page getters...
|
||||||
macros: {
|
macros: { __proto__: {
|
||||||
//
|
//
|
||||||
// @(<name>[ <default>][ local])
|
// @(<name>[ <default>][ local])
|
||||||
// @(name=<name>[ default=<default>][ local])
|
// @(name=<name>[ default=<default>][ local])
|
||||||
@ -855,6 +856,7 @@ object.Constructor('Page', BasePage, {
|
|||||||
// - .renderer
|
// - .renderer
|
||||||
// - .root
|
// - .root
|
||||||
//
|
//
|
||||||
|
// NOTE: default value is parsed when accessed...
|
||||||
arg: Macro(
|
arg: Macro(
|
||||||
['name', 'default', ['local']],
|
['name', 'default', ['local']],
|
||||||
function(args){
|
function(args){
|
||||||
@ -868,7 +870,8 @@ object.Constructor('Page', BasePage, {
|
|||||||
args.name
|
args.name
|
||||||
: v
|
: v
|
||||||
return v
|
return v
|
||||||
|| args.default }),
|
|| (args.default
|
||||||
|
&& this.parse(args.default)) }),
|
||||||
'': Macro(
|
'': Macro(
|
||||||
['name', 'default', ['local']],
|
['name', 'default', ['local']],
|
||||||
function(args){
|
function(args){
|
||||||
@ -887,6 +890,7 @@ object.Constructor('Page', BasePage, {
|
|||||||
// <filter> <filter-spec>
|
// <filter> <filter-spec>
|
||||||
// | -<filter> <filter-spec>
|
// | -<filter> <filter-spec>
|
||||||
//
|
//
|
||||||
|
// XXX REVISE...
|
||||||
filter: function(args, body, state, expand=true){
|
filter: function(args, body, state, expand=true){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
@ -1299,6 +1303,9 @@ object.Constructor('Page', BasePage, {
|
|||||||
'content': ['slot'],
|
'content': ['slot'],
|
||||||
|
|
||||||
// XXX EXPERIMENTAL...
|
// XXX EXPERIMENTAL...
|
||||||
|
//
|
||||||
|
// NOTE: var value is parsed only on assignment and not on dereferencing...
|
||||||
|
//
|
||||||
// XXX INC_DEC do we need inc/dec and parent???
|
// XXX INC_DEC do we need inc/dec and parent???
|
||||||
'var': Macro(
|
'var': Macro(
|
||||||
['name', 'text',
|
['name', 'text',
|
||||||
@ -1616,7 +1623,23 @@ object.Constructor('Page', BasePage, {
|
|||||||
// nesting rules...
|
// nesting rules...
|
||||||
'else': ['macro'],
|
'else': ['macro'],
|
||||||
'join': ['macro'],
|
'join': ['macro'],
|
||||||
},
|
} },
|
||||||
|
|
||||||
|
// XXX EXPERIMENTAL...
|
||||||
|
//
|
||||||
|
// Define a global macro...
|
||||||
|
// .defmacro(<name>, <func>)
|
||||||
|
// .defmacro(<name>, <args>, <func>)
|
||||||
|
// -> this
|
||||||
|
//
|
||||||
|
// XXX do we need this???
|
||||||
|
defmacro: function(name, args, func){
|
||||||
|
this.macros[name] =
|
||||||
|
arguments.length == 2 ?
|
||||||
|
arguments[1]
|
||||||
|
: Macro(args, func)
|
||||||
|
return this },
|
||||||
|
|
||||||
|
|
||||||
// direct actions...
|
// direct actions...
|
||||||
//
|
//
|
||||||
@ -2413,8 +2436,8 @@ module.System = {
|
|||||||
text: object.doc`
|
text: object.doc`
|
||||||
<slot title/>
|
<slot title/>
|
||||||
<div class="error">
|
<div class="error">
|
||||||
<div class="msg" wikiwords="no">ParseError: @(msg)</div>
|
<div class="msg" wikiwords="no">ParseError: @(msg "no message")</div>
|
||||||
Page: [@(path)]
|
Page: [@(path "@source(./path)")]
|
||||||
</div> `,},
|
</div> `,},
|
||||||
RecursionError: {
|
RecursionError: {
|
||||||
text: 'RECURSION ERROR: @source(../path)' },
|
text: 'RECURSION ERROR: @source(../path)' },
|
||||||
|
|||||||
@ -256,7 +256,7 @@ module.BaseParser = {
|
|||||||
|
|
||||||
// XXX should this be cached???
|
// XXX should this be cached???
|
||||||
var macro_pattern = this.MACRO_PATTERN
|
var macro_pattern = this.MACRO_PATTERN
|
||||||
?? this.buildMacroPattern(Object.keys(page.macros))
|
?? this.buildMacroPattern(Object.deepKeys(page.macros))
|
||||||
var macro_pattern_groups = this.MACRO_PATTERN_GROUPS
|
var macro_pattern_groups = this.MACRO_PATTERN_GROUPS
|
||||||
?? this.countMacroPatternGroups()
|
?? this.countMacroPatternGroups()
|
||||||
var macro_args_pattern = this.MACRO_ARGS_PATTERN
|
var macro_args_pattern = this.MACRO_ARGS_PATTERN
|
||||||
@ -482,7 +482,7 @@ module.BaseParser = {
|
|||||||
// XXX add line number and page path...
|
// XXX add line number and page path...
|
||||||
'@include("./ParseError'
|
'@include("./ParseError'
|
||||||
+':path='
|
+':path='
|
||||||
// XXX use pwiki.encodeElem(..) ???
|
// XXX use pwpath.encodeElem(..) ???
|
||||||
+ page.path
|
+ page.path
|
||||||
+':msg='
|
+':msg='
|
||||||
+ err.message
|
+ err.message
|
||||||
|
|||||||
@ -158,7 +158,7 @@ body.loading .page.spinner span {
|
|||||||
.error {
|
.error {
|
||||||
background: lightyellow;
|
background: lightyellow;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
box-shadow: inset 3px 5px 15px 5px rgba(0,0,0,0.05);
|
box-shadow: inset 3px 5px 15px 5px rgba(0,0,0,0.03);
|
||||||
border: dashed red 1px;
|
border: dashed red 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,9 @@
|
|||||||
* -
|
* -
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX BUG? can't use < and > (both?) in page title...
|
|
||||||
* XXX parser: error handling: revise page quoting...
|
* XXX parser: error handling: revise page quoting...
|
||||||
|
* ...need a standard mechanism to quote urls, url-args and paths...
|
||||||
|
* XXX BUG? can't use < and > (both?) in page title...
|
||||||
* XXX parser: error handling: add line number + context... (???)
|
* XXX parser: error handling: add line number + context... (???)
|
||||||
* XXX BUG: parser:
|
* XXX BUG: parser:
|
||||||
* This will break:
|
* This will break:
|
||||||
@ -45,6 +46,9 @@
|
|||||||
* This will not:
|
* This will not:
|
||||||
* await pwiki.parse('<macro src="../tags" join=", ">@source(.)</macro>')
|
* await pwiki.parse('<macro src="../tags" join=", ">@source(.)</macro>')
|
||||||
* XXX ASAP test: can we store the file handler with permissions in a ServiceWorker??
|
* XXX ASAP test: can we store the file handler with permissions in a ServiceWorker??
|
||||||
|
* XXX Q: do we need macros for printing errors and the like???
|
||||||
|
* XXX Q: do we need a macro to define user macros???
|
||||||
|
* ...see: <page>.defmacro(..)
|
||||||
* XXX the parser should handle all action return values, including:
|
* XXX the parser should handle all action return values, including:
|
||||||
* - lists -- XXX
|
* - lists -- XXX
|
||||||
* - strings -- DONE
|
* - strings -- DONE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user