Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash for --latex and italic ^[[3m #127

Open
sedrubal opened this issue Apr 8, 2021 · 0 comments
Open

Crash for --latex and italic ^[[3m #127

sedrubal opened this issue Apr 8, 2021 · 0 comments
Labels
bug This issue/PR relates to a bug.

Comments

@sedrubal
Copy link

sedrubal commented Apr 8, 2021

Using this example file: italic.txt

$ cat italic.txt | ansi2html --latex --inline

Crashes with this traceback:

Traceback (most recent call last):
  File "/usr/bin/ansi2html", line 33, in <module>
    sys.exit(load_entry_point('ansi2html==1.6.0', 'console_scripts', 'ansi2html')())
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 696, in main
    output = conv.convert(
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 507, in convert
    attrs = self.prepare(ansi, ensure_trailing_newline=ensure_trailing_newline)
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 485, in prepare
    body, styles = self.apply_regex(ansi)
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 300, in apply_regex
    parts = self._collapse_cursor(parts)
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 461, in _collapse_cursor
    for part in parts:
  File "/usr/lib/python3.9/site-packages/ansi2html/converter.py", line 434, in _apply_regex
    yield "\\textcolor[HTML]{%s}{" % style[0]
IndexError: list index out of range
@hartwork hartwork added the bug This issue/PR relates to a bug. label Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants