mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-21 10:31:39 +00:00
experimenting with folder names + action aliases...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1e32383c26
commit
271a0fe1a4
@ -47,8 +47,9 @@ module.setup =
|
|||||||
Promise.all([
|
Promise.all([
|
||||||
// static stores...
|
// static stores...
|
||||||
//
|
//
|
||||||
store.next.update('System',
|
//store.next.update('System',
|
||||||
//store.update('System',
|
store.next.update(
|
||||||
|
pwpath.sanitize(pwpath.SYSTEM_PATH),
|
||||||
Object.create(basestore.BaseStore).load(page.System)),
|
Object.create(basestore.BaseStore).load(page.System)),
|
||||||
store.update('Settings',
|
store.update('Settings',
|
||||||
Object.create(basestore.BaseStore).load(page.Settings)),
|
Object.create(basestore.BaseStore).load(page.Settings)),
|
||||||
|
|||||||
@ -57,27 +57,35 @@ object.Constructor('BasePage', {
|
|||||||
// different "class"...
|
// different "class"...
|
||||||
//__clone_proto__: undefined,
|
//__clone_proto__: undefined,
|
||||||
|
|
||||||
actions: new Set([
|
//
|
||||||
'location',
|
// Format:
|
||||||
'referrer',
|
// {
|
||||||
'path',
|
// <name>: true,
|
||||||
'name',
|
// <name>: <alias>,
|
||||||
'dir',
|
// }
|
||||||
'argstr',
|
//
|
||||||
'title',
|
actions: {
|
||||||
'resolved',
|
location: true,
|
||||||
'rootpath',
|
referrer: true,
|
||||||
'length',
|
path: true,
|
||||||
'type',
|
name: true,
|
||||||
'ctime',
|
dir: true,
|
||||||
'mtime',
|
// alias...
|
||||||
]),
|
args: 'argstr',
|
||||||
|
title: true,
|
||||||
|
resolved: true,
|
||||||
|
rootpath: true,
|
||||||
|
length: true,
|
||||||
|
type: true,
|
||||||
|
ctime: true,
|
||||||
|
mtime: true,
|
||||||
|
},
|
||||||
// These actions will be default get :$ARGS appended if no args are
|
// These actions will be default get :$ARGS appended if no args are
|
||||||
// explicitly given...
|
// explicitly given...
|
||||||
// XXX INHERIT_ARGS
|
// XXX INHERIT_ARGS
|
||||||
actions_inherit_args: new Set([
|
actions_inherit_args: new Set([
|
||||||
'location',
|
'location',
|
||||||
'argstr',
|
'args',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
|
||||||
@ -249,8 +257,11 @@ object.Constructor('BasePage', {
|
|||||||
get energetic(){ return async function(){
|
get energetic(){ return async function(){
|
||||||
return this.__energetic === true
|
return this.__energetic === true
|
||||||
|| ((this.actions
|
|| ((this.actions
|
||||||
&& this.actions.has(this.name)
|
&& this.actions[this.name]
|
||||||
&& !!this[this.name].energetic)
|
&& !!this[
|
||||||
|
this.actions[this.name] === true ?
|
||||||
|
this.name
|
||||||
|
: this.actions[this.name] ].energetic)
|
||||||
|| !!await this.store.isEnergetic(this.path)) }.call(this) },
|
|| !!await this.store.isEnergetic(this.path)) }.call(this) },
|
||||||
set energetic(value){
|
set energetic(value){
|
||||||
this.__energetic = value },
|
this.__energetic = value },
|
||||||
@ -261,8 +272,11 @@ object.Constructor('BasePage', {
|
|||||||
get data(){ return (async function(){
|
get data(){ return (async function(){
|
||||||
// direct actions...
|
// direct actions...
|
||||||
if(this.actions
|
if(this.actions
|
||||||
&& this.actions.has(this.name)){
|
&& this.actions[this.name]){
|
||||||
var name = this.name
|
var name =
|
||||||
|
this.actions[this.name] === true ?
|
||||||
|
this.name
|
||||||
|
: this.actions[this.name]
|
||||||
var page = this.get('..', {args: this.args})
|
var page = this.get('..', {args: this.args})
|
||||||
var res = (this.isPattern
|
var res = (this.isPattern
|
||||||
&& !this.__energetic
|
&& !this.__energetic
|
||||||
@ -863,6 +877,7 @@ object.Constructor('Page', BasePage, {
|
|||||||
if(!src){
|
if(!src){
|
||||||
return }
|
return }
|
||||||
// XXX INHERIT_ARGS special-case: inherit args by default...
|
// XXX INHERIT_ARGS special-case: inherit args by default...
|
||||||
|
// XXX should this be done when isolated???
|
||||||
if(this.actions_inherit_args
|
if(this.actions_inherit_args
|
||||||
&& this.actions_inherit_args.has(pwpath.basename(src))
|
&& this.actions_inherit_args.has(pwpath.basename(src))
|
||||||
&& this.get(pwpath.dirname(src)).path == this.path){
|
&& this.get(pwpath.dirname(src)).path == this.path){
|
||||||
@ -1293,15 +1308,15 @@ object.Constructor('Page', BasePage, {
|
|||||||
// NOTE: these can not be overloaded.
|
// NOTE: these can not be overloaded.
|
||||||
// (XXX should this be so?)
|
// (XXX should this be so?)
|
||||||
// XXX should this be an object???
|
// XXX should this be an object???
|
||||||
actions: new Set([
|
actions: {
|
||||||
...module.BasePage.prototype.actions,
|
...module.BasePage.prototype.actions,
|
||||||
|
|
||||||
'!',
|
'!': true,
|
||||||
|
|
||||||
// XXX DEBUG -- remove these...
|
// XXX DEBUG -- remove these...
|
||||||
'testDirect',
|
testDirect: true,
|
||||||
'testDirect!',
|
'testDirect!': true,
|
||||||
]),
|
},
|
||||||
|
|
||||||
'!': Object.assign(
|
'!': Object.assign(
|
||||||
function(){
|
function(){
|
||||||
@ -1658,11 +1673,11 @@ object.Constructor('pWikiPageElement', Page, {
|
|||||||
set __clone_proto__(value){
|
set __clone_proto__(value){
|
||||||
this.__clone_proto = value },
|
this.__clone_proto = value },
|
||||||
|
|
||||||
actions: new Set([
|
actions: {
|
||||||
...CachedPage.prototype.actions,
|
...CachedPage.prototype.actions,
|
||||||
|
|
||||||
'hash'
|
hash: true,
|
||||||
]),
|
},
|
||||||
|
|
||||||
// NOTE: setting location will reset .hash set it directly via either
|
// NOTE: setting location will reset .hash set it directly via either
|
||||||
// one of:
|
// one of:
|
||||||
|
|||||||
@ -31,6 +31,8 @@ module = {
|
|||||||
'NotFoundError',
|
'NotFoundError',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
//SYSTEM_PATH: '/System',
|
||||||
|
SYSTEM_PATH: '/.system',
|
||||||
// Default alternate search locations...
|
// Default alternate search locations...
|
||||||
//
|
//
|
||||||
// NOTE: if a path here is relative it is also searched relative to
|
// NOTE: if a path here is relative it is also searched relative to
|
||||||
@ -38,7 +40,6 @@ module = {
|
|||||||
SEARCH_PATHS: [
|
SEARCH_PATHS: [
|
||||||
//'./Theme/CLI',
|
//'./Theme/CLI',
|
||||||
'./Templates',
|
'./Templates',
|
||||||
'/System',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*/ XXX NORMCACHE...
|
/*/ XXX NORMCACHE...
|
||||||
@ -252,7 +253,7 @@ module = {
|
|||||||
&& path.push(this.INDEX_PAGE) }
|
&& path.push(this.INDEX_PAGE) }
|
||||||
// search for page...
|
// search for page...
|
||||||
var page = path.pop()
|
var page = path.pop()
|
||||||
for(var tpl of ['.', ...this.SEARCH_PATHS]){
|
for(var tpl of ['.', ...this.SEARCH_PATHS, this.SYSTEM_PATH]){
|
||||||
// search for page up the path...
|
// search for page up the path...
|
||||||
var pg = page
|
var pg = page
|
||||||
var base = path.slice()
|
var base = path.slice()
|
||||||
|
|||||||
@ -140,11 +140,6 @@ module.BaseStore = {
|
|||||||
// XXX revise naming...
|
// XXX revise naming...
|
||||||
next: undefined,
|
next: undefined,
|
||||||
|
|
||||||
// XXX HIDE name??
|
|
||||||
hide_paths: [
|
|
||||||
'System',
|
|
||||||
],
|
|
||||||
|
|
||||||
// NOTE: .data is not part of the spec and can be implementation-specific,
|
// NOTE: .data is not part of the spec and can be implementation-specific,
|
||||||
// only .__<name>__(..) use it internally... (XXX check this)
|
// only .__<name>__(..) use it internally... (XXX check this)
|
||||||
__data: undefined,
|
__data: undefined,
|
||||||
|
|||||||
56
pwiki2.js
56
pwiki2.js
@ -1,28 +1,9 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX EXPERIMENTAL DOC INHERIT_ARGS added a special-case...
|
* XXX ASAP start writing docs in pwiki
|
||||||
* as basename will get appended :$ARGS if no args are given...
|
* - WYSIWYG markdown editor/viewer (ASAP)
|
||||||
* ...this only applies to paths referring to the current context
|
* - fs store/export in browser or a simple way to export/import...
|
||||||
* page, i.e.:
|
|
||||||
* await pwiki
|
|
||||||
* .get('/page:x:y:z')
|
|
||||||
* // this will get the args...
|
|
||||||
* .parse('@source(./location)')
|
|
||||||
*
|
|
||||||
* await pwiki
|
|
||||||
* .get('/page:x:y:z')
|
|
||||||
* // this will not get the args -- different page...
|
|
||||||
* .parse('@source(./x/location)')
|
|
||||||
*
|
|
||||||
* await pwiki
|
|
||||||
* .get('/page:x:y:z')
|
|
||||||
* // this will get explicitly given empty args...
|
|
||||||
* .parse('@source(./location:)')
|
|
||||||
*
|
|
||||||
* special args that auto-inherit are given in .actions_inherit_args
|
|
||||||
* XXX this is currently implemented on the level of macro parsing,
|
|
||||||
* should this be in a more general way???
|
|
||||||
* XXX BUG:
|
* XXX BUG:
|
||||||
* /System/info
|
* /System/info
|
||||||
* and:
|
* and:
|
||||||
@ -32,9 +13,6 @@
|
|||||||
* XXX might also be a good idea to investigate a .tree directory index
|
* XXX might also be a good idea to investigate a .tree directory index
|
||||||
* as a supplement to .paths()
|
* as a supplement to .paths()
|
||||||
* XXX Q: can we access fs from a pwa???
|
* XXX Q: can we access fs from a pwa???
|
||||||
* XXX start writing docs in pwiki
|
|
||||||
* - WYSIWYG markdown editor/viewer (ASAP)
|
|
||||||
* - fs store/export in browser
|
|
||||||
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
||||||
* XXX the parser should handle all action return values, including:
|
* XXX the parser should handle all action return values, including:
|
||||||
* - lists -- XXX
|
* - lists -- XXX
|
||||||
@ -227,6 +205,30 @@
|
|||||||
* ...not sure how we track these...
|
* ...not sure how we track these...
|
||||||
* XXX revise how we handle .strict mode in page's .raw and .text...
|
* XXX revise how we handle .strict mode in page's .raw and .text...
|
||||||
* XXX might be a good idea to export HTML from a specific path/pattern...
|
* XXX might be a good idea to export HTML from a specific path/pattern...
|
||||||
|
* XXX EXPERIMENTAL DOC INHERIT_ARGS added a special-case...
|
||||||
|
* as basename will get appended :$ARGS if no args are given...
|
||||||
|
* ...this only applies to paths referring to the current context
|
||||||
|
* page, i.e.:
|
||||||
|
* await pwiki
|
||||||
|
* .get('/page:x:y:z')
|
||||||
|
* // this will get the args...
|
||||||
|
* .parse('@source(./location)')
|
||||||
|
*
|
||||||
|
* await pwiki
|
||||||
|
* .get('/page:x:y:z')
|
||||||
|
* // this will not get the args -- different page...
|
||||||
|
* .parse('@source(./x/location)')
|
||||||
|
*
|
||||||
|
* await pwiki
|
||||||
|
* .get('/page:x:y:z')
|
||||||
|
* // this will get explicitly given empty args...
|
||||||
|
* .parse('@source(./location:)')
|
||||||
|
*
|
||||||
|
* special args that auto-inherit are given in .actions_inherit_args
|
||||||
|
* XXX this is currently implemented on the level of macro parsing,
|
||||||
|
* should this be in a more general way???
|
||||||
|
* XXX should this be done when isolated???
|
||||||
|
* ...yes (current)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -484,7 +486,9 @@ module.store = {
|
|||||||
// XXX nested system store...
|
// XXX nested system store...
|
||||||
module.setup =
|
module.setup =
|
||||||
Promise.all([
|
Promise.all([
|
||||||
store.next.update('System',
|
//store.next.update('System',
|
||||||
|
store.next.update(
|
||||||
|
pwpath.sanitize(pwpath.SYSTEM_PATH),
|
||||||
Object.create(basestore.BaseStore).load(page.System)),
|
Object.create(basestore.BaseStore).load(page.System)),
|
||||||
store.update('Settings',
|
store.update('Settings',
|
||||||
Object.create(basestore.BaseStore).load(page.Settings)),
|
Object.create(basestore.BaseStore).load(page.Settings)),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user