2019-11-22 18:33:32 +01:00
|
|
|
#!/usr/bin/env stack
|
|
|
|
-- stack --stack-yaml=stack.yaml runghc --package pandoc-types
|
|
|
|
|
2015-11-15 17:17:09 +01:00
|
|
|
-- Extract changes from latest version in changelog.
|
|
|
|
import Text.Pandoc.JSON
|
|
|
|
|
|
|
|
main = toJSONFilter extractFirst
|
|
|
|
|
|
|
|
extractFirst :: Pandoc -> Pandoc
|
2019-11-22 18:42:04 +01:00
|
|
|
extractFirst (Pandoc meta bs) =
|
|
|
|
let bs' = dropWhile (not . isSubhead) bs
|
|
|
|
in Pandoc meta (takeWhile (not . isSubhead) (drop 1 bs'))
|
|
|
|
|
|
|
|
isSubhead (Header 2 _ _) = True
|
|
|
|
isSubhead _ = False
|