diff options
| author | Jan Tojnar <jtojnar@gmail.com> | 2022-02-06 23:05:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-06 23:05:20 +0100 |
| commit | 876859f9e95ba2dd2de2f197caf53184700ec335 (patch) | |
| tree | 4f3f80146088a66b7d6b4ac91a1781640bd5619b /src | |
| parent | faf99ad356ab828958a7b48c55e8c23a97f1c36d (diff) | |
Docbook writer: Interpret links without contents as cross-references (#7360)
Links without text contents are converted to `<xref>` elements. DocBook
processors will generate appropriate cross-reference text when presented
with an xref element.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/Docbook.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 2ab730a0c..1697b201c 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -429,7 +429,9 @@ inlineToDocbook opts (Link attr txt (src, _)) | otherwise = do version <- ask (if "#" `T.isPrefixOf` src - then inTags False "link" $ ("linkend", writerIdentifierPrefix opts <> T.drop 1 src) : idAndRole attr + then let tag = if null txt then "xref" else "link" + in inTags False tag $ + ("linkend", writerIdentifierPrefix opts <> T.drop 1 src) : idAndRole attr else if version == DocBook5 then inTags False "link" $ ("xlink:href", src) : idAndRole attr else inTags False "ulink" $ ("url", src) : idAndRole attr ) |
