packages feed

BlogLiterately 0.6.2 → 0.6.3

raw patch · 5 files changed

+33/−21 lines, 5 filesdep ~pandocdep ~pandoc-types

Dependency ranges changed: pandoc, pandoc-types

Files

BlogLiterately.cabal view
@@ -1,5 +1,5 @@ Name:           BlogLiterately-Version:        0.6.2+Version:        0.6.3 Synopsis:       A tool for posting Haskelly articles to blogs Description:    Write blog posts in Markdown format, then use BlogLiterately                 to do syntax highlighting, format ghci sessions, and upload@@ -56,8 +56,8 @@                    blaze-html >= 0.5 && < 0.7,                    cmdargs >= 0.9.5 && < 0.11,                    haxr >= 3000.9 && < 3000.10,-                   pandoc >= 1.10 && < 1.12,-                   pandoc-types >= 1.10 && < 1.11,+                   pandoc >= 1.12 && < 1.13,+                   pandoc-types >= 1.12 && < 1.13,                    highlighting-kate >= 0.5 && < 0.6,                    data-default >= 0.5 && < 0.6,                    lens >= 3.8 && < 3.10
CHANGES.md view
@@ -1,3 +1,9 @@+0.6.3 (30 September 2013)+-------------------------++  * Update to build against pandoc-1.12.  Note that BlogLiterately no+    longer builds with pandoc < 1.12.+ 0.6.2 (29 August 2013) ---------------------- 
src/Text/BlogLiterately/Highlight.hs view
@@ -158,12 +158,12 @@                   | otherwise = srcTxt           -- wrap the result in a <pre><code> tag, similar to           -- highlighting-kate results-          wrapCode s = verbatim $ +          wrapCode s = verbatim $               (\(Document _ _ e _) -> foldXml filt (CElem e noPos))                              (xmlParse "colourIt" s)            attrs = [("class", (("sourceCode haskell")!))]-                    +           filt = mkElemAttr "pre" attrs [mkElemAttr "code" attrs [children]]                     `when` tag "pre" @@ -263,9 +263,9 @@   | tag == Just "haskell" || haskell   = case hsHighlight of         HsColourInline style ->-            RawBlock "html" $ bakeStyles style $ colourIt lit src-        HsColourCSS   -> RawBlock "html" $ colourIt lit src-        HsNoHighlight -> RawBlock "html" $ simpleHTML hsrc+            rawHtml $ bakeStyles style $ colourIt lit src+        HsColourCSS   -> rawHtml $ colourIt lit src+        HsNoHighlight -> rawHtml $ simpleHTML hsrc         HsKate        -> case tag of             Nothing -> myHighlightK attr hsrc             Just t  -> myHighlightK ("", t:classes,[]) hsrc@@ -276,7 +276,7 @@         Just t  -> myHighlightK ("",[t],[]) src    | otherwise-  = RawBlock "html" $ simpleHTML src+  = rawHtml $ simpleHTML src    where     (tag,src)@@ -289,8 +289,9 @@     haskell      = "haskell" `elem` classes     simpleHTML s = "<pre><code>" ++ s ++ "</code></pre>"     myHighlightK attr s = case highlight formatHtmlBlock attr s of-        Nothing   -> RawBlock "html" $ simpleHTML s-        Just html -> RawBlock "html" $ replaceBreaks $ renderHtml html+        Nothing   -> rawHtml $ simpleHTML s+        Just html -> rawHtml $ replaceBreaks $ renderHtml html+    rawHtml = RawBlock (Format "html")  colouriseCodeBlock _ _ b = b 
src/Text/BlogLiterately/LaTeX.hs view
@@ -15,8 +15,8 @@       wpTeXify     ) where -import Data.List   ( isPrefixOf )-import Text.Pandoc+import           Data.List   (isPrefixOf)+import           Text.Pandoc  -- | WordPress can render LaTeX, but expects it in a special non-standard --   format (@\$latex foo\$@).  The @wpTeXify@ function formats LaTeX code@@ -30,9 +30,9 @@          formatDisplayTex :: [Block] -> [Block]         formatDisplayTex (Para [Math DisplayMath tex] : bs)-          = RawBlock "html" "<p><div style=\"text-align: center\">"+          = RawBlock (Format "html") "<p><div style=\"text-align: center\">"           : Plain [Str $ "$latex " ++ "\\displaystyle " ++ unPrefix "latex" tex ++ "$"]-          : RawBlock "html" "</div></p>"+          : RawBlock (Format "html") "</div></p>"           : bs         formatDisplayTex bs = bs 
src/Text/BlogLiterately/Transform.hs view
@@ -51,6 +51,7 @@ import           Control.Monad.State import           Data.Default                      (def) import           Data.List                         (intercalate, isPrefixOf)+import qualified Data.Map                          as M import           Data.Monoid                       (mappend) import           Data.Monoid                       (mempty, (<>)) import qualified Data.Set                          as S@@ -186,12 +187,16 @@ titleXF = Transform extractTitle (const True)   where     extractTitle = do-      (Pandoc (Meta t _ _) _) <- gets snd-      case t of-        [] -> return ()-        is ->-          -- title set explicitly with --title takes precedence.-          _1.title %= (`mplus` Just (intercalate " " [s | Str s <- is]))+      (Pandoc (Meta m) _) <- gets snd+      case M.lookup "title" m of+        Just (MetaString s) ->+          setTitle s+        Just (MetaInlines is) ->+          setTitle (intercalate " " [s | Str s <- is])+        _ -> return ()++    -- title set explicitly with --title takes precedence.+    setTitle s = _1.title %= (`mplus` Just s)  -- | Extract blocks tagged with @[BLOpts]@ and use their contents as --   options.