mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-03 04:20:08 +00:00
tweaking and notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0c1f48ee22
commit
996efe6d95
21
pwiki2.js
21
pwiki2.js
@ -492,18 +492,25 @@ object.Constructor('BasePage', {
|
|||||||
// XXX BUG? '<slot name=x text="moo <now/> foo">' is parsed semi-wrong...
|
// XXX BUG? '<slot name=x text="moo <now/> foo">' is parsed semi-wrong...
|
||||||
var parser =
|
var parser =
|
||||||
module.parser = {
|
module.parser = {
|
||||||
|
// XXX the pattern dance is getting a bit cumbersome, might be a
|
||||||
|
// good idea to move the thing out of the parser into the module
|
||||||
|
// root combine it there and reference the result from the parser
|
||||||
|
// letting the user to override it if necessary without
|
||||||
|
// overcomplicating things...
|
||||||
// XXX update a-la MACRO_ARGS...
|
// XXX update a-la MACRO_ARGS...
|
||||||
MACRO_INLINE_ARGS: '[^)]*',
|
MACRO_INLINE_ARGS: '[^)]*',
|
||||||
// XXX need to update the arg pattern below too...
|
// XXX need to update the arg pattern below too...
|
||||||
MACRO_ARGS: ['(',
|
MACRO_ARGS: ['(',
|
||||||
// "arg" | 'arg'
|
// "arg" | 'arg'
|
||||||
// XXX add quote escaping??
|
// XXX quote escaping???
|
||||||
|
// XXX CHROME/NODE BUG: this does not work yet...
|
||||||
|
//'\\s+(?<quote>[\'"])[^\\k<quote>]*\\k<quote>',
|
||||||
'\\s+"[^"]*"',
|
'\\s+"[^"]*"',
|
||||||
"|\\s+'[^']*'",
|
"|\\s+'[^']*'",
|
||||||
// arg
|
// arg
|
||||||
'|\\s+[^\\s\\/>\'"]+',
|
'|\\s+[^\\s\\/>\'"]+',
|
||||||
// arg='val' | arg="val" | arg=val
|
// arg='val' | arg="val" | arg=val
|
||||||
'|\\s+[a-z]+=(\'[^\']*\'|"[^"]*"|[^\\s"\']*)',
|
'|\\s+[a-z]+\\s*=\\s*(\'[^\']*\'|"[^"]*"|[^\\s"\']*)',
|
||||||
')*'].join(''),
|
')*'].join(''),
|
||||||
// patterns...
|
// patterns...
|
||||||
//
|
//
|
||||||
@ -518,7 +525,7 @@ module.parser = {
|
|||||||
// <macro ..> | <macro ../>
|
// <macro ..> | <macro ../>
|
||||||
// XXX need to ignore ">" in quotes and "/" not before >...
|
// XXX need to ignore ">" in quotes and "/" not before >...
|
||||||
//'<\\s*(?<nameOpen>MACROS)(?<argsOpen>\\s+([^>/])*)?/?>',
|
//'<\\s*(?<nameOpen>MACROS)(?<argsOpen>\\s+([^>/])*)?/?>',
|
||||||
'<\\s*(?<nameOpen>MACROS)(?<argsOpen>MACRO_ARGS)?/?>',
|
'<\\s*(?<nameOpen>MACROS)(?<argsOpen>MACRO_ARGS)?\\s*/?>',
|
||||||
// </macro>
|
// </macro>
|
||||||
'</\\s*(?<nameClose>MACROS)\\s*>',
|
'</\\s*(?<nameClose>MACROS)\\s*>',
|
||||||
].join('|'), 'smig'],
|
].join('|'), 'smig'],
|
||||||
@ -533,14 +540,18 @@ module.parser = {
|
|||||||
.replace(/MACRO_INLINE_ARGS/g, this.MACRO_INLINE_ARGS)
|
.replace(/MACRO_INLINE_ARGS/g, this.MACRO_INLINE_ARGS)
|
||||||
})`)).length-2) },
|
})`)).length-2) },
|
||||||
// XXX update using MACRO_ARGS...
|
// XXX update using MACRO_ARGS...
|
||||||
|
MACRO_ARGS_PATTERN: RegExp('('+[
|
||||||
|
].join('|') +')', 'smig'),
|
||||||
|
/*/
|
||||||
MACRO_ARGS_PATTERN: RegExp('('+[
|
MACRO_ARGS_PATTERN: RegExp('('+[
|
||||||
// named args...
|
// named args...
|
||||||
'(?<nameQuoted>[a-zA-Z-_]+)\\s*=([\'"])(?<valueQuoted>([^\\3]|\\\\3)*)\\3\\s*',
|
'(?<nameQuoted>[a-zA-Z-_]+)\\s*=\\s*([\'"])(?<valueQuoted>([^\\3]|\\\\3)*)\\3\\s*',
|
||||||
'(?<nameUnquoted>[a-zA-Z-_]+)\\s*=(?<valueUnquoted>[^\\s]*)',
|
'(?<nameUnquoted>[a-zA-Z-_]+)\\s*=\\s*(?<valueUnquoted>[^\\s]*)',
|
||||||
// positional args...
|
// positional args...
|
||||||
'([\'"])(?<argQuoted>([^\\8]|\\\\8)*)\\8',
|
'([\'"])(?<argQuoted>([^\\8]|\\\\8)*)\\8',
|
||||||
'(?<arg>[^\\s]+)',
|
'(?<arg>[^\\s]+)',
|
||||||
].join('|') +')', 'smig'),
|
].join('|') +')', 'smig'),
|
||||||
|
//*/
|
||||||
// XXX do we need basic inline and block commets a-la lisp???
|
// XXX do we need basic inline and block commets a-la lisp???
|
||||||
COMMENT_PATTERN: RegExp('('+[
|
COMMENT_PATTERN: RegExp('('+[
|
||||||
// <!--[pwiki[ .. ]]-->
|
// <!--[pwiki[ .. ]]-->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user