packages feed

BlogLiterately 0.7.0.2 → 0.7.1

raw patch · 6 files changed

+69/−20 lines, 6 filesdep ~pandoc-citeproc

Dependency ranges changed: pandoc-citeproc

Files

BlogLiterately.cabal view
@@ -1,5 +1,5 @@ Name:           BlogLiterately-Version:        0.7.0.2+Version:        0.7.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@@ -58,7 +58,7 @@                    haxr >= 3000.9 && < 3000.11,                    pandoc >= 1.12 && < 1.13,                    pandoc-types >= 1.12 && < 1.13,-                   pandoc-citeproc >= 0.1.2 && < 0.3,+                   pandoc-citeproc >= 0.1.2 && < 0.4,                    highlighting-kate >= 0.5 && < 0.6,                    data-default >= 0.5 && < 0.6,                    lens >= 3.8 && < 3.11
CHANGES.md view
@@ -1,3 +1,9 @@+0.7.1 (14 January 2014)+-----------------------++  * Allow pandoc-citeproc-0.3+  * Add --toc option for putting a table of contents at the top of a post+ 0.7.0.2 (4 December 2013) ------------------------- 
doc/BlogLiteratelyDoc.lhs view
@@ -5,6 +5,8 @@     ghci    = true     wplatex = true     page    = true+    publish = true+    toc     = true  [`BlogLiterately`][] is a tool for uploading blog posts to servers that support the [MetaWeblog API][metaweblog] (such as@@ -222,6 +224,15 @@ Note that an extra `$latex...` won't be added to the beginning of LaTeX expressions which already appear to be in WordPress format. +Table of contents+-----------------++`BlogLiterately` can also take advantage of pandoc's ability to+generate a table of contents.  Just pass the `--toc` option to+`BlogLiterately` and a table of contents will be added to the top of+your post.  See this documentation itself for an example of the+output.+ `ghci` sessions --------------- @@ -251,7 +262,6 @@  Now, given the input -    [other]         [ghci]         :t hailstone         hailstone 15@@ -280,7 +290,6 @@ the actual and expected outputs differ, the actual output is typeset first in red, then the expected output in blue.  For example, -    [other]         [ghci]         reverse "kayak"         7+18@@ -462,7 +471,6 @@ In addition, options may be specified inline, using a code block marked with the `[BLOpts]`.  For example, -    [other]         [BLOpts]         profile = foo         title = "My awesome blog post!"@@ -484,7 +492,6 @@ title on the first line marked with `%`.  `BlogLiterately` supports this format too, so the above example could also have been written as: -    [other]     % My awesome blog post!          [BLOpts]
src/Text/BlogLiterately/Options.hs view
@@ -23,6 +23,7 @@     , style     , hsHighlight     , otherHighlight+    , toc     , wplatex     , math     , ghci@@ -50,6 +51,7 @@     , style'     , hsHighlight'     , otherHighlight'+    , toc'     , wplatex'     , math'     , ghci'@@ -87,6 +89,7 @@   , _hsHighlight    :: Maybe HsHighlight   -- ^ Haskell highlighting mode   , _otherHighlight :: Maybe Bool          -- ^ Use highlighting-kate for                                            --   non-Haskell?+  , _toc            :: Maybe Bool          -- ^ Generate a table of contents?   , _wplatex        :: Maybe Bool          -- ^ Format LaTeX for WordPress?   , _math           :: Maybe String        -- ^ Indicate how to format math   , _ghci           :: Maybe Bool          -- ^ Automatically process ghci sessions?@@ -130,6 +133,7 @@     { _style          = Nothing     , _hsHighlight    = Nothing     , _otherHighlight = Nothing+    , _toc            = Nothing     , _wplatex        = Nothing     , _math           = Nothing     , _ghci           = Nothing@@ -157,6 +161,7 @@     { _style          = combine _style     , _hsHighlight    = combine _hsHighlight     , _otherHighlight = combine _otherHighlight+    , _toc            = combine _toc     , _wplatex        = combine _wplatex     , _math           = combine _math     , _ghci           = combine _ghci@@ -197,6 +202,9 @@ otherHighlight' :: BlogLiterately -> Bool otherHighlight' = fromMaybe True  . view otherHighlight +toc' :: BlogLiterately -> Bool+toc'            = fromMaybe False . view toc+ wplatex' :: BlogLiterately -> Bool wplatex'        = fromMaybe False . view wplatex @@ -281,6 +289,16 @@          &= explicit          &= name "no-kate"          &= help "don't highlight non-Haskell code"+       ]+     , _toc = enum+       [ Just True+         &= explicit+         &= name "toc"+         &= help "generate a table of contents"+       , Just False+         &= explicit+         &= name "no-toc"+         &= help "don't generate a table of contents (default)"        ]      , _wplatex = def &= help "reformat inline LaTeX the way WordPress expects"                   &= name "wplatex" &= name "w" &= explicit
src/Text/BlogLiterately/Options/Parse.hs view
@@ -17,10 +17,10 @@  import           Control.Applicative         (pure, (*>), (<$>), (<*)) import           Control.Arrow               (second)-import           Control.Lens                ((&), (.~), ASetter')+import           Control.Lens                (ASetter', (&), (.~)) import           Data.Char                   (isSpace) import           Data.Either                 (partitionEithers)-import           Data.Monoid                 (mconcat, mempty, Monoid)+import           Data.Monoid                 (Monoid, mconcat, mempty) import           Text.Parsec                 (ParseError, char, many, noneOf,                                               optional, parse, sepBy, spaces,                                               string, try, (<|>))@@ -52,6 +52,7 @@ parseBLOption :: Parser BlogLiterately parseBLOption =       parseField style        "style"         parseStr+  <|> parseField toc          "toc"           parseBool   <|> parseField wplatex      "wplatex"       parseBool   <|> parseField math         "math"          parseStr   <|> parseField ghci         "ghci"          parseBool
src/Text/BlogLiterately/Transform.hs view
@@ -46,9 +46,9 @@  import           Control.Applicative               ((<$>)) import           Control.Arrow                     ((>>>))-import           Control.Lens                      (has, isn't, use, (%=),-                                                    (&), (.=), (.~), (^.), _1,-                                                    _2, _Just)+import           Control.Lens                      (has, isn't, use, (%=), (&),+                                                    (.=), (.~), (^.), _1, _2,+                                                    _Just) import           Control.Monad.State import           Data.List                         (intercalate, isPrefixOf) import qualified Data.Map                          as M@@ -357,20 +357,13 @@                 }     writeOpts = def                 { writerReferenceLinks = True+                , writerTableOfContents = toc' bl                 , writerHTMLMathMethod =                   case math' bl of                     ""  -> PlainMath                     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$"-                  ]+                , writerTemplate       = blHtmlTemplate                 }     mathOption opt       | opt `isPrefixOf` "latexmathml" ||@@ -399,3 +392,27 @@ fixLineEndings [] = [] fixLineEndings ('\r':'\n':cs) = '\n':fixLineEndings cs fixLineEndings (c:cs) = c:fixLineEndings cs++-- We use a special template with the "standalone" pandoc writer.  We+-- don't actually want truly "standalone" HTML documents because they+-- have to sit inside another web page.  But we do want things like+-- math typesetting and a table of contents.+blHtmlTemplate = unlines+  [ "$if(highlighting-css)$"+  , "  <style type=\"text/css\">"+  , "$highlighting-css$"+  , "  </style>"+  , "$endif$"+  , "$for(css)$"+  , "  <link rel=\"stylesheet\" href=\"$css$\" $if(html5)$$else$type=\"text/css\" $endif$/>"+  , "$endfor$"+  , "$if(math)$"+  , "  $math$"+  , "$endif$"+  , "$if(toc)$"+  , "<div id=\"$idprefix$TOC\">"+  , "$toc$"+  , "</div>"+  , "$endif$"+  , "$body$"+  ]