Dynastie

Dynastie Commit Details

Date:2020-04-06 10:31:28 (3 months 28 days ago)
Author:Grégory Soutadé
Branch:master
Commit:180596783340af54224a8a09e76e0e91b887360b
Parents: 10347ec588d857e4a3f2f267822bf29ce26b7280
Message:Update post/_createPost to not simply append post content, but replace dyn:post node

Changes:
Mdynastie/generators/generator.py (1 diff)
Mdynastie/generators/post.py (2 diffs)

File differences

dynastie/generators/generator.py
261261
262262
263263
264
265264
266265
267266
268267
269
268
270269
271270
272271
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)
dynastie/generators/post.py
146146
147147
148148
149
149
150150
151151
152
152
153
153154
154155
155
156
157
156
158157
159158
160159
......
164163
165164
166165
167
166
168167
169168
170169
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')
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

Archive Download the corresponding diff file

Branches

Tags