summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2021-12-06 17:51:56 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2021-12-06 17:51:56 +0100
commitd15da3149270c11d67677b31d455ea557b3a3492 (patch)
tree09ec9b45896ca748ed3c8073a0e48482afa9df6b
parent8d3c775500b01cb8a6bc1700637bc18588bf29db (diff)
parentb5dc79a786c61a77b8e1fbceea3497bfe31ae3ee (diff)
downloadpygments-git-d15da3149270c11d67677b31d455ea557b3a3492.tar.gz
Merge branch 'master' of https://github.com/dschwoerer/pygments into dschwoerer-master
-rw-r--r--pygments/formatters/html.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 3029c1cc..f9588f78 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -765,7 +765,8 @@ class HtmlFormatter(Formatter):
for t, line in inner:
if t:
i += 1
- yield 1, '<a id="%s-%d" name="%s-%d"></a>' % (s, i, s, i) + line
+ href = "" if self.linenos else ' href="%s-%d"' % (s, i)
+ yield 1, '<a id="%s-%d" name="%s-%d"%s></a>' % (s, i, s, i, href) + line
else:
yield 0, line