mirror of
https://github.com/flynx/pWiki.git
synced 2026-01-10 20:07:43 +00:00
experimenting with slots...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
484e779300
commit
50991c004e
@ -828,7 +828,7 @@ object.Constructor('Page', BasePage, {
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// NOTE: by default only the first slot with <name> is visible,
|
// NOTE: by default only the first slot with <name> is visible,
|
||||||
// all other slot with <name> will replace its content, unless
|
// all other slots with <name> will replace its content, unless
|
||||||
// explicit shown/hidden arguments are given.
|
// explicit shown/hidden arguments are given.
|
||||||
// NOTE: hidden has precedence over shown if both are given.
|
// NOTE: hidden has precedence over shown if both are given.
|
||||||
//
|
//
|
||||||
@ -1217,9 +1217,18 @@ module.System = {
|
|||||||
//
|
//
|
||||||
// XXX all of these should support pattern pages...
|
// XXX all of these should support pattern pages...
|
||||||
_text: {
|
_text: {
|
||||||
text: '@include(. isolated join="@source(file-separator)")' },
|
//text: '@include(. isolated join="@source(file-separator)")' },
|
||||||
_text2: {
|
// XXX problem: the show slot
|
||||||
text: '<macro src="." join="@source(file-separator)">@include(. isolated)</macro>' },
|
text: object.doc`
|
||||||
|
<slot name="header">@source(./path)/_edit</slot>
|
||||||
|
<hr>
|
||||||
|
<slot name="content"></slot>
|
||||||
|
<hr>
|
||||||
|
<slot name="footer"></slot>
|
||||||
|
|
||||||
|
<slot name="content">
|
||||||
|
@include(. join="@source(file-separator)")
|
||||||
|
</slot>` },
|
||||||
// XXX add join...
|
// XXX add join...
|
||||||
_raw: {
|
_raw: {
|
||||||
text: '@quote(.)' },
|
text: '@quote(.)' },
|
||||||
@ -1233,7 +1242,9 @@ module.System = {
|
|||||||
_edit: {
|
_edit: {
|
||||||
//_edit: {
|
//_edit: {
|
||||||
text:
|
text:
|
||||||
'<macro src="." join="@source(file-separator)">'
|
'@source(./path)'
|
||||||
|
+'<hr>'
|
||||||
|
+'<macro src="." join="@source(file-separator)">'
|
||||||
+'<pre class="editor" '
|
+'<pre class="editor" '
|
||||||
+'wikiwords="no" '
|
+'wikiwords="no" '
|
||||||
+'contenteditable '
|
+'contenteditable '
|
||||||
@ -1248,7 +1259,7 @@ module.System = {
|
|||||||
|
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
text: '<macro src="../*/path" join="@source(line-separator)">@source(.)</macro>' },
|
text: `<macro src="../*/path" join="@source(line-separator)">@source(.)</macro>` },
|
||||||
// XXX this is really slow...
|
// XXX this is really slow...
|
||||||
// XXX for some reason replacing both @quote(..) with @source(..) in
|
// XXX for some reason replacing both @quote(..) with @source(..) in
|
||||||
// the links will break macro parsing...
|
// the links will break macro parsing...
|
||||||
@ -1285,6 +1296,13 @@ module.System = {
|
|||||||
return this.path },
|
return this.path },
|
||||||
test_list: function(){
|
test_list: function(){
|
||||||
return 'abcdef'.split('') },
|
return 'abcdef'.split('') },
|
||||||
|
// XXX problem: it appears that we can't fill a slot from within a slot...
|
||||||
|
// ...the "content" slot below does not override the content slot in _text
|
||||||
|
test_slots: {
|
||||||
|
text: object.doc`OUTER
|
||||||
|
<slot name="header">HEADER</slot>
|
||||||
|
<slot name="content">CONTENT</slot>
|
||||||
|
<slot name="footer">FOOTER</SLOT> `},
|
||||||
|
|
||||||
|
|
||||||
// page parts...
|
// page parts...
|
||||||
@ -1298,7 +1316,7 @@ module.System = {
|
|||||||
RecursionError: {
|
RecursionError: {
|
||||||
text: 'RECURSION ERROR: @quote(../path)' },
|
text: 'RECURSION ERROR: @quote(../path)' },
|
||||||
NotFoundError: {
|
NotFoundError: {
|
||||||
text: 'NOT FOUND ERROR: @quote(../path)' },
|
text: 'NOT FOUND ERROR: @quote(./path)' },
|
||||||
|
|
||||||
DeletingPage: {
|
DeletingPage: {
|
||||||
text: 'Deleting: @source(../path)' },
|
text: 'Deleting: @source(../path)' },
|
||||||
|
|||||||
@ -32,22 +32,21 @@ store.next.load(
|
|||||||
return res }, {}))
|
return res }, {}))
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
// XXX these are async...
|
module.setup =
|
||||||
// ...see browser.js for a way to deal with this...
|
Promise.all([
|
||||||
pwiki.store.update('@file-ro', {
|
pwiki.store.update('@file-ro', {
|
||||||
__proto__: filestore.FileStoreRO,
|
__proto__: filestore.FileStoreRO,
|
||||||
__path__: 'bootstrap',
|
__path__: 'bootstrap',
|
||||||
})
|
}),
|
||||||
|
pwiki.store.update('@file', {
|
||||||
pwiki.store.update('@file', {
|
__proto__: filestore.FileStore,
|
||||||
__proto__: filestore.FileStore,
|
__path__: 'data/fs',
|
||||||
__path__: 'data/fs',
|
}),
|
||||||
})
|
pwiki.store.update('@pouch', {
|
||||||
|
__proto__: pouchdbstore.PouchDBStore,
|
||||||
pwiki.store.update('@pouch', {
|
__path__: 'data/pouch',
|
||||||
__proto__: pouchdbstore.PouchDBStore,
|
}),
|
||||||
__path__: 'data/pouch',
|
])
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@ -165,7 +164,7 @@ pwiki.pwiki
|
|||||||
|
|
||||||
@filter(wikiword markdown) `, })
|
@filter(wikiword markdown) `, })
|
||||||
.update({
|
.update({
|
||||||
location: '/test/slots',
|
location: '/test/slot',
|
||||||
text: object.doc`
|
text: object.doc`
|
||||||
Testing slot mechanics...
|
Testing slot mechanics...
|
||||||
|
|
||||||
@ -175,6 +174,26 @@ pwiki.pwiki
|
|||||||
|
|
||||||
<slot name="non-empty">text is filling a slot</slot>
|
<slot name="non-empty">text is filling a slot</slot>
|
||||||
`, })
|
`, })
|
||||||
|
.update({
|
||||||
|
location: '/test/slots',
|
||||||
|
text: object.doc`
|
||||||
|
<slot name="slot">unfilled</slot>
|
||||||
|
|
||||||
|
<slot name="slot">filled</slot>
|
||||||
|
|
||||||
|
<slot name="slot">refilled</slot> `, })
|
||||||
|
.update({
|
||||||
|
location: '/test/nestedslots',
|
||||||
|
text: object.doc`
|
||||||
|
<slot name="slot">
|
||||||
|
unfilled
|
||||||
|
<slot name="slot">
|
||||||
|
filled
|
||||||
|
<slot name="slot">
|
||||||
|
refilled
|
||||||
|
</slot>
|
||||||
|
</slot>
|
||||||
|
</slot> `, })
|
||||||
.update({
|
.update({
|
||||||
location: '/test/a',
|
location: '/test/a',
|
||||||
text: 'a',
|
text: 'a',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user