diff --git a/pwiki/dom/wikiword.js b/pwiki/dom/wikiword.js index c128af4..1a09668 100755 --- a/pwiki/dom/wikiword.js +++ b/pwiki/dom/wikiword.js @@ -7,6 +7,12 @@ (function(require){ var module={} // make module AMD/node compatible... /*********************************************************************/ + +var pwpath = require('../path') + + +/*********************************************************************/ + var WIKIWORD_PATTERN = RegExp('('+[ // /some/path | ./some/path | ../some/path | >>/some/path @@ -87,8 +93,8 @@ function(elem){ || text.parentNode.nodeName.toLowerCase() == 'script' || (text.parentNode.getAttribute('wikiwords') ?? '').toLowerCase() == 'no'){ return } - var t = text.nodeValue - var n = setWikiWords(text.nodeValue) + var t = pwpath.quoteHTML(text.nodeValue) + var n = setWikiWords(t) if(t != n){ tmp.innerHTML = n text.replaceWith(...tmp.childNodes) } }) } diff --git a/pwiki/page.js b/pwiki/page.js index 7363be1..4334288 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -238,7 +238,6 @@ object.Constructor('BasePage', { to : '../'+to) }, - // XXX TITLE / EXPERIMENTAL... get title(){ return pwpath.decodeElem(this.name) }, set title(value){ @@ -1126,7 +1125,7 @@ object.Constructor('Page', BasePage, { // XXX need a way to escape macros -- i.e. include in a quoted text... quote: Macro( ['src', 'filter', 'text', 'join', - ['expandactions']], + ['s', 'expandactions']], async function*(args, body, state){ var src = args.src //|| args[0] var base = this.get(this.path.split(/\*/).shift()) @@ -1145,6 +1144,8 @@ object.Constructor('Page', BasePage, { var expandactions = args.expandactions ?? true + // XXX EXPERIMENTAL + var strquotes = args.s var depends = state.depends = state.depends @@ -1180,6 +1181,11 @@ object.Constructor('Page', BasePage, { && await page.type == 'action') ? base.get(this.QUOTE_ACTION_PAGE).raw : await page.raw + text = strquotes ? + text + .replace(/["']/g, function(c){ + return '%'+ c.charCodeAt().toString(16) }) + : text page.path && depends.add(page.path) @@ -1665,12 +1671,25 @@ object.Constructor('Page', BasePage, { ...module.BasePage.prototype.actions, '!': true, + // XXX EXPERIMENTAL... + quote: true, }, + // XXX should this be .raw or .parse()??? '!': Object.assign( function(){ return this.get('..:$ARGS', {energetic: true}).raw }, {energetic: true}), + // XXX EXPERIMENTAL... + // XXX this is html/web specific, should it be here??? + // ... + // XXX should this be .raw or .parse()??? + quote: function(){ + return this.get('..:$ARGS').raw//parse() + .then(function(res){ + return res instanceof Array ? + res.map(pwpath.quoteHTML) + : pwpath.quoteHTML(res) }) }, // events... @@ -1692,6 +1711,7 @@ object.Constructor('Page', BasePage, { // NOTE: .__debug_last_render_state is mainly exposed for introspection // and debugging, set comment it out to disable... //__debug_last_render_state: undefined, + // XXX should this handle pattern paths??? parse: async function(text, state){ var that = this text = await text @@ -2061,6 +2081,7 @@ object.Constructor('pWikiPageElement', Page, { hash: true, }, + // NOTE: setting location will reset .hash set it directly via either // one of: // .location = [path, hash] @@ -2161,7 +2182,7 @@ module.System = { - [@source(./location/!)] + [@source(./location/!/quote)] @@ -2175,7 +2196,7 @@ module.System = { -

@source(./title/!)

+

@source(./title/!/quote)

@include(.:$ARGS join="@source(file-separator)" recursive="")
` }, @@ -2207,15 +2228,15 @@ module.System = { /*/ _edit: { text: - '@source(./path/!)' + '@source(./path/!/quote)' +'
' +'' +'

' - +'@source(./name)' + +'oninput="saveContent(\'@source(s ./path)/name\', this.innerText)">' + +'@source(./title/quote)' +'

' +'
-						@source(./title)
+						@source(./title/quote)
 					
 				
 			
@@ -2253,7 +2274,7 @@ module.System = {
 				@source(../title) (edit)
 			
 			../..
-			@source(../location/!)
+			@source(../location/!/quote)
 			
 			
 				
@@ -2326,7 +2347,7 @@ module.System = {
 			
 			
 				@var(path "@source(s ./path)")
-				@source(./name)
+				@source(./name/quote)
 				
 					
 						a
@@ -2356,7 +2377,7 @@ module.System = {
 				@var(path "@source(s ./path)")
 				
- @source(./title) + @source(./title/quote) 🛈 - @source(../title) (info) + @source(../title/quote) (info) -

@source(../title)

+

@source(../title/quote)

- Path: [@source(../path) ] + Path: [@source(../path/quote)] (edit)
- Resolved path: [/@source(../resolved)]
- Referrer: [@source(../referrer)]
+ Resolved path: [/@source(../resolved/quote)]
+ Referrer: [@source(../referrer/quote)]
Args:
type: @source(../type)
@@ -2453,10 +2474,10 @@ module.System = {
ParseError: @(msg "no message")
- Page: [@(path "@source(./path)")] + Page: [@(path "@source(./path/quote)")]
`,}, RecursionError: { - text: 'RECURSION ERROR: @source(../path)' }, + text: 'RECURSION ERROR: @source(../path/quote)' }, NotFoundError: { //text: 'NOT FOUND ERROR: @source(./path)' }, text: object.doc` @@ -2469,20 +2490,20 @@ module.System = { Nested pages:
` }, NotFoundTemplateError: { - text: 'NOT FOUND TEMPLATE ERROR: @source(../path)' }, + text: 'NOT FOUND TEMPLATE ERROR: @source(../path/quote)' }, DeletingPage: { - text: 'Deleting: @source(../path)' }, + text: 'Deleting: @source(../path/quote)' }, PageTemplate: { text: object.doc` - @source(./path)/_edit + @source(./path/quote)/edit

@@ -2509,11 +2530,6 @@ module.System = {
${text}`}, - // XXX REMOVE WHEN NOT NEEDED... - TEST: function(){ - console.log('TEST') - return 'TEST' }, - // XXX EXPERIMENTAL -- page types... isAction: async function(){ return await this.get('..').type == 'action' ? @@ -2600,7 +2616,7 @@ module.Templates = { @var(path "@source(s ./path)")