diff --git a/wiki.js b/wiki.js index 0a42c29..5210be6 100755 --- a/wiki.js +++ b/wiki.js @@ -118,9 +118,7 @@ var macro = { macro: { now: Macro('Create a now id', [], - function(context, elem, state){ - return ''+Date.now() - }), + function(context, elem, state){ return ''+Date.now() }), // select filter to post-process text... filter: Macro('Filter to post-process text', ['name'], @@ -255,8 +253,26 @@ var macro = { } } + // fill macro... if(path){ - return $(context.get(path) + var pages = context.get(path) + + // no matching pages... + if(pages.length == 0){ + var e = elem + .find('else').first().clone() + .attr('src', path) + parse(e, context) + return e + + } + + // fill with pages... + elem = elem.clone() + .find('else') + .remove() + .end() + return $(pages .map(function(page){ var e = elem.clone() .attr('src', page.path) @@ -735,6 +751,11 @@ var data = { +'@include(./todo)' +'', }, + 'Templates/EmptyOutline': { + text: '' + +'@include(./outline)' + +'', + }, 'Templates/pages': { //text: ' [@source(./path)]
\n' @@ -747,7 +768,7 @@ var data = { +'' +'\n' }, - 'Templates/tree': { + 'Templates/all_pages': { //text: ' [@source(./path)]
\n' text: '' +'' @@ -758,6 +779,23 @@ var data = { +'' +'\n' }, + 'Templates/tree': { + //text: ' [@source(./path)]
\n' + text: '' + +'' + +'
' + +'@source(./title)' + +'\n' + +'×' + +'
' + +'
' + +'' + +'
' + +'
\n' + }, 'Templates/_raw': { text: '@source(..)', }, @@ -825,10 +863,41 @@ var data = { +'', }, + // XXX experimental... + 'Templates/_todo': { + text: '' + +'\n' + +'\n' + // XXX temporary until I figure out how to deal with the saveto=".." + // in implicit vs. explicit _view + +'' + +'@source(../title)' + +'\n' + +'\n' + +'\n' + +'@include(../todo)' + +'' + +'\n', + }, + 'Templates/_outline': { + text: '' + +'\n' + +'\n' + // XXX temporary until I figure out how to deal with the saveto=".." + // in implicit vs. explicit _view + +'' + +'@source(../title)' + +'\n' + +'\n' + +'\n' + +'@include(../outline)' + +'' + +'\n', + }, + // XXX experimental... // XXX need sorting... - // ToDo view... 'Templates/todo': { text: '' +'
' @@ -864,23 +933,6 @@ var data = { +'' +'\n', }, - // ToDo viewer... - 'Templates/_todo': { - text: '' - +'\n' - +'\n' - // XXX temporary until I figure out how to deal with the saveto=".." - // in implicit vs. explicit _view - +'' - +'@source(../title)' - +'\n' - +'\n' - +'\n' - +'@include(../todo)' - +'' - +'\n', - }, - 'Templates/outline': { text: '' //*