pandoc-sidenote-0.19.0.0/ 0000755 0000000 0000000 00000000000 13144145446 013207 5 ustar 00 0000000 0000000 pandoc-sidenote-0.19.0.0/LICENSE 0000644 0000000 0000000 00000002072 13144145446 014215 0 ustar 00 0000000 0000000 The MIT License (MIT) Copyright (c) 2016 Jacob Zimmerman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pandoc-sidenote-0.19.0.0/Main.hs 0000644 0000000 0000000 00000000231 13144145446 014423 0 ustar 00 0000000 0000000 module Main where import Text.Pandoc.SideNote (usingSideNotes) import Text.Pandoc.JSON (toJSONFilter) main :: IO () main = toJSONFilter usingSideNotes pandoc-sidenote-0.19.0.0/pandoc-sidenote.cabal 0000644 0000000 0000000 00000002254 13144145446 017252 0 ustar 00 0000000 0000000 name: pandoc-sidenote version: 0.19.0.0 synopsis: Convert Pandoc Markdown-style footnotes into sidenotes description: Convert Pandoc Markdown-style footnotes into sidenotes homepage: https://github.com/jez/pandoc-sidenote#readme license: MIT license-file: LICENSE author: Jake Zimmerman maintainer: zimmerman.jake@gmail.com copyright: 2016 Jake Zimmerman category: CommandLine build-type: Simple -- extra-source-files: cabal-version: >=1.10 Library Exposed-modules: Text.Pandoc.SideNote hs-source-dirs: src build-depends: base < 5 , monad-gen , pandoc , pandoc-types default-language: Haskell2010 executable pandoc-sidenote hs-source-dirs: ./ main-is: Main.hs ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base < 5 , pandoc-sidenote , pandoc-types default-language: Haskell2010 source-repository head type: git location: https://github.com/jez/pandoc-sidenote pandoc-sidenote-0.19.0.0/Setup.hs 0000644 0000000 0000000 00000000056 13144145446 014644 0 ustar 00 0000000 0000000 import Distribution.Simple main = defaultMain pandoc-sidenote-0.19.0.0/src/ 0000755 0000000 0000000 00000000000 13144145446 013776 5 ustar 00 0000000 0000000 pandoc-sidenote-0.19.0.0/src/Text/ 0000755 0000000 0000000 00000000000 13144145446 014722 5 ustar 00 0000000 0000000 pandoc-sidenote-0.19.0.0/src/Text/Pandoc/ 0000755 0000000 0000000 00000000000 13144145446 016126 5 ustar 00 0000000 0000000 pandoc-sidenote-0.19.0.0/src/Text/Pandoc/SideNote.hs 0000644 0000000 0000000 00000004565 13144145446 020206 0 ustar 00 0000000 0000000 {-# LANGUAGE FlexibleContexts #-} module Text.Pandoc.SideNote (usingSideNotes) where import Data.List (intercalate) import Control.Monad.Gen import Text.Pandoc.Walk (walk, walkM) import Text.Pandoc.JSON getFirstStr :: [Inline] -> Maybe String getFirstStr [] = Nothing getFirstStr (Str text : _) = Just text getFirstStr (_ : inlines) = getFirstStr inlines newline :: [Inline] newline = [LineBreak, LineBreak] -- Extract inlines from blocks coerceToInline :: [Block] -> [Inline] coerceToInline = concatMap deBlock . walk deNote where deBlock :: Block -> [Inline] deBlock (Plain ls) = ls -- Simulate paragraphs with double LineBreak deBlock (Para ls) = ls ++ newline -- See extension: line_blocks deBlock (LineBlock lss) = intercalate [LineBreak] lss ++ newline -- Pretend RawBlock is RawInline (might not work!) -- Consider: raw