mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-24 00:06:43 +00:00
refactoring: naming: parser -> macros...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
811b0a433d
commit
64c7a63930
@ -21,7 +21,12 @@ var pwpath = require('./path')
|
|||||||
// Parser/Runner...
|
// Parser/Runner...
|
||||||
|
|
||||||
// XXX TODO:
|
// XXX TODO:
|
||||||
// callbacks on elements resolving...
|
// - callbacks on elements resolving...
|
||||||
|
// - option/way to wrap macro output -- callback??
|
||||||
|
// - naming:
|
||||||
|
// parser -> macro
|
||||||
|
//
|
||||||
|
//
|
||||||
// XXX ASAP move the macros here...
|
// XXX ASAP move the macros here...
|
||||||
// XXX BUG?: <macro src=/moo/> is not parsed correctly...
|
// XXX BUG?: <macro src=/moo/> is not parsed correctly...
|
||||||
// XXX need to correctly handle nested and escaped quotes...
|
// XXX need to correctly handle nested and escaped quotes...
|
||||||
@ -30,8 +35,8 @@ var pwpath = require('./path')
|
|||||||
|
|
||||||
// XXX RENAME...
|
// XXX RENAME...
|
||||||
// ...this handles the syntax and execution...
|
// ...this handles the syntax and execution...
|
||||||
var BaseParser =
|
var BaseMacros =
|
||||||
module.BaseParser = {
|
module.BaseMacros = {
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// Passive parsing...
|
// Passive parsing...
|
||||||
@ -966,9 +971,9 @@ function(macro){
|
|||||||
// XXX RENAME...
|
// XXX RENAME...
|
||||||
// ...this is more of an expander/executer...
|
// ...this is more of an expander/executer...
|
||||||
// ...might be a good idea to also do a check without executing...
|
// ...might be a good idea to also do a check without executing...
|
||||||
var parser =
|
var macros =
|
||||||
module.parser = {
|
module.macros = {
|
||||||
__proto__: BaseParser,
|
__proto__: BaseMacros,
|
||||||
|
|
||||||
// String to be substetuted for a recursive include...
|
// String to be substetuted for a recursive include...
|
||||||
//
|
//
|
||||||
@ -6,12 +6,12 @@ var path = require('path')
|
|||||||
var test = require('ig-test')
|
var test = require('ig-test')
|
||||||
var serialize = require('ig-serialize')
|
var serialize = require('ig-serialize')
|
||||||
|
|
||||||
var parser = require('../parser').parser
|
var macros = require('../macros').macros
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
;(parser.filters ??= {}).upper =
|
;(macros.filters ??= {}).upper =
|
||||||
function(str){
|
function(str){
|
||||||
return str.toUpperCase() }
|
return str.toUpperCase() }
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ module.exports.PAGES = {
|
|||||||
var P =
|
var P =
|
||||||
module.exports.P = {
|
module.exports.P = {
|
||||||
__pages__: PAGES,
|
__pages__: PAGES,
|
||||||
__parser__: parser,
|
__parser__: macros,
|
||||||
|
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ test.Tests({
|
|||||||
var p = serialize.partialDeepCopy(page)
|
var p = serialize.partialDeepCopy(page)
|
||||||
var s = serialize.partialDeepCopy(st)
|
var s = serialize.partialDeepCopy(st)
|
||||||
assert(
|
assert(
|
||||||
(res = await parser.exec(
|
(res = await macros.exec(
|
||||||
p,
|
p,
|
||||||
input,
|
input,
|
||||||
s))
|
s))
|
||||||
Loading…
x
Reference in New Issue
Block a user