mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-20 01:51:39 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
66e1e310fa
commit
126962e569
21
pwiki2.js
21
pwiki2.js
@ -117,7 +117,8 @@ module.pWikiPath = {
|
|||||||
|
|
||||||
// NOTE: store keys must be normalized...
|
// NOTE: store keys must be normalized...
|
||||||
//
|
//
|
||||||
// XXX should this be strict about leading '/' in paths???
|
// XXX LEADING_SLASH should this be strict about leading '/' in paths???
|
||||||
|
// ...this may lead to duplicate paths created -- '/a/b' and 'a/b'
|
||||||
// XXX must support store stacks...
|
// XXX must support store stacks...
|
||||||
// XXX path macros???
|
// XXX path macros???
|
||||||
// XXX should we support page symlinking???
|
// XXX should we support page symlinking???
|
||||||
@ -129,7 +130,9 @@ module.store = {
|
|||||||
paths: function(){
|
paths: function(){
|
||||||
return Object.keys(this)
|
return Object.keys(this)
|
||||||
.filter(function(p){
|
.filter(function(p){
|
||||||
return p[0] == '/' }) },
|
// XXX LEADING_SLASH
|
||||||
|
//return p[0] == '/' }) },
|
||||||
|
return p.includes('/') }) },
|
||||||
pages: function(){
|
pages: function(){
|
||||||
var that = this
|
var that = this
|
||||||
this.paths()
|
this.paths()
|
||||||
@ -143,7 +146,8 @@ module.store = {
|
|||||||
// pattern match * / **
|
// pattern match * / **
|
||||||
if(path.includes('*')
|
if(path.includes('*')
|
||||||
|| path.includes('**')){
|
|| path.includes('**')){
|
||||||
var pattern = new RegExp(`^\/?${
|
// XXX LEADING_SLASH
|
||||||
|
var pattern = new RegExp(`^\\/?${
|
||||||
pWikiPath.normalize(path, 'string')
|
pWikiPath.normalize(path, 'string')
|
||||||
.replace(/\//, '\\/')
|
.replace(/\//, '\\/')
|
||||||
.replace(/\*\*/, '.+')
|
.replace(/\*\*/, '.+')
|
||||||
@ -153,7 +157,16 @@ module.store = {
|
|||||||
return pattern.test(p)}) }
|
return pattern.test(p)}) }
|
||||||
// search...
|
// search...
|
||||||
for(var p of pWikiPath.paths(path)){
|
for(var p of pWikiPath.paths(path)){
|
||||||
if(p in this){
|
// XXX LEADING_SLASH
|
||||||
|
//if(p in this){
|
||||||
|
if(p in this
|
||||||
|
// NOTE: all paths at this point and in store are
|
||||||
|
// absolute, so we check both with the leading '/'
|
||||||
|
// and without it to make things a bit more
|
||||||
|
// relaxed...
|
||||||
|
|| (p[0] == '/' ?
|
||||||
|
p.slice(1) in this
|
||||||
|
: ('/'+ p) in store)){
|
||||||
return p } } },
|
return p } } },
|
||||||
// XXX should this call actions???
|
// XXX should this call actions???
|
||||||
get: function(path){
|
get: function(path){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user