mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
e857f73bdc
commit
b17c20d980
|
@ -68,7 +68,6 @@ common shared-properties
|
||||||
, streaming
|
, streaming
|
||||||
, streaming-bytestring
|
, streaming-bytestring
|
||||||
, streaming-commons
|
, streaming-commons
|
||||||
, streaming-utils
|
|
||||||
, cryptonite
|
, cryptonite
|
||||||
, directory
|
, directory
|
||||||
, exceptions
|
, exceptions
|
||||||
|
|
|
@ -5,13 +5,27 @@ import HBS2.Git.Oracle.State
|
||||||
|
|
||||||
import Data.HashMap.Strict (HashMap)
|
import Data.HashMap.Strict (HashMap)
|
||||||
|
|
||||||
import Lucid (Html,HtmlT,toHtml,renderBS)
|
import Lucid (Html,HtmlT,toHtml,toHtmlRaw,renderBS)
|
||||||
import Lucid.Html5 hiding (for_)
|
import Lucid.Html5 hiding (for_)
|
||||||
|
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Data.Text qualified as Text
|
import Data.Text qualified as Text
|
||||||
import Data.ByteString.Lazy
|
import Data.ByteString.Lazy
|
||||||
import Control.Monad.Identity
|
import Text.Pandoc
|
||||||
|
import Text.Pandoc.Error (handleError)
|
||||||
|
|
||||||
|
|
||||||
|
markdownToHtml :: Text -> Either PandocError String
|
||||||
|
markdownToHtml markdown = runPure $ do
|
||||||
|
doc <- readMarkdown def {readerExtensions = pandocExtensions} markdown
|
||||||
|
html <- writeHtml5String def {writerExtensions = pandocExtensions} doc
|
||||||
|
return $ Text.unpack html
|
||||||
|
|
||||||
|
renderMarkdown :: Text -> Html ()
|
||||||
|
renderMarkdown markdown = case markdownToHtml markdown of
|
||||||
|
Left{} -> mempty
|
||||||
|
Right html -> toHtmlRaw $ Text.pack html
|
||||||
|
|
||||||
|
|
||||||
renderEntries :: Monad m => HashMap Text Text -> [(HashVal, Text, Text)] -> m ByteString
|
renderEntries :: Monad m => HashMap Text Text -> [(HashVal, Text, Text)] -> m ByteString
|
||||||
renderEntries _ items = pure $ renderBS do
|
renderEntries _ items = pure $ renderBS do
|
||||||
|
@ -25,8 +39,7 @@ renderEntries _ items = pure $ renderBS do
|
||||||
|
|
||||||
when ( Text.length n > 2) do
|
when ( Text.length n > 2) do
|
||||||
h3_ [class_ "repo-name"] (toHtml (show $ pretty n))
|
h3_ [class_ "repo-name"] (toHtml (show $ pretty n))
|
||||||
span_ [class_ "repo-reference"] (toHtml (show $ pretty h))
|
div_ [class_ "repo-reference"] (toHtml (show $ pretty h))
|
||||||
|
div_ [class_ "repo-brief"] do
|
||||||
-- td_ (toHtml (show $ pretty n))
|
renderMarkdown b
|
||||||
-- td_ (toHtml (show $ pretty b))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue