diff options
author | Maximilian Hils <github@maximilianhils.com> | 2022-01-31 21:59:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-31 21:59:04 +0100 |
commit | b1edee0c8f736276a86e30d8edaed1f581e009d0 (patch) | |
tree | 70a48355522a0030396547b40553acb5bc2ac9b3 /tests/test_html_formatter.py | |
parent | 405b9e4936f54a6cc6e67f5c47df0b9ae7aaca7f (diff) | |
download | pygments-git-b1edee0c8f736276a86e30d8edaed1f581e009d0.tar.gz |
When using the HTML formatter with `linespans=foo`, `linenos=inline`, and `anchorlinenos=True`, (#2026)
the generated anchor links should be `#foo-42` and not `#-42`.
Diffstat (limited to 'tests/test_html_formatter.py')
-rw-r--r-- | tests/test_html_formatter.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index ac73b616..e1a02b24 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -93,6 +93,14 @@ def test_all_options(): check(optdict) +def test_linespans(): + outfile = StringIO() + fmt = HtmlFormatter(linespans='L', anchorlinenos=True, linenos="inline") + fmt.format(tokensource, outfile) + html = outfile.getvalue() + assert re.search(r"""<span id="L-1">\s*<a href="#L-1"><span\s*class="linenos">\s*1</span></a>""", html) + + def test_lineanchors(): optdict = dict(lineanchors="foo") outfile = StringIO() |