diff --git a/v3/package-lock.json b/v3/package-lock.json index 32204f0..9624fbe 100644 --- a/v3/package-lock.json +++ b/v3/package-lock.json @@ -13,6 +13,7 @@ "ig-actions": "*", "ig-features": "*", "ig-object": "*", + "ig-serialize": "*", "ig-types": "*", "requirejs": "*", "uuid": "*" @@ -141,6 +142,12 @@ "ig-stoppable": "^2.0.0" } }, + "node_modules/ig-serialize": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ig-serialize/-/ig-serialize-1.3.4.tgz", + "integrity": "sha512-aIrZ7ljyXVRUsyvcWfF2JSz/4hWtDrJcTpHJ2y4QD48YXF/0eIwwzDbB6dCmoK2EO5fHfxa82WrVBncb+kDqvg==", + "license": "BSD-3-Clause" + }, "node_modules/ig-stoppable": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/ig-stoppable/-/ig-stoppable-2.0.4.tgz", diff --git a/v3/package.json b/v3/package.json index f5a2862..b9504da 100755 --- a/v3/package.json +++ b/v3/package.json @@ -11,7 +11,8 @@ "ig-actions": "*", "ig-features": "*", "ig-object": "*", - "ig-types": "*" + "ig-types": "*", + "ig-serialize": "*" }, "devDependencies": { "ig-test": "*" diff --git a/v3/pwiki/parser.js b/v3/pwiki/parser.js index ccb9e48..cd78bcc 100644 --- a/v3/pwiki/parser.js +++ b/v3/pwiki/parser.js @@ -1355,10 +1355,15 @@ module.parser = { // XXX need a way to make encode option transparent... // XXX store a page cache in state... // XXX UPDATE... + include2: Macro( + ['src', 'recursive', 'join', + ['s', 'strict', 'isolated']], + function*(parser, args, body, state, key='included', handler){ + }), include: Macro( ['src', 'recursive', 'join', ['s', 'strict', 'isolated']], - async function*(args, body, state, key='included', handler){ + async function*(parser, args, body, state, key='included', handler){ var macro = 'include' if(typeof(args) == 'string'){ var [macro, args, body, state, key, handler] = arguments diff --git a/v3/pwiki/test/parser.js b/v3/pwiki/test/parser.js index dc88846..b128f5b 100755 --- a/v3/pwiki/test/parser.js +++ b/v3/pwiki/test/parser.js @@ -2,6 +2,7 @@ //--------------------------------------------------------------------- var test = require('ig-test') +var serialize = require('ig-serialize') var parser = require('../parser').parser @@ -10,10 +11,15 @@ var parser = require('../parser').parser test.Setups({ empty: function(assert){ - return [ '', '' ] }, + return { code: [ '', '' ] }}, + // XXX var... + + // XXX arg... + + // slot... slot_empty: function(assert){ - return [ + return {code: [ '@slot(slot)', '@slot("slot")', '@slot(\'slot\')', @@ -26,44 +32,44 @@ test.Setups({ '', '', '', - '' ] }, + '' ]} }, slot_value: function(assert){ - return [ + return {code: [ '', '', '@slot(slot value)', '@slot(slot text=value)', - 'value' ] }, + 'value' ]} }, slot_fill: function(assert){ - var ins = this.slot_value(assert).slice(0, -1) - return [ + var ins = this.slot_value(assert).code.slice(0, -1) + return {code: [ ...ins.map(function(e){ return e + '@slot(slot other)' }), ...ins.map(function(e){ return e + '' }), ...ins.map(function(e){ return e + 'other' }), - 'other' ] }, + 'other' ]} }, slot_fill_fill: function(assert){ - var ins = this.slot_fill(assert).slice(0, -1) - return [ + var ins = this.slot_fill(assert).code.slice(0, -1) + return {code: [ ...ins.map(function(e){ return e + '@slot(slot third)' }), ...ins.map(function(e){ return e + '' }), ...ins.map(function(e){ return e + 'third' }), - 'third' ] }, + 'third' ]} }, // XXX these are an alternative to ... slot_nested: function(assert){ - return [ + return {code: [ '[[ ]]@slot(slot.content value)', - '[[ value ]]' ] }, + '[[ value ]]' ]} }, slot_nested_overwrite: function(assert){ - return [ + return {code: [ '[[ ]]@slot(slot value)', - 'value' ] }, + 'value' ]} }, /* XXX SHOWN_HIDDEN // XXX these need to be revised... @@ -72,29 +78,29 @@ test.Setups({ slot_shown: function(assert){ var ins = this.slot_value(assert) var expect = ins.pop() - return [ + return {code: [ ...ins.map(function(i){ return i +' @slot(slot that shown)' }), - 'that that' ] }, + 'that that' ]} }, slot_hidden: function(assert){ - return [ + return {code: [ '