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
|
||||
blockname = block.getAttribute('name')
|
||||
for target_block in target_blocks:
|
||||
|
||||
if blockname != target_block.getAttribute('name'):
|
||||
continue
|
||||
|
||||
for child in target_block.childNodes:
|
||||
block.parentNode.insertBefore(child.cloneNode(True),block)
|
||||
block.parentNode.insertBefore(child.cloneNode(True), block)
|
||||
block_found = True
|
||||
break
|
||||
block.parentNode.removeChild(block)
|
||||
|
|
|
@ -146,15 +146,14 @@ class Post(Index):
|
|||
self.replaceByText(dom, root, node, value)
|
||||
return None
|
||||
|
||||
def _createPost(self, post, dom, post_elem, root):
|
||||
def _createPost(self, post, dom, root, node):
|
||||
self.cur_post_obj = 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_nodes = dom.getElementsByTagNameNS(self.URI, 'post')
|
||||
post_elem = post_nodes[0]
|
||||
post_elem.parentNode.removeChild(post_elem)
|
||||
root.replaceChild(post_elem, node)
|
||||
|
||||
title_nodes = dom.getElementsByTagName('title')
|
||||
|
||||
|
@ -164,7 +163,7 @@ class Post(Index):
|
|||
node.removeChild(node.childNodes[0])
|
||||
node.appendChild(dom.createTextNode(post.title))
|
||||
|
||||
return node
|
||||
return post_elem
|
||||
|
||||
def _generate(self, blog, src, output, posts):
|
||||
from dynastie.search import Search
|
||||
|
|
Loading…
Reference in New Issue
Block a user