Mercurial > repos > fubar > tool_factory_2
diff toolfactory/rgToolFactory2.py @ 110:ab2474035f81 draft
Uploaded
author | fubar |
---|---|
date | Sun, 29 Nov 2020 06:16:34 +0000 |
parents | 0116bfe0fa5e |
children | 223b78754735 |
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py Sun Nov 29 04:49:52 2020 +0000 +++ b/toolfactory/rgToolFactory2.py Sun Nov 29 06:16:34 2020 +0000 @@ -120,11 +120,11 @@ def html_escape(text): """Produce entities within text.""" - return "".join(html_escape_table.get(c, c) for c in text) + return "".join([html_escape_table.get(c, c) for c in text]) def cheetah_escape(text): """Produce entities within text.""" - return "".join(cheetah_escape_table.get(c, c) for c in text) + return "".join([cheetah_escape_table.get(c, c) for c in text]) def html_unescape(text): @@ -296,9 +296,10 @@ tscript.write(self.script) tscript.close() self.escapedScript = [cheetah_escape(x) for x in rx] + self.spacedScript = [f" {x}" for x in self.escapedScript] art = "%s.%s" % (self.tool_name, self.executeme) artifact = open(art, "wb") - artifact.write(bytes(self.escapedScript, "utf8")) + artifact.write(bytes('\n'.join(self.escapedScript),'utf8')) artifact.close() def cleanuppar(self): @@ -573,18 +574,16 @@ helptext = open(self.args.help_text, "r").readlines() safertext = "\n".join([cheetah_escape(x) for x in helptext]) if self.args.script_path: - scr = self.escapedScript - scrpt = [' %s' % x for x in scrpt if x.strip() > ''] # indent - scrpt.insert(0,'------\n\nScript::\n') - if len(scrpt) > 300: - safertext = ( - safertext - + scrpt[:100] - + [">500 lines - stuff deleted", "......"] - + scrpt[-100:] + scr = [x for x in self.spacedScript if x.strip() > ""] + scr.insert(0,'\n------\n\nScript::\n') + if len(scr) > 300: + scr = ( + scr[:100] + + [">300 lines - stuff deleted", "......"] + + scr[-100:] ) - else: - safertext = safertext + "\n".join(scrpt) + scr.append('\n------\n') + safertext = safertext + "\n".join(scr) self.newtool.help = safertext else: self.newtool.help = (