highlighting-kate 0.4 → 0.5
raw patch · 5 files changed
+15/−11 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Text.Highlighting.Kate.Format.HTML: styleToHtml :: Style -> Html
+ Text.Highlighting.Kate.Format.HTML: styleToCss :: Style -> String
Files
- Highlight.hs +1/−1
- Text/Highlighting/Kate.hs +4/−2
- Text/Highlighting/Kate/Format/HTML.hs +4/−7
- changelog +5/−0
- highlighting-kate.cabal +1/−1
Highlight.hs view
@@ -129,7 +129,7 @@ then putStrLn $ renderHtml fragment else putStrLn $ renderHtml $ H.head (pageTitle >> metadata >> css) >> H.body (toHtml fragment) where fragment = formatHtmlBlock opts $ highlightAs lang code- css = styleToHtml sty+ css = H.style ! A.type_ "text/css" $ toHtml $ styleToCss sty pageTitle = H.title $ toHtml fname metadata = H.meta ! A.httpEquiv "Content-Type" ! A.content "text/html; charset=UTF-8" >> H.meta ! A.name "generator" ! A.content "highlight-kate"
Text/Highlighting/Kate.hs view
@@ -17,13 +17,15 @@ > import Text.Blaze.Renderer.String (renderHtml) > import Text.Blaze (toHtml) > import Text.Blaze.Html5 as H+> import Text.Blaze.Html5.Attributes as A > > main = do > code <- getContents > putStrLn $ renderHtml-> $ do H.head (styleToHtml tango)+> $ do H.head $ H.style ! A.type_ (toValue "text/css")+> $ toHtml $ styleToCss tango > H.body $ toHtml-> $ formatBlock defaultFormatOpts+> $ formatHtmlBlock defaultFormatOpts > $ highlightAs "ruby" code -}
Text/Highlighting/Kate/Format/HTML.hs view
@@ -11,7 +11,7 @@ -} module Text.Highlighting.Kate.Format.HTML (- formatHtmlInline, formatHtmlBlock, styleToHtml+ formatHtmlInline, formatHtmlBlock, styleToCss ) where import Text.Highlighting.Kate.Types import Text.Blaze@@ -88,11 +88,9 @@ >> toHtml "\n" else toHtml $ show n ++ "\n" --- | Returns an HTML @style@ block with definitions for--- formatting highlighted code according to the given style.-styleToHtml :: Style -> Html-styleToHtml f = H.style ! A.type_ (toValue "text/css") $ toHtml- $ unlines $ tablespec ++ colorspec ++ map toCss (tokenStyles f)+-- | Returns CSS for styling highlighted code according to the given style.+styleToCss :: Style -> String+styleToCss f = unlines $ tablespec ++ colorspec ++ map toCss (tokenStyles f) where colorspec = case (defaultColor f, backgroundColor f) of (Nothing, Nothing) -> [] (Just c, Nothing) -> ["pre, code { color: " ++ fromColor c ++ "; }"]@@ -123,5 +121,4 @@ weightspec = if tokenBold tf then "font-weight: bold; " else "" stylespec = if tokenItalic tf then "font-style: italic; " else "" decorationspec = if tokenUnderline tf then "text-decoration: underline; " else ""-
changelog view
@@ -1,3 +1,8 @@+highlighting-kate 0.5 (25 Jan 2012)++ * Text.Highlighting.Kate.Format.HTML now exports styleToCss+ instead of styleToHtml.+ highlighting-kate 0.4 (21 Jan 2012) * Text.Highlighting.Kate.Definitions has been renamed as
highlighting-kate.cabal view
@@ -1,5 +1,5 @@ Name: highlighting-kate-Version: 0.4+Version: 0.5 Cabal-Version: >= 1.6 Build-Type: Simple Category: Text