rendering multiple matches -- still questions...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-05-17 01:26:39 +03:00
parent a0b377d542
commit fcca322f17

View File

@ -15,6 +15,30 @@
* - in this view a user in the system is simply a set of keys and * - in this view a user in the system is simply a set of keys and
* a signature (a page =)) * a signature (a page =))
* *
* XXX split this into modules...
* pwiki.js
* pwiki/page.js
* pwiki/store.js
* plugin/markdown.js
* plugin/pouchdb.js
*
* XXX add action to reset overloaded (bootstrap) pages...
* - per page
* - global
*
* XXX might be a good idea to add defaults (non-page) for the basic
* pages -- NotFound
*
* XXX need to think about search...
*
* XXX might need to get all the links (macro-level) from a page...
* ...would be useful for caching...
*
* XXX add page events:
* locationChange
* renderDone
* ...
*
* *
* *
**********************************************************************/ **********************************************************************/
@ -163,8 +187,8 @@ module.path = {
// .__paths__() // .__paths__()
// -> <keys> // -> <keys>
// .__exists__(..) // .__exists__(..)
// -> false
// -> <path> // -> <path>
// -> false
// .__get__(..) // .__get__(..)
// -> <data> // -> <data>
// - optionally (for writable stores) // - optionally (for writable stores)
@ -178,9 +202,6 @@ module.path = {
// XXX BUG: mixing up '/' and '' paths... // XXX BUG: mixing up '/' and '' paths...
// XXX LEADING_SLASH 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' // ...this may lead to duplicate paths created -- '/a/b' and 'a/b'
// XXX would be nice to be able to create sub-stores, i.e. an object that
// would store multiple sub-pages for things like todo docs... (???)
// ...the question is how to separate the two from the wiki side...
// XXX path macros??? // XXX path macros???
// XXX should we support page symlinking??? // XXX should we support page symlinking???
var BaseStore = var BaseStore =
@ -810,6 +831,8 @@ object.Constructor('BasePage', {
//*/ //*/
data) }, data) },
// XXX should this be update or assign???
// XXX how should this work on multiple pages...
update: function(...data){ update: function(...data){
return Object.assign(this, ...data) }, return Object.assign(this, ...data) },
@ -1722,12 +1745,24 @@ object.Constructor('Page', BasePage, {
// //
// NOTE: writing to .raw is the same as writing to .text... // NOTE: writing to .raw is the same as writing to .text...
// XXX FUNC handle functions as pages... // XXX FUNC handle functions as pages...
// XXX need to support pattern pages... // XXX for multiple pages matching, should this get one of the pages
// or all (current) of the pages???
get raw(){ get raw(){
var that = this
var data = this.data var data = this.data
return data instanceof Function ? return data instanceof Function ?
// XXX FUNC not sure about this... // XXX FUNC not sure about this...
data.call(this) data.call(this)
// multiple matches...
// XXX should this get one of the pages or all of the pages???
// XXX should we use a special template to render???
: data instanceof Array ?
data
.map(function(d){
return d instanceof Function ?
d.call(that)
: d.text })
.join('\n')
: data.text }, : data.text },
set raw(value){ set raw(value){
this.store.update(this.location, {text: value}) }, this.store.update(this.location, {text: value}) },
@ -1827,7 +1862,7 @@ var System = {
} }
// XXX note sure how to organize the system actions -- there can be two /*/ XXX note sure how to organize the system actions -- there can be two
// options: // options:
// - a root ram store with all the static stuff and nest the rest // - a root ram store with all the static stuff and nest the rest
// - a nested store (as is the case here) // - a nested store (as is the case here)