Browse Source

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

develop
Jonathan Golder 7 years ago
parent
commit
4a6855cf7b
  1. 23
      bots/markpages.py

23
bots/markpages.py

@ -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

Loading…
Cancel
Save