mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-17 08:31:38 +00:00
bugfixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
251e3fcb35
commit
b167af0f51
47
wiki.js
47
wiki.js
@ -295,13 +295,12 @@ var macro = {
|
|||||||
// NOTE: this modifies parsed in-place...
|
// NOTE: this modifies parsed in-place...
|
||||||
var _parse = function(context, parsed, macro){
|
var _parse = function(context, parsed, macro){
|
||||||
$(parsed).contents().each(function(_, e){
|
$(parsed).contents().each(function(_, e){
|
||||||
// #text node -> parse the @ macros...
|
// #text / comment node -> parse the @... macros...
|
||||||
if(e.nodeType == e.TEXT_NODE){
|
if(e.nodeType == e.TEXT_NODE || e.nodeType == e.COMMENT_NODE){
|
||||||
$(e).replaceWith(_parseText(context, $(e).text(), macro))
|
// get actual element content...
|
||||||
|
var text = $('<div>').append($(e).clone()).html()
|
||||||
|
|
||||||
// comment node -> parse the @ macros...
|
$(e).replaceWith(_parseText(context, text, macro))
|
||||||
} else if(e.nodeType == e.COMMENT_NODE){
|
|
||||||
$(e).replaceWith(_parseText(context, '<!--'+e.textContent+'-->', macro))
|
|
||||||
|
|
||||||
// node -> html-style + attrs...
|
// node -> html-style + attrs...
|
||||||
} else {
|
} else {
|
||||||
@ -365,18 +364,7 @@ var macro = {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// merge includes...
|
// merge includes...
|
||||||
//
|
|
||||||
// XXX the include macro should:
|
|
||||||
// - for text input
|
|
||||||
// -> create page and push to state.include
|
|
||||||
// -> return placeholder
|
|
||||||
// - for dom input
|
|
||||||
// -> do nothing
|
|
||||||
parsed
|
parsed
|
||||||
// text includes...
|
|
||||||
// XXX I do not like that we are reparsing the whole page here...
|
|
||||||
// ...the only alternative I see is traversing the whole
|
|
||||||
// page agin -- _parse(..) stage 1.5???...
|
|
||||||
.html(parsed.html().replace(include_marker, function(){
|
.html(parsed.html().replace(include_marker, function(){
|
||||||
var page = state.include.shift()
|
var page = state.include.shift()
|
||||||
|
|
||||||
@ -386,35 +374,12 @@ var macro = {
|
|||||||
//.append(page
|
//.append(page
|
||||||
// .parse({ slots: state.slots }, true))
|
// .parse({ slots: state.slots }, true))
|
||||||
.append(that
|
.append(that
|
||||||
.parse(context,
|
.parse(page,
|
||||||
page.raw,
|
page.raw,
|
||||||
{ slots: state.slots },
|
{ slots: state.slots },
|
||||||
true)))
|
true)))
|
||||||
.html()
|
.html()
|
||||||
}))
|
}))
|
||||||
/* XXX do we need this???
|
|
||||||
// tag includes...
|
|
||||||
.find('include').each(function(i, elem){
|
|
||||||
var src = $(elem).attr('src')
|
|
||||||
|
|
||||||
// ignore include tags without src...
|
|
||||||
if(!src){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// fill the include element with page...
|
|
||||||
// XXX this uses old Wiki.parse(..) method/parser...
|
|
||||||
$(elem)
|
|
||||||
.empty()
|
|
||||||
//.append(that.get(src)
|
|
||||||
// .parse({ slots: state.slots }, true))
|
|
||||||
.append(that
|
|
||||||
.parse(context,
|
|
||||||
context.get(src).raw,
|
|
||||||
{ slots: state.slots },
|
|
||||||
true))
|
|
||||||
})
|
|
||||||
//*/
|
|
||||||
|
|
||||||
// post macro...
|
// post macro...
|
||||||
if(!skip_post){
|
if(!skip_post){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user