mirror of
https://github.com/flynx/pWiki.git
synced 2026-01-01 15:41:09 +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,
|
||||
// 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.
|
||||
// NOTE: hidden has precedence over shown if both are given.
|
||||
//
|
||||
@ -1217,9 +1217,18 @@ module.System = {
|
||||
//
|
||||
// XXX all of these should support pattern pages...
|
||||
_text: {
|
||||
text: '@include(. isolated join="@source(file-separator)")' },
|
||||
_text2: {
|
||||
text: '<macro src="." join="@source(file-separator)">@include(. isolated)</macro>' },
|
||||
//text: '@include(. isolated join="@source(file-separator)")' },
|
||||
// XXX problem: the show slot
|
||||
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...
|
||||
_raw: {
|
||||
text: '@quote(.)' },
|
||||
@ -1233,7 +1242,9 @@ module.System = {
|
||||
_edit: {
|
||||
//_edit: {
|
||||
text:
|
||||
'<macro src="." join="@source(file-separator)">'
|
||||
'@source(./path)'
|
||||
+'<hr>'
|
||||
+'<macro src="." join="@source(file-separator)">'
|
||||
+'<pre class="editor" '
|
||||
+'wikiwords="no" '
|
||||
+'contenteditable '
|
||||
@ -1248,7 +1259,7 @@ module.System = {
|
||||
|
||||
|
||||
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 for some reason replacing both @quote(..) with @source(..) in
|
||||
// the links will break macro parsing...
|
||||
@ -1285,6 +1296,13 @@ module.System = {
|
||||
return this.path },
|
||||
test_list: function(){
|
||||
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...
|
||||
@ -1298,7 +1316,7 @@ module.System = {
|
||||
RecursionError: {
|
||||
text: 'RECURSION ERROR: @quote(../path)' },
|
||||
NotFoundError: {
|
||||
text: 'NOT FOUND ERROR: @quote(../path)' },
|
||||
text: 'NOT FOUND ERROR: @quote(./path)' },
|
||||
|
||||
DeletingPage: {
|
||||
text: 'Deleting: @source(../path)' },
|
||||
|
||||
@ -32,22 +32,21 @@ store.next.load(
|
||||
return res }, {}))
|
||||
//*/
|
||||
|
||||
// XXX these are async...
|
||||
// ...see browser.js for a way to deal with this...
|
||||
pwiki.store.update('@file-ro', {
|
||||
__proto__: filestore.FileStoreRO,
|
||||
__path__: 'bootstrap',
|
||||
})
|
||||
|
||||
pwiki.store.update('@file', {
|
||||
__proto__: filestore.FileStore,
|
||||
__path__: 'data/fs',
|
||||
})
|
||||
|
||||
pwiki.store.update('@pouch', {
|
||||
__proto__: pouchdbstore.PouchDBStore,
|
||||
__path__: 'data/pouch',
|
||||
})
|
||||
module.setup =
|
||||
Promise.all([
|
||||
pwiki.store.update('@file-ro', {
|
||||
__proto__: filestore.FileStoreRO,
|
||||
__path__: 'bootstrap',
|
||||
}),
|
||||
pwiki.store.update('@file', {
|
||||
__proto__: filestore.FileStore,
|
||||
__path__: 'data/fs',
|
||||
}),
|
||||
pwiki.store.update('@pouch', {
|
||||
__proto__: pouchdbstore.PouchDBStore,
|
||||
__path__: 'data/pouch',
|
||||
}),
|
||||
])
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@ -165,7 +164,7 @@ pwiki.pwiki
|
||||
|
||||
@filter(wikiword markdown) `, })
|
||||
.update({
|
||||
location: '/test/slots',
|
||||
location: '/test/slot',
|
||||
text: object.doc`
|
||||
Testing slot mechanics...
|
||||
|
||||
@ -175,6 +174,26 @@ pwiki.pwiki
|
||||
|
||||
<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({
|
||||
location: '/test/a',
|
||||
text: 'a',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user