descpage: Implement inserting helptext in code
Add helping comments to beginning of gnuplot scripts explaining data source Issue #1 (#1)
This commit is contained in:
@@ -44,3 +44,4 @@ class Config():
|
|||||||
csv_file = jogobot.config["euroexchange"]["data_csv_filename"]
|
csv_file = jogobot.config["euroexchange"]["data_csv_filename"]
|
||||||
upload_comment = jogobot.config["euroexchange"]["upload_comment"]
|
upload_comment = jogobot.config["euroexchange"]["upload_comment"]
|
||||||
gnuplot_script_comment = jogobot.config["euroexchange"]["gnuplot_script_comment"]
|
gnuplot_script_comment = jogobot.config["euroexchange"]["gnuplot_script_comment"]
|
||||||
|
gnuplot_script_help = jogobot.config["euroexchange"]["gnuplot_script_help"]
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
import pywikibot
|
import pywikibot
|
||||||
import mwparserfromhell as mwparser
|
import mwparserfromhell as mwparser
|
||||||
@@ -85,6 +86,13 @@ class DescPageBot(pywikibot.bot.Bot):
|
|||||||
replace( "system(\"echo $OUTFILE\")",
|
replace( "system(\"echo $OUTFILE\")",
|
||||||
"'{}'".format (os.path.basename( self.job.image ) ) )
|
"'{}'".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
|
return gnuplot_script
|
||||||
|
|
||||||
def parse_page(self):
|
def parse_page(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user