Browse Source

descpage: Implement inserting helptext in code

Add helping comments to beginning of gnuplot scripts explaining data
source

Issue #1 (https://git.golderweb.de/wiki/jogobot-euroexchange/issues/1)
develop
Jonathan Golder 4 years ago
parent
commit
6572a89085
  1. 1
      euroexchange/config.py
  2. 8
      euroexchange/descpage.py

1
euroexchange/config.py

@ -44,3 +44,4 @@ class Config():
csv_file = jogobot.config["euroexchange"]["data_csv_filename"]
upload_comment = jogobot.config["euroexchange"]["upload_comment"]
gnuplot_script_comment = jogobot.config["euroexchange"]["gnuplot_script_comment"]
gnuplot_script_help = jogobot.config["euroexchange"]["gnuplot_script_help"]

8
euroexchange/descpage.py

@ -23,6 +23,7 @@
#
import os
import re
import pywikibot
import mwparserfromhell as mwparser
@ -85,6 +86,13 @@ class DescPageBot(pywikibot.bot.Bot):
replace( "system(\"echo $OUTFILE\")",
"'{}'".format (os.path.basename( self.job.image ) ) )
# Locate first empty line
m = re.search(r"^\s*$", gnuplot_script, re.MULTILINE)
if m:
# Insert help lines
gnuplot_script = gnuplot_script[:m.end()] +\
Config.gnuplot_script_help + gnuplot_script[m.end():]
return gnuplot_script
def parse_page(self):

Loading…
Cancel
Save