mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
added dot-files, hidden by default and the :all arg to show them...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e837b87663
commit
b406ed04e8
@ -424,7 +424,6 @@ object.Constructor('BasePage', {
|
||||
[await this.find(path)]
|
||||
: paths
|
||||
//*/
|
||||
|
||||
for(var path of paths){
|
||||
yield this.get('/'+ path) } },
|
||||
[Symbol.asyncIterator]: async function*(){
|
||||
@ -837,7 +836,8 @@ object.Constructor('Page', BasePage, {
|
||||
// not 100% correct manner focusing on path depth and ignoring
|
||||
// the context, this potentially can lead to false positives.
|
||||
include: Macro(
|
||||
['src', 'recursive', 'join', ['strict', 'nonstrict', 'isolated']],
|
||||
['src', 'recursive', 'join',
|
||||
['strict', 'nonstrict', 'isolated', 'all']],
|
||||
async function*(args, body, state, key='included', handler){
|
||||
var macro = 'include'
|
||||
if(typeof(args) == 'string'){
|
||||
@ -924,7 +924,10 @@ object.Constructor('Page', BasePage, {
|
||||
// include is rendered in the context of its page but with
|
||||
// the same state...
|
||||
source: Macro(
|
||||
['src'],
|
||||
// XXX should this have the same args as include???
|
||||
['src', 'recursive', 'join',
|
||||
['strict', 'nonstrict', 'isolated', 'all']],
|
||||
//['src'],
|
||||
async function*(args, body, state){
|
||||
yield* this.macros.include.call(this,
|
||||
'source',
|
||||
@ -952,7 +955,8 @@ object.Constructor('Page', BasePage, {
|
||||
//
|
||||
// XXX need a way to escape macros -- i.e. include </quote> in a quoted text...
|
||||
quote: Macro(
|
||||
['src', 'filter', 'text', 'join', ['expandactions']],
|
||||
['src', 'filter', 'text', 'join',
|
||||
['expandactions', 'all']],
|
||||
async function*(args, body, state){
|
||||
var src = args.src //|| args[0]
|
||||
var base = this.get(this.path.split(/\*/).shift())
|
||||
@ -1157,11 +1161,13 @@ object.Constructor('Page', BasePage, {
|
||||
//
|
||||
// XXX SORT sorting not implemented yet....
|
||||
macro: Macro(
|
||||
['name', 'src', 'sort', 'text', 'join', 'else', ['strict', 'nonstrict']],
|
||||
['name', 'src', 'sort', 'text', 'join', 'else',
|
||||
['strict', 'nonstrict', 'all']],
|
||||
async function*(args, body, state){
|
||||
var that = this
|
||||
var name = args.name //?? args[0]
|
||||
var src = args.src
|
||||
var all = args.all
|
||||
var base = this.get(this.path.split(/\*/).shift())
|
||||
var sort = (args.sort ?? '')
|
||||
.split(/\s+/g)
|
||||
@ -1819,7 +1825,7 @@ module.System = {
|
||||
<a href="#@source(../../path)/list">⇑</a>
|
||||
@source(../path)
|
||||
</slot>
|
||||
<macro src="../*" join="@source(line-separator)">
|
||||
<macro src="../*:@(all)" join="@source(line-separator)">
|
||||
<a href="#@source(./path)">@source(./name)</a>
|
||||
<sup>
|
||||
<macro src="./isAction">
|
||||
@ -1836,7 +1842,7 @@ module.System = {
|
||||
// XXX this is really slow...
|
||||
tree: {
|
||||
text: object.doc`
|
||||
<macro src="../*">
|
||||
<macro src="../*:@(all)">
|
||||
<div>
|
||||
<div class="item">
|
||||
<a href="#@source(./path)">@source(./name)</a>
|
||||
@ -1844,12 +1850,12 @@ module.System = {
|
||||
<a class="show-on-hover" href="#@source(./path)/delete">×</a>
|
||||
</div>
|
||||
<div style="padding-left: 30px">
|
||||
@source(./tree)
|
||||
@source("./tree:@(all)")
|
||||
</div>
|
||||
</div>
|
||||
</macro>` },
|
||||
all: {
|
||||
text: `@include(../**/path join="@source(line-separator)")`},
|
||||
text: `@include("../**/path:@(all)" join="@source(line-separator)")`},
|
||||
info: {
|
||||
text: object.doc`
|
||||
Path: @source(../path)
|
||||
@ -2012,6 +2018,10 @@ module.Test = {
|
||||
'list/static': {
|
||||
text: [...'abcdef'] },
|
||||
|
||||
// this is shown by most listers by adding an :all argument to the url...
|
||||
'.hidden': {
|
||||
text: 'Hidden page...' },
|
||||
|
||||
slots: {
|
||||
text: object.doc`
|
||||
Sequential:
|
||||
|
||||
@ -324,6 +324,7 @@ module.BaseStore = {
|
||||
|| path.includes('**')){
|
||||
var order = (this.metadata(path) ?? {}).order || []
|
||||
var {path, args} = pwpath.splitArgs(path)
|
||||
var all = args.all
|
||||
args = pwpath.joinArgs('', args)
|
||||
// NOTE: we are matching full paths only here so leading and
|
||||
// trainling '/' are optional...
|
||||
@ -351,6 +352,9 @@ module.BaseStore = {
|
||||
// skip metadata paths...
|
||||
if(p.includes('*')){
|
||||
return res }
|
||||
if(pwpath.basename(p)[0] == '.'
|
||||
&& !all){
|
||||
return res }
|
||||
var m = p.match(pattern)
|
||||
m
|
||||
&& (!strict
|
||||
@ -389,6 +393,7 @@ module.BaseStore = {
|
||||
if(path.includes('*')
|
||||
|| path.includes('**')){
|
||||
var p = pwpath.splitArgs(path)
|
||||
var all = p.args.all
|
||||
var args = pwpath.joinArgs('', p.args)
|
||||
p = pwpath.split(p.path)
|
||||
var tail = []
|
||||
@ -396,8 +401,12 @@ module.BaseStore = {
|
||||
tail.unshift(p.pop()) }
|
||||
tail = tail.join('/')
|
||||
if(tail.length > 0){
|
||||
return (await this.match(p.join('/'), strict))
|
||||
return (await this.match(
|
||||
p.join('/') + (all ? ':all' : ''),
|
||||
strict))
|
||||
.map(function(p){
|
||||
all &&
|
||||
(p = p.replace(/:all/, ''))
|
||||
return pwpath.join(p, tail) + args }) } }
|
||||
// direct...
|
||||
return this.match(path, strict) },
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
*
|
||||
* XXX BUG: '@include(@(arg))' does not parse correctly while @include("@(arg)") does...
|
||||
* ...likely due to the regexp not counting the brace balance...
|
||||
* XXX BUG CHROME: can't .get(..) a generator...
|
||||
* https://bugs.chromium.org/p/chromium/issues/detail?id=1361981
|
||||
* when done test:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user