diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-01-25 17:11:28 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-01-25 17:11:28 -0800 |
commit | 446583e3227cee14ed9c03531e135f6d9c962dd2 (patch) | |
tree | 7e6e00f2b8f7a08e7572d819e7eda2ae3cb7a1e9 /src/Text | |
parent | a5ac58f82fbcad86d62b3fb66188635b9763b961 (diff) | |
download | pandoc-446583e3227cee14ed9c03531e135f6d9c962dd2.tar.gz |
Texinfo writer: use header identifier for anchor if present.
Previously we were overwriting an existing identifier
with a new one. Closes #4731.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Texinfo.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs index 7bec145c5..ac2eceeab 100644 --- a/src/Text/Pandoc/Writers/Texinfo.hs +++ b/src/Text/Pandoc/Writers/Texinfo.hs @@ -225,14 +225,16 @@ blockToTexinfo (Header 0 _ lst) = do return $ text "@node Top" $$ text "@top " <> txt <> blankline -blockToTexinfo (Header level _ lst) +blockToTexinfo (Header level (ident,_,_) lst) | level < 1 || level > 4 = blockToTexinfo (Para lst) | otherwise = do node <- inlineListForNode lst txt <- inlineListToTexinfo lst idsUsed <- gets stIdentifiers opts <- gets stOptions - let id' = uniqueIdent (writerExtensions opts) lst idsUsed + let id' = if null ident + then uniqueIdent (writerExtensions opts) lst idsUsed + else ident modify $ \st -> st{ stIdentifiers = Set.insert id' idsUsed } sec <- seccmd level return $ if (level > 0) && (level <= 4) |