aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-10-19 14:41:17 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-10-19 14:41:17 -0700
commitf63b610c015d356c403861686c0687edfaf17289 (patch)
tree899450025fa89b036ec1af6215b7056de052c2b9
parentf564b1ab8e6c8fe27c928fca6da7334fc6f69aa9 (diff)
Modified specfilter.hs to account for last change.
-rwxr-xr-xtools/specfilter.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/specfilter.hs b/tools/specfilter.hs
index 7f4df9f..304e463 100755
--- a/tools/specfilter.hs
+++ b/tools/specfilter.hs
@@ -1,6 +1,7 @@
#!/usr/bin/env runhaskell
import Text.Pandoc.JSON
+import Text.Pandoc.Walk
import Text.Pandoc.Generic
main = toJSONFilter go
@@ -10,20 +11,21 @@ main = toJSONFilter go
exampleDivs :: Block -> Block
exampleDivs (Div (ident, ["example"], kvs)
[ d@(Div (_,["examplenum"],_) _),
- c1@(CodeBlock (_,["markdown"],_) _),
- c2@(CodeBlock (_,["html"],_) _)
+ d1@(Div (_,["column"],_) _),
+ d2@(Div (_,["column"],_) _)
]) = Div (ident, ["example"], kvs)
[ rawtex "\\begin{minipage}[t]{\\textwidth}\n{\\scriptsize "
, d
, rawtex "}\\vspace{-0.4em}\n"
, rawtex "\\begin{minipage}[t]{0.49\\textwidth}\n\\definecolor{shadecolor}{gray}{0.85}\n\\begin{snugshade}\\small\n"
- , addBreaks c1
+ , walk addBreaks d1
, rawtex "\\end{snugshade}\n\\end{minipage}\n\\hfill\n\\begin{minipage}[t]{0.49\\textwidth}\n\\definecolor{shadecolor}{gray}{0.95}\n\\begin{snugshade}\\small\n"
- , addBreaks c2
+ , walk addBreaks d2
, rawtex "\\end{snugshade}\n\\end{minipage}\n\\end{minipage}"
]
where rawtex = RawBlock (Format "latex")
addBreaks (CodeBlock attrs code) = CodeBlock attrs $ addBreaks' code
+ addBreaks x = x
addBreaks' code =
if length code > 49
then take 49 code ++ ('\n':addBreaks' (drop 49 code))