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