mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
working on page and some notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7bdfd0549a
commit
96b24c01f7
48
pwiki2.js
48
pwiki2.js
@ -112,6 +112,7 @@ module.pWikiPath = {
|
|||||||
|
|
||||||
// XXX should we support page symlinking???
|
// XXX should we support page symlinking???
|
||||||
// XXX store keys must be normalized...
|
// XXX store keys must be normalized...
|
||||||
|
// XXX must support store stacks...
|
||||||
var store =
|
var store =
|
||||||
module.store = {
|
module.store = {
|
||||||
exists: function(path){
|
exists: function(path){
|
||||||
@ -145,6 +146,7 @@ module.store = {
|
|||||||
for(var p of pWikiPath.paths(path)){
|
for(var p of pWikiPath.paths(path)){
|
||||||
if(p in this){
|
if(p in this){
|
||||||
return p } } },
|
return p } } },
|
||||||
|
// XXX should this call actions???
|
||||||
get: function(path){
|
get: function(path){
|
||||||
var that = this
|
var that = this
|
||||||
path = this.match(path)
|
path = this.match(path)
|
||||||
@ -176,6 +178,52 @@ module.store = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XXX need to specify page format....
|
||||||
|
// XXX need a way to set the page path...
|
||||||
|
var actions =
|
||||||
|
module.actions = {
|
||||||
|
__proto__: store,
|
||||||
|
|
||||||
|
// base actions (virtual pages)...
|
||||||
|
'/System/raw': function(page, path){
|
||||||
|
return { text: this.get(path +'/..') } },
|
||||||
|
// XXX ...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var relProxy =
|
||||||
|
function(name){
|
||||||
|
return function(path='.', ...args){
|
||||||
|
return this.store[name](
|
||||||
|
pWikiPath.relative(this.path, path),
|
||||||
|
...args) } }
|
||||||
|
|
||||||
|
// page interface...
|
||||||
|
var page =
|
||||||
|
module.page = {
|
||||||
|
store: undefined,
|
||||||
|
path: undefined,
|
||||||
|
text: undefined,
|
||||||
|
|
||||||
|
exists: relProxy('exists'),
|
||||||
|
match: relProxy('match'),
|
||||||
|
// XXX should this return page objects???
|
||||||
|
get: relProxy('get'),
|
||||||
|
|
||||||
|
update: function(path='.', data, mode){
|
||||||
|
if(arguments.length == 1){
|
||||||
|
data = path
|
||||||
|
path = '.' }
|
||||||
|
return this.store.update(pWikiPath.relative(this.path, path), data, mode) },
|
||||||
|
delete: relProxy('delete'),
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
clear: function(){
|
||||||
|
},
|
||||||
|
expand: function(){
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user