diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-04 13:25:49 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-04 13:25:49 -0800 |
commit | 6d239e74bc5d61cfdaaab195adde2558afa32301 (patch) | |
tree | 732ec3c5b95c22f5830539fec58d420723e69410 /specfilter.hs | |
parent | d948cb2b921ef0384015bbd432d8b7a7015fee11 (diff) |
Improved spec.pdf production.
Boldface definitions.
Diffstat (limited to 'specfilter.hs')
-rwxr-xr-x | specfilter.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/specfilter.hs b/specfilter.hs index 67c8fa5..7a7676b 100755 --- a/specfilter.hs +++ b/specfilter.hs @@ -1,11 +1,11 @@ #!/usr/bin/env runhaskell import Text.Pandoc.JSON -import Text.Pandoc.Walk +import Text.Pandoc.Generic main = toJSONFilter go where go :: Pandoc -> Pandoc - go = walk exampleDivs . walk anchors + go = bottomUp exampleDivs . bottomUp (concatMap anchors) exampleDivs :: Block -> Block exampleDivs (Div (ident, ["example"], kvs) @@ -30,8 +30,7 @@ exampleDivs (Div (ident, ["example"], kvs) else code exampleDivs x = x -anchors :: Inline -> Inline -anchors (RawInline (Format "html") ('<':'a':' ':'i':'d':'=':'"':xs)) = - RawInline (Format "latex") ("\\hyperdef{}{" ++ lab ++ "}{\\label{" ++ lab ++ "}}") - where lab = takeWhile (/='"') xs -anchors x = x +anchors :: Inline -> [Inline] +anchors (Link text ('@':lab,_)) = + [RawInline (Format "latex") ("\\hyperdef{}{" ++ lab ++ "}{\\label{" ++ lab ++ "}}"), Strong text] +anchors x = [x] |