refactoring: naming: parser -> macros...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2026-08-05 00:27:43 +03:00
parent 811b0a433d
commit 64c7a63930
2 changed files with 15 additions and 10 deletions

View File

@ -21,7 +21,12 @@ var pwpath = require('./path')
// Parser/Runner...
// 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 BUG?: <macro src=/moo/> is not parsed correctly...
// XXX need to correctly handle nested and escaped quotes...
@ -30,8 +35,8 @@ var pwpath = require('./path')
// XXX RENAME...
// ...this handles the syntax and execution...
var BaseParser =
module.BaseParser = {
var BaseMacros =
module.BaseMacros = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Passive parsing...
@ -966,9 +971,9 @@ function(macro){
// XXX RENAME...
// ...this is more of an expander/executer...
// ...might be a good idea to also do a check without executing...
var parser =
module.parser = {
__proto__: BaseParser,
var macros =
module.macros = {
__proto__: BaseMacros,
// String to be substetuted for a recursive include...
//

View File

@ -6,12 +6,12 @@ var path = require('path')
var test = require('ig-test')
var serialize = require('ig-serialize')
var parser = require('../parser').parser
var macros = require('../macros').macros
//---------------------------------------------------------------------
;(parser.filters ??= {}).upper =
;(macros.filters ??= {}).upper =
function(str){
return str.toUpperCase() }
@ -56,7 +56,7 @@ module.exports.PAGES = {
var P =
module.exports.P = {
__pages__: PAGES,
__parser__: parser,
__parser__: macros,
path: '/',
@ -538,7 +538,7 @@ test.Tests({
var p = serialize.partialDeepCopy(page)
var s = serialize.partialDeepCopy(st)
assert(
(res = await parser.exec(
(res = await macros.exec(
p,
input,
s))