"Fossies" - the Fresh Open Source Software Archive

Member "pandoc-2.18/tools/extract-changes.hs" (4 Apr 2022, 419 Bytes) of package /linux/www/pandoc-2.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Haskell source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env stack
    2 -- stack --stack-yaml=stack.yaml runghc --package pandoc-types
    3 
    4 -- Extract changes from latest version in changelog.
    5 import Text.Pandoc.JSON
    6 
    7 main = toJSONFilter extractFirst
    8 
    9 extractFirst :: Pandoc -> Pandoc
   10 extractFirst (Pandoc meta bs) =
   11   let bs' = dropWhile (not . isSubhead) bs
   12    in Pandoc meta (takeWhile (not . isSubhead) (drop 1 bs'))
   13 
   14 isSubhead (Header 2 _ _) = True
   15 isSubhead _ = False