diff options
| author | Iñaki García Etxebarria <git@inaki.blueleaf.cc> | 2019-07-31 16:28:00 +0100 | 
|---|---|---|
| committer | Hécate Moonlight <hecate+github@glitchbra.in> | 2021-02-07 16:13:04 +0100 | 
| commit | c31c156422785751e33c9a7a4f021ac8da77d364 (patch) | |
| tree | 40f8bc9066d9d96fa00163b10ac85d7645ad01d2 /haddock-api/src/Haddock/Backends/LaTeX.hs | |
| parent | a2f9f297d17059b3fc68ce4a245702278a5d8340 (diff) | |
Add support for labeled module references
Support a markdown-style way of annotating module references. For instance
-- | [label]("Module.Name#anchor")
will create a link that points to the same place as the module
reference "Module.Name#anchor" but the text displayed on the link will
be "label".
Diffstat (limited to 'haddock-api/src/Haddock/Backends/LaTeX.hs')
| -rw-r--r-- | haddock-api/src/Haddock/Backends/LaTeX.hs | 7 | 
1 files changed, 6 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index df81fd6e..2371695f 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -1210,7 +1210,12 @@ latexMarkup = Markup    , markupAppend               = \l r v -> l v . r v    , markupIdentifier           = \i v -> inlineElem (markupId v (fmap occName i))    , markupIdentifierUnchecked  = \i v -> inlineElem (markupId v (fmap snd i)) -  , markupModule               = \m _ -> inlineElem (let (mdl,_ref) = break (=='#') m in (tt (text mdl))) +  , markupModule               = +      \(ModLink m mLabel) v -> +        case mLabel of +          Just lbl -> inlineElem . tt $ lbl v empty +          Nothing -> inlineElem (let (mdl,_ref) = break (=='#') m +                                 in (tt (text mdl)))    , markupWarning              = \p v -> p v    , markupEmphasis             = \p v -> inlineElem (emph (p v empty))    , markupBold                 = \p v -> inlineElem (bold (p v empty))  | 
