Skip to content

Commit

Permalink
Fixed unicode escape problem. Fixes https://travis-ci.org/ralphbean/a…
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Schneider committed May 29, 2014
1 parent a0a06b4 commit 095eca5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions ansi2html/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@


# http://stackoverflow.com/a/15190498
_latex_template = '''\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{red-sd}{HTML}{7ed2d2}
_latex_template = '''\\documentclass{scrartcl}
\\usepackage[utf8]{inputenc}
\\usepackage{fancyvrb}
\\usepackage[usenames,dvipsnames]{xcolor}
% \\definecolor{red-sd}{HTML}{7ed2d2}
\\title{%(title)s}
Expand All @@ -78,8 +78,8 @@
\\begin{Verbatim}
%(content)s
\end{Verbatim}
\end{document}
\\end{Verbatim}
\\end{document}
'''

_html_template = six.u("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Expand Down Expand Up @@ -177,7 +177,7 @@ def append_color_unless_default(output, color, default, negative, neg_css_class)
def linkify(line, latex_mode):
for match in re.findall(r'https?:\/\/\S+', line):
if latex_mode:
line = line.replace(match, '\url{%s}' % match)
line = line.replace(match, '\\url{%s}' % match)
else:
line = line.replace(match, '<a href="%s">%s</a>' % (match, match))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ansi2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def test_latex_title(self):

def test_latex_linkify(self):
ansi = 'http://python.org/'
target = '\url{%s}' % ansi
target = '\\url{%s}' % ansi
latex = Ansi2HTMLConverter(latex=True, inline=True, linkify=True).convert(ansi)
assert(target in latex)

Expand Down

0 comments on commit 095eca5

Please sign in to comment.