diff --git a/pwiki/page.js b/pwiki/page.js
index 2229ccf..1bcf1e4 100755
--- a/pwiki/page.js
+++ b/pwiki/page.js
@@ -169,8 +169,10 @@ object.Constructor('BasePage', {
get data(){ return (async function(){
var that = this
// NOTE: we need to make sure each page gets the chance to handle
- // its context....
- if(this.isPattern){
+ // its context (i.e. bind action to page)....
+ if(this.isPattern
+ // XXX ENERGETIC...
+ && !this.store.isEnergetic(this.path)){
return this
.map(function(page){
return page.data }) }
@@ -179,7 +181,6 @@ object.Constructor('BasePage', {
return typeof(res) == 'function' ?
res.bind(this)
: res }).call(this) },
- //return this.store.get(this.location, !!this.strict) },
set data(value){
this.__update__(value) },
@@ -296,7 +297,9 @@ object.Constructor('BasePage', {
path = path ?
pwpath.relative(this.path, path)
: this.path
- var paths = path.includes('*') ?
+ var paths = path.includes('*')
+ // XXX ENERGETIC...
+ && !await this.store.isEnergetic(path) ?
this.resolve(path)
: path
paths = paths instanceof Array ?
@@ -1525,14 +1528,15 @@ module.System = {
text: object.doc`
☰
- @source(/rootpath)
- (edit)
+ @source(./!path)
+ (edit)
+
@include(. join="@source(file-separator)" recursive="")
` },
@@ -1612,15 +1616,17 @@ module.System = {
@source(../path)
- @source(./name)
-
+ @source(./name)
+
a
s
-
+
+ (@include(./*/!count))
+
×
` },
// XXX this is really slow...
@@ -1706,6 +1712,11 @@ module.System = {
return this.get('..').location },
path: function(){
return this.get('..').path },
+ // XXX ENERGETIC...
+ '!path': Object.assign(
+ function(){
+ return this.get('..').path },
+ {energetic: true}),
rootpath: function(){
return this.root.path },
resolved: async function(){
@@ -1718,6 +1729,13 @@ module.System = {
var p = this.get('..')
return p.title
?? p.name },
+ count: async function(){
+ return this.get('..').length },
+ // XXX ENERGETIC...
+ '!count': Object.assign(
+ async function(){
+ return this.get('..').length },
+ {energetic: true}),
ctime: async function(){
var date = (await this.get('..').data).ctime
return date ?
diff --git a/pwiki/store/base.js b/pwiki/store/base.js
index e6617f7..4f03d6b 100755
--- a/pwiki/store/base.js
+++ b/pwiki/store/base.js
@@ -60,14 +60,14 @@ function(name, get, update, ...args){
// - overload:
// .__paths__()
// ->
-// .__exists__(..)
+// .__exists__(path, ..)
// ->
// -> false
-// .__get__(..)
+// .__get__(path, ..)
// ->
// - optionally (for writable stores)
-// .__update__(..)
-// .__delete__(..)
+// .__update__(path, ..)
+// .__delete__(path, ..)
// .load(..)
//
//
@@ -356,8 +356,13 @@ module.BaseStore = {
return this.data[key] },
get: async function(path, strict=false){
var that = this
- //path = this.match(path, strict)
+ /* XXX ENERGETIC...
path = await this.resolve(path, strict)
+ /*/
+ path = path.includes('*')
+ && await this.isEnergetic(path)
+ || await this.resolve(path, strict)
+ //*/
return path instanceof Array ?
// XXX should we return matched paths???
Promise.iter(path)
@@ -371,6 +376,12 @@ module.BaseStore = {
?? ((this.next || {}).__get__
&& this.next.get(path, strict))) },
+ // XXX EXPERIMENTAL...
+ isEnergetic: async function(path){
+ var p = await this.find(path)
+ return !!(await this.get(p, true) ?? {}).energetic
+ && p },
+
//
// Get metadata...
// .metadata()
diff --git a/pwiki2.js b/pwiki2.js
index 9c914d5..c43b972 100755
--- a/pwiki2.js
+++ b/pwiki2.js
@@ -1,6 +1,20 @@
/**********************************************************************
*
*
+* XXX FEATURE need to be able to call some actions on the root page
+* before it gets .each()'ed...
+* ...for things like:
+* - count
+* - unexpandedpath (name?)
+* - ...
+* this can be done in one of two ways:
+* - syntax
+* + will enable any action to be called energetically...
+* - a complication...
+* - special actions
+* + transparent
+* - extra concept -- might be confusing
+* - duplicate actions
* XXX FEATURE tags and accompanying API...
* - add tags to page -- macro/filter
* .text -> .tags (cached on .update(..))