mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 18:40:08 +00:00
added custom titles + lots of fixes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
50458ccaa9
commit
807a6df56d
@ -36,9 +36,9 @@ function(text, show_brackets=true, skip){
|
|||||||
if(l[0] == '\\'){
|
if(l[0] == '\\'){
|
||||||
return l.slice(1) }
|
return l.slice(1) }
|
||||||
|
|
||||||
var path = l[0] == '[' ?
|
var path = (l[0] == '[' ?
|
||||||
l.slice(1, -1)
|
l.slice(1, -1)
|
||||||
: l
|
: l)
|
||||||
var i = [].slice.call(arguments).slice(-2)[0]
|
var i = [].slice.call(arguments).slice(-2)[0]
|
||||||
|
|
||||||
// XXX HACK check if we are inside a tag...
|
// XXX HACK check if we are inside a tag...
|
||||||
@ -49,7 +49,7 @@ function(text, show_brackets=true, skip){
|
|||||||
return skip.indexOf(l) < 0 ?
|
return skip.indexOf(l) < 0 ?
|
||||||
('<a '
|
('<a '
|
||||||
+'class="wikiword" '
|
+'class="wikiword" '
|
||||||
+'href="#'+ path +'" '
|
+'href="#'+ path.replace(/"/g, '%22') +'" '
|
||||||
+'bracketed="'+ (show_brackets && l[0] == '[' ? 'yes' : 'no') +'" '
|
+'bracketed="'+ (show_brackets && l[0] == '[' ? 'yes' : 'no') +'" '
|
||||||
//+'onclick="event.preventDefault(); go($(this).attr(\'href\').slice(1))" '
|
//+'onclick="event.preventDefault(); go($(this).attr(\'href\').slice(1))" '
|
||||||
+'>'
|
+'>'
|
||||||
|
|||||||
@ -122,7 +122,7 @@ object.Constructor('BasePage', {
|
|||||||
return context.index },
|
return context.index },
|
||||||
//*/
|
//*/
|
||||||
},
|
},
|
||||||
resolvePathVars: function(path, context={}){
|
resolvePathVars: function(path='', context={}){
|
||||||
var that = this
|
var that = this
|
||||||
return pwpath.normalize(
|
return pwpath.normalize(
|
||||||
Object.entries(this.path_vars)
|
Object.entries(this.path_vars)
|
||||||
@ -1847,6 +1847,8 @@ module.System = {
|
|||||||
text: '@include(.:$ARGS isolated join="@source(file-separator)")' },
|
text: '@include(.:$ARGS isolated join="@source(file-separator)")' },
|
||||||
_view: {
|
_view: {
|
||||||
text: object.doc`
|
text: object.doc`
|
||||||
|
<slot pre/>
|
||||||
|
|
||||||
<slot header>
|
<slot header>
|
||||||
<a href="#/list">☰</a>
|
<a href="#/list">☰</a>
|
||||||
<a href="#<slot parent>../</slot>">⇑</a>
|
<a href="#<slot parent>../</slot>">⇑</a>
|
||||||
@ -1855,15 +1857,12 @@ module.System = {
|
|||||||
<a href="#@source(s ./path/!)/edit">✎</a>
|
<a href="#@source(s ./path/!)/edit">✎</a>
|
||||||
</slot>
|
</slot>
|
||||||
<hr>
|
<hr>
|
||||||
<slot content></slot>
|
<slot content>
|
||||||
<hr>
|
<h1><slot title>@source(./title)</slot></h1>
|
||||||
<slot footer></slot>
|
|
||||||
|
|
||||||
<!-- fill slots defaults -->
|
|
||||||
<slot content hidden>
|
|
||||||
<slot title><h1>@source(./title)</h1></slot>
|
|
||||||
@include(.:$ARGS join="@source(file-separator)" recursive="")
|
@include(.:$ARGS join="@source(file-separator)" recursive="")
|
||||||
</slot>` },
|
</slot>
|
||||||
|
<hr>
|
||||||
|
<slot footer/>` },
|
||||||
// XXX add join...
|
// XXX add join...
|
||||||
_raw: {
|
_raw: {
|
||||||
text: '@quote(.)' },
|
text: '@quote(.)' },
|
||||||
@ -1912,6 +1911,10 @@ module.System = {
|
|||||||
edit: {
|
edit: {
|
||||||
// XXX not sure if we should use .title or .name here...
|
// XXX not sure if we should use .title or .name here...
|
||||||
text: object.doc`
|
text: object.doc`
|
||||||
|
<slot pre>
|
||||||
|
<title>@source(../title) (edit)</title>
|
||||||
|
</slot>
|
||||||
|
|
||||||
<slot parent>../..</slot>
|
<slot parent>../..</slot>
|
||||||
<slot location>@source(../location/!)</slot>
|
<slot location>@source(../location/!)</slot>
|
||||||
|
|
||||||
@ -1976,6 +1979,9 @@ module.System = {
|
|||||||
text: `@include("../**/path:@(all)" join="@source(line-separator)")`},
|
text: `@include("../**/path:@(all)" join="@source(line-separator)")`},
|
||||||
info: {
|
info: {
|
||||||
text: object.doc`
|
text: object.doc`
|
||||||
|
<slot pre>
|
||||||
|
<title>@source(../title) (info)</title>
|
||||||
|
</slot>
|
||||||
<slot title>
|
<slot title>
|
||||||
<h1><a href="#..">@source(../title)</a></h1>
|
<h1><a href="#..">@source(../title)</a></h1>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@ -220,7 +220,9 @@ module = {
|
|||||||
'string') },
|
'string') },
|
||||||
basename: function(path){
|
basename: function(path){
|
||||||
path = this.split(path)
|
path = this.split(path)
|
||||||
return path.length == 1 ?
|
return path.length == 0 ?
|
||||||
|
''
|
||||||
|
: path.length == 1 ?
|
||||||
path[0]
|
path[0]
|
||||||
: (path.at(-1) == '' ?
|
: (path.at(-1) == '' ?
|
||||||
path.at(-2)
|
path.at(-2)
|
||||||
@ -228,7 +230,7 @@ module = {
|
|||||||
dirname: function(path){
|
dirname: function(path){
|
||||||
path = this.split(path)
|
path = this.split(path)
|
||||||
path = path.length == 1 ?
|
path = path.length == 1 ?
|
||||||
'.'
|
'/'
|
||||||
: path.length == 2 ?
|
: path.length == 2 ?
|
||||||
path[0]
|
path[0]
|
||||||
: (path.at(-1) == '' ?
|
: (path.at(-1) == '' ?
|
||||||
@ -344,6 +346,9 @@ module = {
|
|||||||
yield* this.paths(path.concat(page), seen) }} },
|
yield* this.paths(path.concat(page), seen) }} },
|
||||||
|
|
||||||
names: function(path='/'){
|
names: function(path='/'){
|
||||||
|
path = path == '' ?
|
||||||
|
'/'
|
||||||
|
: path
|
||||||
path = this.normalize(path, 'string')
|
path = this.normalize(path, 'string')
|
||||||
var name = path == '/' ?
|
var name = path == '/' ?
|
||||||
this.ROOT_PAGE
|
this.ROOT_PAGE
|
||||||
|
|||||||
12
pwiki2.html
12
pwiki2.html
@ -30,6 +30,10 @@ body {
|
|||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@ -304,7 +308,13 @@ require(['./browser'], function(browser){
|
|||||||
// stop spinner...
|
// stop spinner...
|
||||||
stopSpinner()
|
stopSpinner()
|
||||||
// handle title...
|
// handle title...
|
||||||
document.querySelector('title').innerHTML = `${this.title} — pWiki`
|
// NOTE: we set the global title to either the last <title>
|
||||||
|
// 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...
|
// scroll to anchor element...
|
||||||
this.hash
|
this.hash
|
||||||
&& this.dom
|
&& this.dom
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user