diff --git a/pwiki/dom/wikiword.js b/pwiki/dom/wikiword.js index dec5af3..e221c5e 100755 --- a/pwiki/dom/wikiword.js +++ b/pwiki/dom/wikiword.js @@ -36,9 +36,9 @@ function(text, show_brackets=true, skip){ if(l[0] == '\\'){ return l.slice(1) } - var path = l[0] == '[' ? - l.slice(1, -1) - : l + var path = (l[0] == '[' ? + l.slice(1, -1) + : l) var i = [].slice.call(arguments).slice(-2)[0] // XXX HACK check if we are inside a tag... @@ -49,7 +49,7 @@ function(text, show_brackets=true, skip){ return skip.indexOf(l) < 0 ? ('' diff --git a/pwiki/page.js b/pwiki/page.js index 8f0157c..3eadfb0 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -122,7 +122,7 @@ object.Constructor('BasePage', { return context.index }, //*/ }, - resolvePathVars: function(path, context={}){ + resolvePathVars: function(path='', context={}){ var that = this return pwpath.normalize( Object.entries(this.path_vars) @@ -1847,6 +1847,8 @@ module.System = { text: '@include(.:$ARGS isolated join="@source(file-separator)")' }, _view: { text: object.doc` + + @@ -1855,15 +1857,12 @@ module.System = {
- -
- - - - +
+ ` }, // XXX add join... _raw: { text: '@quote(.)' }, @@ -1912,6 +1911,10 @@ module.System = { edit: { // XXX not sure if we should use .title or .name here... text: object.doc` + + @source(../title) (edit) + + ../.. @source(../location/!) @@ -1976,6 +1979,9 @@ module.System = { text: `@include("../**/path:@(all)" join="@source(line-separator)")`}, info: { text: object.doc` + + @source(../title) (info) +

@source(../title)

diff --git a/pwiki/path.js b/pwiki/path.js index 2ccd602..0ea7903 100755 --- a/pwiki/path.js +++ b/pwiki/path.js @@ -220,7 +220,9 @@ module = { 'string') }, basename: function(path){ path = this.split(path) - return path.length == 1 ? + return path.length == 0 ? + '' + : path.length == 1 ? path[0] : (path.at(-1) == '' ? path.at(-2) @@ -228,7 +230,7 @@ module = { dirname: function(path){ path = this.split(path) path = path.length == 1 ? - '.' + '/' : path.length == 2 ? path[0] : (path.at(-1) == '' ? @@ -344,6 +346,9 @@ module = { yield* this.paths(path.concat(page), seen) }} }, names: function(path='/'){ + path = path == '' ? + '/' + : path path = this.normalize(path, 'string') var name = path == '/' ? this.ROOT_PAGE diff --git a/pwiki2.html b/pwiki2.html index e15983a..8615a84 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -30,6 +30,10 @@ body { font-size: 1.1em; } +h1:empty { + display: none; +} + a { text-decoration: none; } @@ -304,7 +308,13 @@ require(['./browser'], function(browser){ // stop spinner... stopSpinner() // handle title... - document.querySelector('title').innerHTML = `${this.title} — pWiki` + // NOTE: we set the global title to either the last + // tag value or the attr .title + var titles = [...document.querySelectorAll('title')] + titles[0].innerHTML = + `${titles.length > 1 ? + titles.at(-1).innerHTML + : this.title} — pWiki` // scroll to anchor element... this.hash && this.dom