mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-22 11:01:39 +00:00
bugfix (ugly but works, still thinking)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e4cc323e83
commit
5f31d419de
73
pwiki2.js
73
pwiki2.js
@ -224,6 +224,9 @@ module.BaseStore = {
|
|||||||
// XXX System/sort
|
// XXX System/sort
|
||||||
// XXX System/reverse
|
// XXX System/reverse
|
||||||
},
|
},
|
||||||
|
/*/
|
||||||
|
data: {},
|
||||||
|
//*/
|
||||||
|
|
||||||
|
|
||||||
__paths__: function(){
|
__paths__: function(){
|
||||||
@ -366,14 +369,17 @@ module.BaseStore = {
|
|||||||
__update__: function(key, data, mode='update'){
|
__update__: function(key, data, mode='update'){
|
||||||
this.data[key] = data
|
this.data[key] = data
|
||||||
return this },
|
return this },
|
||||||
|
// XXX don't like this -- revise...
|
||||||
update: function(path, data, mode='update'){
|
update: function(path, data, mode='update'){
|
||||||
path = this.exists(path)
|
var exists = this.exists(path)
|
||||||
|
path = exists
|
||||||
|| module.path.normalize(path, 'string')
|
|| module.path.normalize(path, 'string')
|
||||||
data = Object.assign(
|
data = Object.assign(
|
||||||
|
{},
|
||||||
// XXX do we need to isolate/clone data here???
|
// XXX do we need to isolate/clone data here???
|
||||||
data,
|
data,
|
||||||
{ctime: Date.now()},
|
{ctime: Date.now()},
|
||||||
mode == 'update' ?
|
(mode == 'update' && exists) ?
|
||||||
this.get(path)
|
this.get(path)
|
||||||
: {},
|
: {},
|
||||||
data,
|
data,
|
||||||
@ -412,12 +418,6 @@ module.BaseStore = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// XXX need to specify page format....
|
|
||||||
// XXX need a way to set the page path...
|
|
||||||
var store =
|
|
||||||
module.store =
|
|
||||||
BaseStore.nest()
|
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
//
|
//
|
||||||
@ -442,10 +442,12 @@ function(meth, drop_cache=false, post){
|
|||||||
drop_cache = false }
|
drop_cache = false }
|
||||||
return function(path, ...args){
|
return function(path, ...args){
|
||||||
var store = this.substore(path)
|
var store = this.substore(path)
|
||||||
|
|
||||||
var res = store == null ?
|
var res = store == null ?
|
||||||
object.parentCall(MetaStore, meth, this, path, ...args)
|
object.parentCall(MetaStore, meth, this, path, ...args)
|
||||||
//: this.data[store][meth](path.slice(store.length), ...args)
|
//: this.data[store][meth](path.slice(store.length), ...args)
|
||||||
: this.data[store][target](path.slice(store.length), ...args)
|
: this.data[store][target](path.slice(store.length), ...args)
|
||||||
|
|
||||||
//console.log('---', path, target, '(', store, ...args, ') ->', res)
|
//console.log('---', path, target, '(', store, ...args, ') ->', res)
|
||||||
if(drop_cache){
|
if(drop_cache){
|
||||||
delete this.__substores }
|
delete this.__substores }
|
||||||
@ -1686,6 +1688,61 @@ var WIKIWORD_PATTERN =
|
|||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// XXX experiments and testing...
|
// XXX experiments and testing...
|
||||||
|
|
||||||
|
// XXX need to specify page format....
|
||||||
|
// XXX need a way to set the page path...
|
||||||
|
var store =
|
||||||
|
module.store =
|
||||||
|
BaseStore.nest()
|
||||||
|
|
||||||
|
/*/
|
||||||
|
var store =
|
||||||
|
module.store =
|
||||||
|
BaseStore.nest(MetaStore)
|
||||||
|
|
||||||
|
var System = {
|
||||||
|
// metadata...
|
||||||
|
//
|
||||||
|
path: function(){
|
||||||
|
return this.get('..').path },
|
||||||
|
location: function(){
|
||||||
|
return this.get('..').path },
|
||||||
|
resolved: function(){
|
||||||
|
return this.get('..').match() },
|
||||||
|
dir: function(){
|
||||||
|
return this.get('..').dir },
|
||||||
|
name: function(){
|
||||||
|
return this.get('..').name },
|
||||||
|
ctime: function(){
|
||||||
|
return this.get('..').data.ctime },
|
||||||
|
mtime: function(){
|
||||||
|
return this.get('..').data.mtime },
|
||||||
|
|
||||||
|
title: function(){
|
||||||
|
var p = this.get('..')
|
||||||
|
return p.title
|
||||||
|
?? p.name },
|
||||||
|
|
||||||
|
|
||||||
|
// utils...
|
||||||
|
//
|
||||||
|
// XXX System/subpaths
|
||||||
|
|
||||||
|
|
||||||
|
// actions...
|
||||||
|
//
|
||||||
|
delete: function(){
|
||||||
|
this.location = '..'
|
||||||
|
this.delete()
|
||||||
|
return this.text },
|
||||||
|
// XXX System/back
|
||||||
|
// XXX System/forward
|
||||||
|
// XXX System/sort
|
||||||
|
// XXX System/reverse
|
||||||
|
}
|
||||||
|
store.update('System', System)
|
||||||
|
//*/
|
||||||
|
|
||||||
|
|
||||||
store.load(require('./bootstrap'))
|
store.load(require('./bootstrap'))
|
||||||
|
|
||||||
// NOTE: in general the root wiki api is simply a page instance.
|
// NOTE: in general the root wiki api is simply a page instance.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user