[>=1.7.0] Crash for latex inline mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Reproduce the crash with the attached id_000007.txt and the shown ansi2html --latex --inline command. Start in converter.py at _handle_ansi_code, where the traceback shows the KeyError for ansi38, then trace the inline LaTeX path. Done means this input completes without crashing.
Written by the indexing model from the issue text.
Description
The input file as following:
id_000007.txt
run with command:
$ cat id_000007.txt | ansi2html --latex --inline
crash with the error:
$ cat output/crashes/id:000007* | ansi2html --latex --inline
Traceback (most recent call last):
File "/home/xxx/Workspace/.venv/bin/ansi2html", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 815, in main
output = conv.convert(
^^^^^^^^^^^^^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 627, in convert
attrs = self.prepare(ansi, ensure_trailing_newline=ensure_trailing_newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 604, in prepare
body, styles = self.apply_regex(ansi)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 353, in apply_regex
no_cursor_parts = self._collapse_cursor(all_parts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 574, in _collapse_cursor
for part in parts:
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 430, in _apply_regex
yield from self._handle_ansi_code(part, styles_used, state)
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 547, in _handle_ansi_code
style = [
^
File "/home/xxx/Workspace/.venv/lib/python3.11/site-packages/ansi2html/converter.py", line 550, in <listcomp>
if self.styles[klass].kwl[0][0] == "color"
~~~~~~~~~~~^^^^^^^
KeyError: 'ansi38'
### Tasks
- Dominant language
- Python
- Stars
- 425
- Forks
- 85
- Avg merge
- 7h 49m
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pycontribs/ansi2html
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
pycontribs/ansi2html#257 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
pycontribs/ansi2html#254 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
pycontribs/ansi2html#249 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
pycontribs/ansi2html#245 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
pycontribs/ansi2html#242 · 2 comments ·
All issues in pycontribs/ansi2html
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100