mirror of
https://github.com/srid/rib.git
synced 2024-11-30 03:45:00 +03:00
Merge pull request #41 from srid/obelisk-friendly
Extend rib to work with reflex projects
This commit is contained in:
commit
cfe371bbe7
@ -2,6 +2,9 @@
|
||||
|
||||
## 0.4.0.0 (UNRELEASED)
|
||||
|
||||
- `Rib.Pandoc`: Export `render'` and `renderInlines'` (the non-Lucid versions)
|
||||
- `Rib.Pandoc`: Re-export `Text.Pandoc.Readers` so the library user does not
|
||||
have to directly depend on `pandoc` only to render its documents.
|
||||
- `Rib.App`: The `run` funtion now takes two more arguments, specifying the input and output directory, which are no longer hardcoded.
|
||||
- `Rib.Simple`: add LaTeX to default list of readers
|
||||
|
||||
|
13
rib.cabal
13
rib.cabal
@ -39,26 +39,25 @@ library
|
||||
binary >=0.8.6 && <0.9,
|
||||
text >=1.2.3 && <1.3,
|
||||
time >=1.8.0 && <1.9,
|
||||
async >=2.2.2 && <2.3,
|
||||
async,
|
||||
clay >=0.13.1 && <0.14,
|
||||
mtl >=2.2.2 && <2.3,
|
||||
cmdargs >=0.10.20 && <0.11,
|
||||
data-default >=0.7.1 && <0.8,
|
||||
fsnotify >=0.3.0 && <0.4,
|
||||
http-types >=0.12.3 && <0.13,
|
||||
lens >=4.17.1 && <4.18,
|
||||
lens,
|
||||
lens-aeson >=1.0.2 && <1.1,
|
||||
lucid >=2.9.11 && <2.10,
|
||||
pandoc >=2.7.3 && <2.8,
|
||||
pandoc-types >=1.17.5 && <1.18,
|
||||
safe >=0.3.17 && <0.4,
|
||||
skylighting >=0.8.1 && <0.9,
|
||||
skylighting,
|
||||
pandoc-include-code >=1.4.0 && <1.5,
|
||||
shake >=0.18.3 && <0.19,
|
||||
shake,
|
||||
wai >=3.2.2 && <3.3,
|
||||
wai-app-static >=3.1.6 && <3.2,
|
||||
wai-extra >=3.0.26 && <3.1,
|
||||
warp >=3.2.28 && <3.3,
|
||||
wai-extra,
|
||||
warp,
|
||||
base >=4.7 && <5,
|
||||
pandoc >=2.7 && <3,
|
||||
directory >= 1.0 && <2.0
|
||||
|
@ -5,13 +5,15 @@
|
||||
|
||||
-- | Helpers for working with Pandoc documents
|
||||
module Rib.Pandoc
|
||||
(
|
||||
( module Text.Pandoc.Readers
|
||||
-- * Parsing
|
||||
parse
|
||||
, parse
|
||||
, parsePure
|
||||
-- * Converting to HTML
|
||||
, render
|
||||
, renderInlines
|
||||
, render'
|
||||
, renderInlines'
|
||||
-- * Metadata
|
||||
, getMeta
|
||||
, setMeta
|
||||
@ -31,9 +33,10 @@ import qualified Data.Text as T
|
||||
import Lucid (Html, toHtmlRaw)
|
||||
import Text.Pandoc
|
||||
import Text.Pandoc.Filter.IncludeCode (includeCode)
|
||||
import Text.Pandoc.Readers
|
||||
import Text.Pandoc.Readers.Markdown (yamlToMeta)
|
||||
import Text.Pandoc.Shared (stringify)
|
||||
import Text.Pandoc.Walk (walkM, query)
|
||||
import Text.Pandoc.Walk (query, walkM)
|
||||
|
||||
|
||||
class IsMetaValue a where
|
||||
@ -109,6 +112,7 @@ parseMeta = either (error . show) pure <=< runIO . yamlToMeta settings
|
||||
where
|
||||
settings = def { readerExtensions = exts }
|
||||
|
||||
-- | Like `render` but returns the raw HTML string, or the rendering error.
|
||||
render' :: Pandoc -> Either PandocError Text
|
||||
render' = runPure . writeHtml5String settings
|
||||
where
|
||||
@ -118,6 +122,7 @@ render' = runPure . writeHtml5String settings
|
||||
render :: Pandoc -> Html ()
|
||||
render = either (error . show) toHtmlRaw . render'
|
||||
|
||||
-- | Like `renderInlines` but returns the raw HTML string, or the rendering error.
|
||||
renderInlines' :: [Inline] -> Either PandocError Text
|
||||
renderInlines' = render' . Pandoc mempty . pure . Plain
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user