git.iko.soy/typeable/pandoc
on master help sign in
Texinfo writer: use header identifier for anchor if present.

Previously we were overwriting an existing identifier with a new one. Closes #4731.

commit446583e3227cee14ed9c03531e135f6d9c962dd2 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 25 Jan 2019, 17:11 (8 years ago) parenta5ac58f
1 file changed+4−2
src/Text/Pandoc/Writers/Texinfo.hs+4−2
src/Text/Pandoc/Writers/Texinfo.hs+4−2
@@ -225,14 +225,16 @@ blockToTexinfo (Header 0 _ lst) = do
225225 return $ text "@node Top" $$
226226 text "@top " <> txt <> blankline
227227
228−blockToTexinfo (Header level _ lst)
228+blockToTexinfo (Header level (ident,_,_) lst)
229229 | level < 1 || level > 4 = blockToTexinfo (Para lst)
230230 | otherwise = do
231231 node <- inlineListForNode lst
232232 txt <- inlineListToTexinfo lst
233233 idsUsed <- gets stIdentifiers
234234 opts <- gets stOptions
235− let id' = uniqueIdent (writerExtensions opts) lst idsUsed
235+ let id' = if null ident
236+ then uniqueIdent (writerExtensions opts) lst idsUsed
237+ else ident
236238 modify $ \st -> st{ stIdentifiers = Set.insert id' idsUsed }
237239 sec <- seccmd level
238240 return $ if (level > 0) && (level <= 4)