mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-27 05:01:57 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
82be9f8709
commit
e10bdf83b0
12
index.html
12
index.html
@ -38,6 +38,12 @@ var reload = () => {
|
||||
|
||||
//console.log('>>>>>', macro, args)
|
||||
|
||||
if(macro == 'filter' && args.length == 1){
|
||||
console.log('FILTER:', args[0])
|
||||
// XXX
|
||||
return ''
|
||||
}
|
||||
|
||||
if(macro == 'include' && args.length == 1){
|
||||
w = Object.create(Wiki)
|
||||
w.location = args[0]
|
||||
@ -66,6 +72,12 @@ var reload = () => {
|
||||
|
||||
//console.log('>>>>>', macro, args)
|
||||
|
||||
if(macro == 'filter' && args.name != null){
|
||||
console.log('FILTER:', args.name)
|
||||
// XXX
|
||||
return ''
|
||||
}
|
||||
|
||||
if(macro == 'include' && args.src != null){
|
||||
w = Object.create(Wiki)
|
||||
w.location = args.src
|
||||
|
||||
35
wiki.js
35
wiki.js
@ -11,6 +11,23 @@
|
||||
|
||||
// XXX not sure about these...
|
||||
var BaseData = {
|
||||
'Templates/title': function(){
|
||||
var o = Object.create(this)
|
||||
o.location = o.dir
|
||||
return o.title
|
||||
},
|
||||
'Templates/path': function(){
|
||||
return this.dir },
|
||||
'Templates/dir': function(){
|
||||
return normalizePath(path2lst(this.dir).slice(0, -1)) },
|
||||
'Templates/location': function(){
|
||||
return this.dir },
|
||||
'Templates/resolved': function(){
|
||||
var o = Object.create(this)
|
||||
o.location = o.dir
|
||||
return o.acquire(o.dir, o.title)
|
||||
},
|
||||
|
||||
'Templates/list': function(){
|
||||
var p = this.dir
|
||||
|
||||
@ -44,14 +61,13 @@ var BaseData = {
|
||||
'Templates/links': function(){
|
||||
var that = this
|
||||
var p = this.dir
|
||||
var rp = this.acquire(path2lst(p).slice(0, -1), path2lst(p).pop())
|
||||
|
||||
var res = []
|
||||
|
||||
var wiki = this.__wiki_data
|
||||
Object.keys(wiki).forEach(function(k){
|
||||
(wiki[k].links || []).forEach(function(l){
|
||||
that.acquire(path2lst(l).slice(0, -1), path2lst(l).pop()) == rp
|
||||
(l == p || that.acquire(path2lst(l).slice(0, -1), path2lst(l).pop()) == p)
|
||||
&& res.push([l, k])
|
||||
})
|
||||
})
|
||||
@ -129,22 +145,19 @@ var Wiki = {
|
||||
|
||||
// Resolve '.' and '..' relative to current page...
|
||||
//
|
||||
// With the .path set to A/B/C, this will resolve the folowing to:
|
||||
// '.' -> 'A/B'
|
||||
// '..' -> 'A'
|
||||
// './X' -> 'A/B/X'
|
||||
// '../X' -> 'A/X'
|
||||
//
|
||||
// NOTE: '.' is relative to .path and not to .dir
|
||||
// NOTE: this is here as it needs the context to resolve...
|
||||
resolveDotPath: function(path){
|
||||
path = normalizePath(path)
|
||||
// '.' or './*'
|
||||
return path == '.' || /^\.\//.test(path) ?
|
||||
path.replace(/^\./, this.dir)
|
||||
//path.replace(/^\./, this.dir)
|
||||
path.replace(/^\./, this.path)
|
||||
// '..' or '../*'
|
||||
: path == '..' || /^\.\.\//.test(path) ?
|
||||
path.replace(/^\.\./,
|
||||
normalizePath(path2lst(this.dir).slice(0, -1)))
|
||||
//path.replace(/^\.\./,
|
||||
// normalizePath(path2lst(this.dir).slice(0, -1)))
|
||||
path.replace(/^\.\./, this.dir)
|
||||
: path
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user