git.iko.soy/typeable/pandoc
on master help sign in
typeable/pandoc/tools/extract-changes.hs
15 lines 419 B history raw
1#!/usr/bin/env stack
2-- stack --stack-yaml=stack.yaml runghc --package pandoc-types
4-- Extract changes from latest version in changelog.
5import Text.Pandoc.JSON
7main = toJSONFilter extractFirst
9extractFirst :: Pandoc -> Pandoc
10extractFirst (Pandoc meta bs) =
11 let bs' = dropWhile (not . isSubhead) bs
12 in Pandoc meta (takeWhile (not . isSubhead) (drop 1 bs'))
14isSubhead (Header 2 _ _) = True
15isSubhead _ = False