Merge branch 'master' of github.com:flynx/pWiki

This commit is contained in:
Alex A. Naanou 2022-03-30 17:07:02 +03:00
commit f0f4e9a086

27
wiki.js
View File

@ -131,7 +131,8 @@ var macro = {
return '' }),
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'],
@ -172,7 +173,8 @@ var macro = {
var path = $(elem).attr('src')
return context.get(path)
.map(function(page){ return page.raw })
.map(function(page){
return page.raw })
.join('\n') }),
quote: Macro('Include quoted page source (without parsing)',
@ -199,7 +201,9 @@ var macro = {
// XXX
text = $(elem).html()
text = text == '' ? $(elem).attr('text') : text
text = text == '' ?
$(elem).attr('text')
: text
text = this.parse(context, text, state, true)
//text = parse(elem)
@ -211,9 +215,7 @@ var macro = {
} else if(name in state.slots){
state.slots[name] = text
return ''
}
}),
return '' } }),
//*/
// convert @ macro to html-like + parse content...
slot: Macro('Define/fill slot',
@ -294,7 +296,8 @@ var macro = {
parse(e, page)
return e[0] })) }
return '' }) },
return '' }),
},
// Post macros...
//
@ -379,7 +382,8 @@ var macro = {
.end()
// remove js links...
.find('[href]')
.filter(function(i, e){ return /javascript:/i.test($(e).attr('href')) })
.filter(function(i, e){
return /javascript:/i.test($(e).attr('href')) })
.attr('href', '#')
.end()
.end()
@ -649,8 +653,8 @@ var macro = {
},
!isolated)))
//true)))
.html()
}).join('\n') }))
.html() })
.join('\n') }))
// post processing...
if(!skip_post){
@ -774,8 +778,7 @@ var BaseData = {
'System/delete': function(){
var p = this.dir
delete this.__wiki_data[p]
return this.get('..')
},
return this.get('..') },
//*/
}