aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-07-18 22:08:37 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-18 22:08:37 -0700
commit5c655e86d5d34172bc5892927309d8dff6023493 (patch)
treedd9abef88ac06f572274de54b3a30b847cbd23ae /src/Text
parent4d65bbf0dfac37c91214ebfb502481aa1c20c8be (diff)
downloadpandoc-5c655e86d5d34172bc5892927309d8dff6023493.tar.gz
HTML writer: ensure that line numbers in code blocks get id-prefix.
Closes #5650.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 241479157..a0f6f17f0 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -776,8 +776,8 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
then do
modify $ \st -> st{ stCodeBlockNum = stCodeBlockNum st + 1 }
codeblocknum <- gets stCodeBlockNum
- return ("cb" ++ show codeblocknum)
- else return id'
+ return (writerIdentifierPrefix opts ++ "cb" ++ show codeblocknum)
+ else return (writerIdentifierPrefix opts ++ id')
let tolhs = isEnabled Ext_literate_haskell opts &&
any (\c -> map toLower c == "haskell") classes &&
any (\c -> map toLower c == "literate") classes
@@ -800,7 +800,9 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
addAttrs opts (id',classes,keyvals)
$ H.pre $ H.code $ toHtml adjCode
Right h -> modify (\st -> st{ stHighlighting = True }) >>
- addAttrs opts (id'',[],keyvals) h
+ -- we set writerIdentifierPrefix to "" since id'' already
+ -- includes it:
+ addAttrs opts{writerIdentifierPrefix = ""} (id'',[],keyvals) h
blockToHtml opts (BlockQuote blocks) = do
-- in S5, treat list in blockquote specially
-- if default is incremental, make it nonincremental;