Update post/_createPost to not simply append post content, but replace dyn:post node
This commit is contained in:
parent
10347ec588
commit
1805967833
|
@ -261,12 +261,11 @@ class DynastieGenerator:
|
||||||
return root
|
return root
|
||||||
blockname = block.getAttribute('name')
|
blockname = block.getAttribute('name')
|
||||||
for target_block in target_blocks:
|
for target_block in target_blocks:
|
||||||
|
|
||||||
if blockname != target_block.getAttribute('name'):
|
if blockname != target_block.getAttribute('name'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for child in target_block.childNodes:
|
for child in target_block.childNodes:
|
||||||
block.parentNode.insertBefore(child.cloneNode(True),block)
|
block.parentNode.insertBefore(child.cloneNode(True), block)
|
||||||
block_found = True
|
block_found = True
|
||||||
break
|
break
|
||||||
block.parentNode.removeChild(block)
|
block.parentNode.removeChild(block)
|
||||||
|
|
|
@ -146,15 +146,14 @@ class Post(Index):
|
||||||
self.replaceByText(dom, root, node, value)
|
self.replaceByText(dom, root, node, value)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _createPost(self, post, dom, post_elem, root):
|
def _createPost(self, post, dom, root, node):
|
||||||
self.cur_post_obj = post
|
self.cur_post_obj = post
|
||||||
posts = [post]
|
posts = [post]
|
||||||
self.createPost(posts, dom, post_elem, root)
|
post_elem = self.createElement(dom, 'post')
|
||||||
|
post_elem = self.createPost(posts, dom, post_elem, node)
|
||||||
|
|
||||||
# Post are appended by index. Remove template
|
# Post are appended by index. Remove template
|
||||||
post_nodes = dom.getElementsByTagNameNS(self.URI, 'post')
|
root.replaceChild(post_elem, node)
|
||||||
post_elem = post_nodes[0]
|
|
||||||
post_elem.parentNode.removeChild(post_elem)
|
|
||||||
|
|
||||||
title_nodes = dom.getElementsByTagName('title')
|
title_nodes = dom.getElementsByTagName('title')
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ class Post(Index):
|
||||||
node.removeChild(node.childNodes[0])
|
node.removeChild(node.childNodes[0])
|
||||||
node.appendChild(dom.createTextNode(post.title))
|
node.appendChild(dom.createTextNode(post.title))
|
||||||
|
|
||||||
return node
|
return post_elem
|
||||||
|
|
||||||
def _generate(self, blog, src, output, posts):
|
def _generate(self, blog, src, output, posts):
|
||||||
from dynastie.search import Search
|
from dynastie.search import Search
|
||||||
|
|
Loading…
Reference in New Issue
Block a user