Merge branch 'fs#141-place-notice-after-comment' into develop

This commit is contained in:
2017-08-21 13:51:32 +02:00

View File

@@ -218,7 +218,28 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
# If there is one, add notice after this
if ltemplates:
self.current_wikicode.insert_after( ltemplates[-1],
# Make sure not separate template and maybe following comment
insert_after_index = self.current_wikicode.index(
ltemplates[-1] )
# Filter one linebreak
if isinstance( self.current_wikicode.get(
insert_after_index + 1), mwparser.nodes.text.Text ) and \
self.current_wikicode.get(
insert_after_index + 1 ).value is "\n":
insert_after_index += 1
while isinstance(
self.current_wikicode.get(insert_after_index + 1),
mwparser.nodes.comment.Comment ):
insert_after_index += 1
else:
self.current_wikicode.insert_after(
self.current_wikicode.get(insert_after_index),
self.disc_notice )
# To have it in its own line we need to add a linbreak before