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)
tags/v0.2^2
Jonathan Golder 1 year ago
parent
commit
6572a89085
2 changed files with 9 additions and 0 deletions
  1. 1
    0
      euroexchange/config.py
  2. 8
    0
      euroexchange/descpage.py

+ 1
- 0
euroexchange/config.py View File

@@ -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
- 0
euroexchange/descpage.py View File

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