diff --git a/pwiki/page.js b/pwiki/page.js index 0324e41..2dc6b7b 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -855,7 +855,7 @@ object.Constructor('Page', BasePage, { .call(this, Object.fromEntries(Object.entries(quote)), null, state) // local filters... - if(body){ + if(body != null){ // expand the body... var ast = expand ? this.__parser__.expand(this, body, state) @@ -903,9 +903,10 @@ object.Constructor('Page', BasePage, { // At the moment nested recursion is checked in a fast but // not 100% correct manner focusing on path depth and ignoring // the context, this potentially can lead to false positives. + // XXX need a way to make encode option transparent... include: Macro( ['src', 'recursive', 'join', - ['strict', 'nonstrict', 'isolated']], + ['s', 'strict', 'nonstrict', 'isolated']], async function*(args, body, state, key='included', handler){ var macro = 'include' if(typeof(args) == 'string'){ @@ -927,6 +928,7 @@ object.Constructor('Page', BasePage, { var isolated = args.isolated var strict = args.strict && !args.nonstrict + var strquotes = args.s var join = args.join && await base.parse(args.join, state) @@ -989,6 +991,11 @@ object.Constructor('Page', BasePage, { // load the included page... var res = await handler.call(page, full, state) depends.add(full) + res = strquotes ? + res + .replace(/["']/g, function(c){ + return '%'+ c.charCodeAt().toString(16) }) + : res // NOTE: we only track recursion down and not sideways... seen.delete(full) @@ -1006,7 +1013,7 @@ object.Constructor('Page', BasePage, { source: Macro( // XXX should this have the same args as include??? ['src', 'recursive', 'join', - ['strict', 'nonstrict', 'isolated']], + ['s', 'strict', 'nonstrict', 'isolated']], //['src'], async function*(args, body, state){ var that = this @@ -1845,7 +1852,7 @@ module.System = { [@source(./location/!)] - +
@@ -1891,13 +1898,13 @@ module.System = { +'

' + +'oninput="saveLiveContent(\'@source(s ./path)/name\')">' +'@source(./name)' +'

' +'
'
+						+'oninput="saveLiveContent(\'@source(s ./path)\', this.innerText)">'
 					+''
 				+'
' +''}, @@ -1912,13 +1919,13 @@ module.System = {

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

`}, @@ -1932,11 +1939,11 @@ module.System = { text: object.doc` - + @source(../path) - @source(./name) + @source(./name) a @@ -1945,9 +1952,9 @@ module.System = { - (@include(./*/length/!)) + (@include(./*/length/!))   - × + × ` }, // XXX this is really slow... tree: { @@ -1956,9 +1963,9 @@ module.System = {
@include("./tree:@(all)") @@ -1970,11 +1977,11 @@ module.System = { info: { text: object.doc` Path: [@source(../path) ] - (edit)
+ (edit)
Resolved path: [@source(../resolved)] - (edit)
+ (edit)
Referrer: [@source(../referrer)] - (edit)
+ (edit)
Args:
type: @source(../type)
@@ -2141,11 +2148,13 @@ module.Templates = { 🗎 ` }, + // XXX this is not resolved... + 'FlatNotes/.templates/EmptyPage': {text: ' '}, } var Test = diff --git a/pwiki/path.js b/pwiki/path.js index ae33b32..52a31b3 100755 --- a/pwiki/path.js +++ b/pwiki/path.js @@ -52,14 +52,14 @@ module = { // XXX EXPERIMENTAL encode: function(str){ return str - .replace(/[#:*%'"]/g, + .replace(/[#:*%]/g, function(s){ return '%'+s.charCodeAt().toString(16) }) }, decode: function(str){ return decodeURIComponent(str) }, encodeElem: function(str){ return str - .replace(/[#:*%'"\\\/]/g, + .replace(/[#:*%\\\/]/g, function(s){ return '%'+s.charCodeAt().toString(16) }) }, decodeElem: function(str){ diff --git a/pwiki2.html b/pwiki2.html index 71fcf9c..8be6011 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -178,6 +178,9 @@ var SAVE_LIVE_QUEUE = {} var saveLiveContent = function(path, text){ + path = path + .replace(/%22/g, '"') + .replace(/%27/g, "'") SAVE_LIVE_QUEUE[path] = text // clear editor page cache... pwiki.cache = null } @@ -185,6 +188,9 @@ function(path, text){ var SAVE_QUEUE = {} var saveContent = function(path, text){ + path = path + .replace(/%22/g, '"') + .replace(/%27/g, "'") SAVE_QUEUE[path] = text } diff --git a/pwiki2.js b/pwiki2.js index 5fb50e0..646a496 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -6,13 +6,6 @@ * - fs store/export in browser or a simple way to export/import... * * -* XXX BUG titles containing quotes break things... -* this works: -* await pwiki.get('/FlatNotes/* /delete').raw -* opening/editing/deleting from ui breaks -- macro issue?? -* ...seems to be at least a problem with macros eating up quotes... -* do not see how we can resolve this issue transparently in any -* way other than disallowing quotes... * XXX BUG: for some reason deleting and refreshing takes ~2x as long as * refreshing... * to reproduce: