From fed6a57f30ecdbcf4805b1900dd0f164856c1163 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 12 Jan 2015 20:36:22 -0800 Subject: Moved templates, makespec.py, and specfilter.hs -> tools/. --- specfilter.hs | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100755 specfilter.hs (limited to 'specfilter.hs') diff --git a/specfilter.hs b/specfilter.hs deleted file mode 100755 index 7a7676b..0000000 --- a/specfilter.hs +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env runhaskell - -import Text.Pandoc.JSON -import Text.Pandoc.Generic - -main = toJSONFilter go - where go :: Pandoc -> Pandoc - go = bottomUp exampleDivs . bottomUp (concatMap anchors) - -exampleDivs :: Block -> Block -exampleDivs (Div (ident, ["example"], kvs) - [ d@(Div (_,["examplenum"],_) _), - c1@(CodeBlock (_,["markdown"],_) _), - c2@(CodeBlock (_,["html"],_) _) - ]) = Div (ident, ["example"], kvs) - [ rawtex "\\begin{minipage}[t]{\\textwidth}\n{\\scriptsize " - , d - , rawtex "\\vspace{-1em}}" - , rawtex "\\begin{minipage}[t]{0.49\\textwidth}\n\\definecolor{shadecolor}{gray}{0.85}\n" - , addBreaks c1 - , rawtex "\\end{minipage}\n\\hfill\n\\begin{minipage}[t]{0.49\\textwidth}\n\\definecolor{shadecolor}{gray}{0.95}\n" - , addBreaks c2 - , rawtex "\\end{minipage}\n\\end{minipage}" - ] - where rawtex = RawBlock (Format "latex") - addBreaks (CodeBlock attrs code) = CodeBlock attrs $ addBreaks' code - addBreaks' code = - if length code > 49 - then take 49 code ++ ('\n':addBreaks' (drop 49 code)) - else code -exampleDivs x = x - -anchors :: Inline -> [Inline] -anchors (Link text ('@':lab,_)) = - [RawInline (Format "latex") ("\\hyperdef{}{" ++ lab ++ "}{\\label{" ++ lab ++ "}}"), Strong text] -anchors x = [x] -- cgit v1.2.3