packages feed

BlogLiterately 0.5.2.1 → 0.5.3

raw patch · 6 files changed

+104/−58 lines, 6 filesdep +bool-extrasdep ~pandoc

Dependencies added: bool-extras

Dependency ranges changed: pandoc

Files

BlogLiterately.cabal view
@@ -1,5 +1,5 @@ Name:           BlogLiterately-Version:        0.5.2.1+Version:        0.5.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@@ -41,11 +41,11 @@                     doc/BlogLiteratelyDoc.lhs                     style/*.css                     style/hs-style-Bug-reports:    http://code.google.com/p/byorgey/issues/list?q=Project:BlogLiterately+Bug-reports:    http://hub.darcs.net/byorgey/BlogLiterately/issues  Source-repository head   type:     darcs-  location: http://patch-tag.com/r/byorgey/BlogLiterately+  location: http://hub.darcs.net/byorgey/BlogLiterately  Library   Build-Depends:   base >= 4.0 && < 4.7,@@ -54,6 +54,7 @@                    directory,                    bytestring,                    containers,+                   bool-extras,                    split >= 0.1.4 && < 0.3,                    utf8-string >= 0.3 && < 0.4,                    transformers >= 0.3 && < 0.4,@@ -63,7 +64,7 @@                    blaze-html >= 0.5 && < 0.6,                    cmdargs >= 0.9.5 && < 0.11,                    haxr >= 3000.9 && < 3000.10,-                   pandoc >= 1.9.3 && < 1.10+                   pandoc >= 1.9.3 && < 1.11   Exposed-modules: Text.BlogLiterately                    Text.BlogLiterately.Block                    Text.BlogLiterately.Ghci
CHANGES view
@@ -1,3 +1,22 @@+0.5.3: 19 November 2012++  * New --math option for selecting pandoc math writing mode++  * Run the pandoc parser in "smart" mode, which generates proper en-+    and em-dashes, quotation marks, etc.++  * More updates for GHC 7.6.1 compatibility++  * Using highlighting-kate to highlight non-Haskell code was already+    the default; make this more clear.++    The --other-kate option is no more; now there are two options++      --kate+      --no-kate++    with --kate the default.+ 0.5.2.1: 19 September 2012    * bump base upper bound to <4.7
doc/BlogLiteratelyDoc.lhs view
@@ -1,12 +1,14 @@-[`BlogLiterately`][] is a tool for uploading blog posts to servers that-support the [MetaWeblog API][metaweblog] (such as [WordPress][]-based-blogs and many others).  Blog posts to be published via-`BlogLiterately` are written in [markdown][] format, with extensions-supported by [pandoc][].  Posts may be actual "bird-style" literate-Haskell files, with commentary in markdown.  Though `BlogLiterately`-offers special support for literate Haskell in particular, it is also-useful for writing posts including code written in other languages, or-even no code at all.+[`BlogLiterately`][] is a tool for uploading blog posts to servers+that support the [MetaWeblog API][metaweblog] (such as+[WordPress][]-based blogs and many others).  Blog posts to be+published via `BlogLiterately` are written in [markdown][] format,+with+[extensions supported](http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown)+by [pandoc][].  Posts may be actual "bird-style" literate Haskell+files, with commentary in markdown.  Though `BlogLiterately` offers+special support for literate Haskell in particular, it is also useful+for writing posts including code written in other languages, or even+no code at all.  `BlogLiterately` includes support for syntax highlighting, $\LaTeX$ (including special support for WordPress blogs), and automatic@@ -93,23 +95,20 @@  $$\sum_{k=0}^\infty 1/k^2.$$ -By default, LaTeX is processed with Pandoc, meaning that a-certain subset of LaTeX expressions (such as those above) will be-transformed into [MathML][], and anything Pandoc cannot parse will be-passed through as literal LaTeX enclosed in dollar signs.--Blogs hosted on [wordpress.com](http://www.wordpress.com), however,-have built-in support for LaTeX, compiling LaTeX expressions to-embedded images on-the-fly.  Passing the `--wplatex` option to-`BlogLiterately` causes any embedded LaTeX to be output in the format-expected by WordPress.  Note that an extra `$latex...` won't be added-to the beginning of LaTeX expressions which already appear to be in-WordPress format.+Using the `--math` option, any+[Pandoc math rendering method may be chosen](http://johnmacfarlane.net/pandoc/README.html#math-rendering-in-html),+including MathML, jsMath, MathJax, and others.  Note that for some+methods to work properly, you may need to ensure that the generated+HTML ends up in the proper CSS or JavaScript environment. (What that+means depends on the method used.) -When working with other blogging platforms that do not directly-support LaTeX, it might be nice for `BlogLiterately` to have some sort-of [MathJax][] support.  This is future work; drop a note (or a-patch!)  if you would like to see this added.+Alternatively, blogs hosted on+[wordpress.com](http://www.wordpress.com) have built-in+support for LaTeX, compiling LaTeX expressions to embedded images+on-the-fly.  Passing the `--wplatex` option to `BlogLiterately` causes+any embedded LaTeX to be output in the format expected by WordPress.+Note that an extra `$latex...` won't be added to the beginning of+LaTeX expressions which already appear to be in WordPress format.  `ghci` sessions ---------------
src/Text/BlogLiterately/Options.hs view
@@ -31,6 +31,7 @@   , otherHighlight :: Bool          -- ^ Use highlighting-kate for                                     --   non-Haskell?   , wplatex        :: Bool          -- ^ Format LaTeX for WordPress?+  , math           :: String        -- ^ Indicate how to format Math   , ghci           :: Bool          -- ^ Automatically process ghci sessions?   , uploadImages   :: Bool          -- ^ Automatically upload images?   , categories     :: [String]      -- ^ Categories for the post@@ -78,10 +79,15 @@      , otherHighlight = enum        [ True          &= explicit-         &= name "other-kate"-         &= help "highlight other code with highlighting-kate"+         &= name "kate"+         &= help "highlight non-Haskell code with highlighting-kate (default)"+       , False+         &= explicit+         &= name "no-kate"+         &= help "don't highlight non-Haskell code"        ]      , wplatex = def &= help "reformat inline LaTeX the way WordPress expects"+     , math    = def &= help "how to layout math, where --math=<pandoc-option>[=URL]"      , ghci    = def &= help "run [ghci] blocks through ghci and include output"      , uploadImages = def &= name "upload-images" &= explicit &= help "upload local images"      , page    = def &= help "create a \"page\" instead of a post (WordPress only)"
src/Text/BlogLiterately/Transform.hs view
@@ -42,6 +42,8 @@                                             , Kleisli(..), runKleisli ) import qualified Control.Category as C      ( Category, id ) import qualified Data.Traversable as T+import           Data.Bool.Extras (whenA)+import           Data.List (isPrefixOf)  import           Text.Pandoc import           Text.Blaze.Html.Renderer.String      ( renderHtml )@@ -159,20 +161,39 @@     >>> arr     (writeHtml writeOpts)     >>> arr     renderHtml   where-    writeOpts = defaultWriterOptions-                { writerReferenceLinks = True }     parseOpts = defaultParserState-                { stateLiterateHaskell = True }+                { stateLiterateHaskell = True+                , stateSmart           = True+                }+    writeOpts = defaultWriterOptions+                { writerReferenceLinks = True+                , writerHTMLMathMethod =+                  case math bl of+                    ""  -> PlainMath+                    opt -> mathOption opt }+    mathOption opt+      | opt `isPrefixOf` "latexmathml" ||+        opt `isPrefixOf` "asciimathml" = LaTeXMathML (mathUrlMaybe opt)+      | opt `isPrefixOf` "mathml"      = MathML (mathUrlMaybe opt)+      | opt `isPrefixOf` "mimetex"     =+          WebTeX (mathUrl "/cgi-bin/mimetex.cgi?" opt)+      | opt `isPrefixOf` "webtex"      = WebTeX (mathUrl webTeXURL opt)+      | opt `isPrefixOf` "jsmath"      = JsMath (mathUrlMaybe opt)+      | opt `isPrefixOf` "mathjax"     = MathJax (mathUrl mathJaxURL opt)+      | opt `isPrefixOf` "gladtex"     = GladTeX +    webTeXURL  = "http://chart.apis.google.com/chart?cht=tx&chl="+    mathJaxURL = "http://cdn.mathjax.org/mathjax/latest/MathJax.js"+                 ++ "?config=TeX-AMS-MML_HTMLorMML"++    urlPart = drop 1 . dropWhile (/='=')++    mathUrlMaybe opt = case urlPart opt of "" -> Nothing; x -> Just x+    mathUrl def opt  = case urlPart opt of "" -> def; x -> x+ -- | Turn @CRLF@ pairs into a single @LF@.  This is necessary since --   'readMarkdown' is picky about line endings. fixLineEndings :: String -> String fixLineEndings [] = [] fixLineEndings ('\r':'\n':cs) = '\n':fixLineEndings cs fixLineEndings (c:cs) = c:fixLineEndings cs---- | A useful arrow utility for running some part of a pipeline--- conditionally.-whenA :: C.Category (~>) => (a ~> a) -> Bool -> (a ~> a)-whenA a p | p         = a-          | otherwise = C.id
style/kate.css view
@@ -1,23 +1,23 @@-/* this file was derived from highlighting-kate which is Copyright-   John MacFarlane.  Approximately the same file, along with other +/* This file was derived from highlighting-kate which is copyright+   John MacFarlane.  Approximately the same file, along with other    stylesheets, are available in the highlighting-kate package on-   hackage. */-table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre +   hackage. This particular example is loosely based on pygment's+   default color scheme. */+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre    { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; } td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; } td.sourceCode { padding-left: 5px; } pre.sourceCode { }-pre.sourceCode span.Normal { }-pre.sourceCode span.Keyword { color: #007020; font-weight: bold; } -pre.sourceCode span.DataType { color: #902000; }-pre.sourceCode span.DecVal { color: #40a070; }-pre.sourceCode span.BaseN { color: #40a070; }-pre.sourceCode span.Float { color: #40a070; }-pre.sourceCode span.Char { color: #4070a0; }-pre.sourceCode span.String { color: #4070a0; }-pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }-pre.sourceCode span.Others { color: #007020; }-pre.sourceCode span.Alert { color: red; font-weight: bold; }-pre.sourceCode span.Function { color: #06287e; }-pre.sourceCode span.RegionMarker { }-pre.sourceCode span.Error { color: red; font-weight: bold; }+code.sourceCode span.kw { color: #007020; font-weight: bold; }+code.sourceCode span.dt { color: #902000; }+code.sourceCode span.dv { color: #40a070; }+code.sourceCode span.bn { color: #40a070; }+code.sourceCode span.fl { color: #40a070; }+code.sourceCode span.ch { color: #4070a0; }+code.sourceCode span.st { color: #4070a0; }+code.sourceCode span.co { color: #60a0b0; font-style: italic; }+code.sourceCode span.ot { color: #007020; }+code.sourceCode span.al { color: red; font-weight: bold; }+code.sourceCode span.fu { color: #06287e; }+code.sourceCode span.re { }+code.sourceCode span.er { color: red; font-weight: bold; }