packages feed

BlogLiterately 0.6.0.2 → 0.6.1

raw patch · 6 files changed

+54/−10 lines, 6 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

BlogLiterately.cabal view
@@ -1,9 +1,10 @@ Name:           BlogLiterately-Version:        0.6.0.2+Version:        0.6.1 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-                to any blog supporting the metaWeblog API (such as Wordpress).+                to any blog supporting the metaWeblog API (such as Wordpress):+                <http://codex.wordpress.org/XML-RPC_MetaWeblog_API>.                 .                 To get started, use the provided executable                 @BlogLiterately@; see@@ -38,7 +39,7 @@   location: git://github.com/byorgey/BlogLiterately.git  Library-  Build-Depends:   base >= 4.0 && < 4.7,+  Build-Depends:   base >= 4.0 && < 4.8,                    process,                    filepath,                    directory,
CHANGES.md view
@@ -1,3 +1,12 @@+0.6.1 (27 August 2013)+----------------------++  * Automatically include necessary preamble (e.g. `<script>` tags)+    for the math mode chosen (*e.g.* MathJax)+  * Wrap the results of `hscolour` in `pre` and `code` tags with+    classes, to conform more closely to the style used by+    `highlighting-kate`+ 0.6.0.2 (15 May 2013) --------------------- 
README.markdown view
@@ -1,6 +1,6 @@ Write blog posts in Markdown format, then use BlogLiterately to do syntax highlighting, format ghci sessions, and upload to any blog-supporting the metaWeblog API (such as Wordpress).+supporting the [metaWeblog API (such as Wordpress)](http://codex.wordpress.org/XML-RPC_MetaWeblog_API).  To get started, use the provided executable `BlogLiterately`; see [http://byorgey.wordpress.com/blogliterately/](http://byorgey.wordpress.com/blogliterately/)
src/Text/BlogLiterately/Highlight.hs view
@@ -153,10 +153,20 @@ -- argument indicates whether the code is literate Haskell. colourIt :: Bool -> String -> String colourIt literate srcTxt =-    hscolour CSS defaultColourPrefs False True "" literate srcTxt'+    wrapCode $ hscolour CSS defaultColourPrefs False True "" literate srcTxt'     where srcTxt' | literate  = litify srcTxt                   | otherwise = srcTxt+          -- wrap the result in a <pre><code> tag, similar to+          -- highlighting-kate results+          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"+ -- | Prepend literate Haskell markers to some source code. litify :: String -> String litify = unlines . map ("> " ++) . lines@@ -210,7 +220,7 @@         [c] = filts (CElem e noPos)      -- the filter is a fold of individual filters for each CSS class-    filts = mkElem "pre" [(foldXml $ foldl o keep $ map filt prefs) `o` replaceTag "code"]+    filts = foldXml $ foldl o keep $ map filt prefs      -- an individual filter replaces the attributes of a tag with     -- a style attribute when it has a specific 'class' attribute.
src/Text/BlogLiterately/Post.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RecordWildCards  #-}+{-# LANGUAGE TemplateHaskell  #-}  ----------------------------------------------------------------------------- -- |@@ -17,9 +18,10 @@       mkPost, mkArray, postIt     ) where -import           Control.Lens                ((^.))+import           Control.Lens                (at, makePrisms, to, traverse,+                                              (^.), (^?), _Just) import           Control.Monad               (unless)-import           Data.Maybe                  (fromMaybe)+import qualified Data.Map                    as M  import           Network.XmlRpc.Client       (remote) import           Network.XmlRpc.Internals    (Value (..), XmlRpcType, toValue)@@ -96,6 +98,14 @@ appropriate: -} +makePrisms ''Value++-- | Get the URL for a given post.+getPostURL :: String -> String -> String -> String -> IO (Maybe String)+getPostURL url pid usr pwd = do+  v <- remote url "metaWeblog.getPost" pid usr pwd+  return (v ^? _ValueStruct . to M.fromList . at "link" . traverse . _ValueString)+ -- | Given a configuration and a formatted post, upload it to the server. postIt :: BlogLiterately -> String -> IO () postIt bl html =@@ -113,13 +123,16 @@                    post                    (publish' bl)           putStrLn $ "Post ID: " ++ pid+          getPostURL url pid (user' bl) pwd >>= maybe (return ()) putStrLn         Just pid -> do           success <- remote url "metaWeblog.editPost" pid                        (user' bl)                        pwd                        post                        (publish' bl)-          unless success $ putStrLn "update failed!"+          case success of+            True  -> getPostURL url pid (user' bl) pwd >>= maybe (return ()) putStrLn+            False -> putStrLn "Update failed!"   where     post = mkPost              (title' bl)
src/Text/BlogLiterately/Transform.hs view
@@ -339,7 +339,18 @@                 , writerHTMLMathMethod =                   case math' bl of                     ""  -> PlainMath-                    opt -> mathOption opt }+                    opt -> mathOption opt+                , writerStandalone     = True+                , writerTemplate       = unlines+                  [ "$for(css)$"+                  , "  <linkrel=\"stylesheet\" href=\"$css$\" $if(html5)$$else$type=\"text/css\" $endif$/>"+                  , "$endfor$"+                  , "$if(math)$"+                  , "  $math$"+                  , "$endif$"+                  , "$body$"+                  ]+                }     mathOption opt       | opt `isPrefixOf` "latexmathml" ||         opt `isPrefixOf` "asciimathml" = LaTeXMathML (mathUrlMaybe opt)