Skip to content

Commit

Permalink
add option --title for filling in the title
Browse files Browse the repository at this point in the history
  • Loading branch information
CBke committed Oct 20, 2013
1 parent aab8348 commit 007e77c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ansi2html/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%(output_encoding)s">
<title></title>
<title>%(title)s</title>
<style type="text/css">\n%(style)s\n</style>
</head>
<body class="body_foreground body_background" style="font-size: %(font_size)s;" >
Expand Down Expand Up @@ -189,7 +189,8 @@ def __init__(self,
escaped=True,
markup_lines=False,
output_encoding='utf-8',
scheme='ansi2html'
scheme='ansi2html',
title=''
):

self.inline = inline
Expand All @@ -200,6 +201,7 @@ def __init__(self,
self.markup_lines = markup_lines
self.output_encoding = output_encoding
self.scheme = scheme
self.title = title
self._attrs = None

if inline:
Expand Down Expand Up @@ -369,6 +371,7 @@ def convert(self, ansi, full=True, ensure_trailing_newline=False):
else:
return _template % {
'style' : "\n".join(map(str, get_styles(self.dark_bg, self.scheme))),
'title' : self.title,
'font_size' : self.font_size,
'content' : attrs["body"],
'output_encoding' : self.output_encoding,
Expand Down Expand Up @@ -437,6 +440,10 @@ def main():
default='ansi2html', choices=scheme_names,
help=("Specify color palette scheme. Default: %%default. Choices: %s"
% scheme_names))
parser.add_option(
'-t', '--title', dest='output_title',
default='',
help="Specify output title")

opts, args = parser.parse_args()

Expand All @@ -449,6 +456,7 @@ def main():
markup_lines=opts.markup_lines,
output_encoding=opts.output_encoding,
scheme=opts.scheme,
title=opts.output_title,
)

def _read(input_bytes):
Expand Down

0 comments on commit 007e77c

Please sign in to comment.