informative 0.1.0.20 → 0.1.0.27
raw patch · 5 files changed
+91/−16 lines, 5 filesdep ~containersdep ~csvdep ~highlighting-kate
Dependency ranges changed: containers, csv, highlighting-kate, http-conduit, monad-logger, persistent, persistent-postgresql, shakespeare, text, time, time-locale-compat, yesod, yesod-auth, yesod-core, yesod-form
Files
- Web/Informative.hs +13/−1
- informative-edit.htm +3/−0
- informative.cabal +36/−3
- informative.css +36/−12
- informative.htm +3/−0
Web/Informative.hs view
@@ -22,6 +22,7 @@ import Text.Highlighting.Kate.Format.HTML import Text.Highlighting.Kate.Types import qualified Text.Pandoc as P+import qualified Text.Pandoc.Error as PE import Web.Informative.Data import Yesod hiding (languages) import Yesod.Auth@@ -59,6 +60,7 @@ UniqueSugg page segment |] +readFmt :: TextFormat -> P.ReaderOptions -> String -> Either PE.PandocError P.Pandoc readFmt Markdown = P.readMarkdown readFmt MediaWiki = P.readMediaWiki readFmt ReStructuredText = P.readRST@@ -67,7 +69,10 @@ convFmt :: TextFormat -> String -> Html convFmt Plain = toHtml convFmt (Source lg ln) = toHtml . formatHtmlBlock defaultFormatOpts{numberLines=True,startNumber=ln,containerClasses=["sourceCode","source-"<>toClassname lg],codeClasses=["source-"<>toClassname lg]} . highlightAs (T.unpack lg)-convFmt fmt = preEscapedToMarkup . P.writeHtml P.def{P.writerHtml5=True,P.writerHighlight=True,P.writerListings=True} . readFmt fmt P.def{P.readerSmart=True,P.readerExtensions=extensions}+convFmt fmt = \t ->+ case readFmt fmt P.def{P.readerSmart=True,P.readerExtensions=extensions} t of+ Right f -> preEscapedToMarkup $ P.writeHtml P.def{P.writerHtml5=True,P.writerHighlight=True,P.writerListings=True} f+ Left f -> "<Conversion failed>" extensions = fromList [ P.Ext_literate_haskell, P.Ext_fenced_code_blocks,@@ -96,6 +101,13 @@ fmtLine _ = 1 toClassname = filter isAlphaNum . T.unpack remCR = filter (/=chr 13)+prettify "haskell" = "Haskell"+prettify "php" = "PHP"+prettify "cs" = "C#"+prettify s = s+splitcode c | take 8 c == "#+title:" =+ (dropWhile (==' ') $ drop 8 $ head $ lines c, unlines $ tail $ lines c)+splitcode c = ("", c) renderShowArticle :: YesodWikiAuth master => [Entity Wikisugg] -> Bool -> (AuthRoute -> Route master) -> (Route Informative -> Route master) -> AuthResult -> Maybe Html -> [(Int,(T.Text,Either Html [[Html]],TextKind,TextFormat))] -> [(T.Text,T.Text,UTCTime)] -> T.Text -> HandlerT Informative (HandlerT master IO) Html renderShowArticle suggs loggedIn authR toParent mayEdit mmsg sects edits page = do
informative-edit.htm view
@@ -19,6 +19,9 @@ $case (sect, kind, fmt) $of (Left c, Article, Source lg ln) <div .sourceContent .source-#{toClassname lg}>+ <div .titlehead>+ <div .langhead>+ #{prettify $ toClassname lg} #{c} $of (Left c, Article, _) <div .content>
informative.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.20+version: 0.1.0.27 -- A short (one-line) description of the package. synopsis: A yesod subsite serving a wiki.@@ -59,7 +59,23 @@ -- other-extensions: -- Other library packages from which modules are imported.- build-depends: base >=4.6 && <4.9, yesod >=1.2 && <1.5, text >=1.1 && <1.4, persistent-postgresql >=2.1 && <2.2, monad-logger >=0.3 && <0.4, persistent >=2.1 && <2.2, pandoc >=1.10, shakespeare >=2.0 && <2.1, time >=1.4 && <1.6, csv >=0.1 && <0.2, yesod-auth >=1.3 && <1.5, http-conduit >=2.1 && <2.2, yesod-core >=1.2 && <1.5, yesod-form >=1.3 && <1.5, highlighting-kate >=0.5 && <0.6, time-locale-compat >= 0.1 && < 0.2, containers >= 0.5 && <0.6+ build-depends: base >=4.6 && <4.9,+ yesod >=1.2,+ text,+ persistent-postgresql >=2.1,+ monad-logger >=0.3,+ persistent >=2.1,+ pandoc >=1.10,+ shakespeare >=2.0,+ time >=1.4,+ csv,+ yesod-auth >=1.3,+ http-conduit >=2.1,+ yesod-core >=1.2,+ yesod-form >=1.3,+ highlighting-kate >=0.5,+ time-locale-compat >= 0.1,+ containers >= 0.5 -- Directories containing source files. -- hs-source-dirs: @@ -68,6 +84,23 @@ default-language: Haskell2010 executable informative-test- build-depends: base >=4.6 && <4.9, yesod >=1.2 && <1.5, text >=1.1 && <1.4, persistent-postgresql >=2.1 && <2.2, monad-logger >=0.3 && <0.4, persistent >=2.1 && <2.2, pandoc >=1.10, shakespeare >=2.0 && <2.1, time >=1.4 && <1.6, csv >=0.1 && <0.2, yesod-auth >=1.3 && <1.5, http-conduit >=2.1 && <2.2, yesod-core >=1.2 && <1.5, yesod-form >=1.3 && <1.5, highlighting-kate >=0.5 && <0.6, time-locale-compat >= 0.1 && < 0.2, containers >= 0.5 && <0.6+ build-depends: base >=4.6 && <4.9,+ yesod >=1.2,+ text,+ persistent-postgresql >=2.1,+ monad-logger >=0.3,+ persistent >=2.1,+ pandoc >=1.10,+ shakespeare >=2.0,+ time >=1.4,+ csv,+ yesod-auth >=1.3,+ http-conduit >=2.1,+ yesod-core >=1.2,+ yesod-form >=1.3,+ highlighting-kate >=0.5,+ time-locale-compat >= 0.1,+ containers >= 0.5+ main-is: informative-test.hs default-language: Haskell2010
informative.css view
@@ -216,6 +216,8 @@ div.sourceContent table, div.content div.sourceCode table width: 100%;+ border-spacing: 0px;+ border-collapse: separate; code.cs, code.source-cs background-color: #ffdddd@@ -239,32 +241,54 @@ pre margin: 0px -pre.haskell:before, pre.source-haskell:before, div.source-haskell td.sourceCode pre:before+pre.cs:before, pre.source-cs:before, div.sourceContent div.langhead+ content: 'C#';+ display: inline;+ border: 1px solid maroon;+ padding: 1px;+ background-color: maroon;+ color: white;+ border-bottom: none+ padding-bottom: 0px;++pre.haskell:before, pre.source-haskell:before, div.source-haskell div.langhead content: 'Haskell'; display: inline; border: 1px solid navy;- padding: 2px;+ padding: 1px; background-color: navy; color: yellow; border-bottom: none padding-bottom: 0px; -pre.php:before, pre.source-php:before, div.source-php td.sourceCode pre:before+pre.php:before, pre.source-php:before, div.source-php div.langhead content: 'PHP'; display: inline; border: 1px solid purple;- padding: 2px;+ padding: 1px; background-color: purple; color: white; border-bottom: none padding-bottom: 0px; -pre.cs:before, pre.source-cs:before, div.source-cs td.sourceCode pre:before- content: 'C#';- display: inline;- border: 1px solid maroon;- padding: 2px;- background-color: maroon;- color: white;- border-bottom: none+div.sourceContent div.sourceCode+ margin-top: -4px;++div.sourceContent div.titlehead+ display: block;+ border-top: 1px solid maroon;+ border-right: 1px solid maroon;+ padding: 0px;+ color: black;+ border-bottom: none;+ border-left: none; padding-bottom: 0px;+ margin-right: 4px;++div.source-haskell div.titlehead+ border-top: 1px solid navy;+ border-right: 1px solid navy;++div.source-php div.titlehead+ border-top: 1px solid purple;+ border-right: 1px solid purple;
informative.htm view
@@ -24,6 +24,9 @@ $case (sect, kind, fmt) $of (Left c, Article, Source lg ln) <div .sourceContent .source-#{toClassname lg}>+ <div .titlehead>+ <div .langhead>+ #{prettify $ toClassname lg} #{c} $of (Left c, Article, _) <div .content>