diff options
Diffstat (limited to 'becommands/html.py')
-rw-r--r-- | becommands/html.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/becommands/html.py b/becommands/html.py index 908c714..0ddbb6c 100644 --- a/becommands/html.py +++ b/becommands/html.py @@ -49,9 +49,15 @@ def execute(args, manipulate_encodings=True): cmdutil.default_complete(options, args, parser, bugid_args={0: lambda bug : bug.active==False}) + if len(args) == 0: out_dir = options.outdir - print "Creating the html output in %s"%out_dir + css_file = options.css_file + if css_file == None: + _css_file = "default" + else: + _css_file = css_file + print "Creating the html output in %s using %s style"%(out_dir, _css_file) else: out_dir = args[0] if len(args) > 0: @@ -80,14 +86,16 @@ def execute(args, manipulate_encodings=True): ordered_bug_list_in = sorted([(value,key) for (key,value) in stime.items()]) #open_bug_list = sorted([(value,key) for (key,value) in bugs.items()]) - html_gen = BEHTMLGen(bd) + html_gen = BEHTMLGen(bd, css_file) html_gen.create_index_file(out_dir, st, bugs_active, ordered_bug_list, "active", bd.encoding) html_gen.create_index_file(out_dir, st, bugs_inactive, ordered_bug_list, "inactive", bd.encoding) def get_parser(): parser = cmdutil.CmdOptionParser("be open OUTPUT_DIR") parser.add_option("-o", "--output", metavar="export_dir", dest="outdir", - help="Set the output path, default is ./html_export", default="html_export") + help="Set the output path, default is ./html_export", default="html_export") + parser.add_option("-s", "--css-file", metavar="css_file", dest="css_file", + help="Use a different css file, default is empty", default=None) return parser longhelp=""" @@ -116,10 +124,10 @@ def escape(string): return "".join(chars) class BEHTMLGen(): - def __init__(self, bd): + def __init__(self, bd, template): self.index_value = "" self.bd = bd - + self.css_file = """ body { font-family: "lucida grande", "sans serif"; @@ -473,8 +481,13 @@ class BEHTMLGen(): <div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a>.</div> </body> </html> - """ + """ + if template != None: + FO = open(template) + newCss = FO.read() + FO.close() + self.css_file = newCss def create_index_file(self, out_dir_path, summary, bugs, ordered_bug, fileid, encoding): try: |