skylighting 0.1.1.4 → 0.1.1.5
raw patch · 3 files changed
+18/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +6/−0
- skylighting.cabal +1/−1
- src/Skylighting/Format/LaTeX.hs +11/−8
changelog.md view
@@ -1,5 +1,11 @@ # Revision history for skylighting +## 0.1.1.5 -- 2017-02-03++ * Avoid depending on a PrintfArg instance for Text (#5).+ This isn't provided in some older versions of the text library.+ This change should allow the package to build on older platforms.+ ## 0.1.1.4 -- 2017-01-31 * Properly escape characters in subDynamic.
skylighting.cabal view
@@ -1,5 +1,5 @@ name: skylighting-version: 0.1.1.4+version: 0.1.1.5 synopsis: syntax highlighting library description: Skylighting is a syntax highlighting library with support for over one hundred languages. It derives
src/Skylighting/Format/LaTeX.hs view
@@ -103,8 +103,11 @@ ++ map (macrodef (defaultColor f) (tokenStyles f)) (enumFromTo KeywordTok NormalTok) macrodef :: Maybe Color -> [(TokenType, TokenStyle)] -> TokenType -> Text-macrodef defaultcol tokstyles tokt = "\\newcommand{\\" <> Text.pack (show tokt) <>- "}[1]{" <> (co . ul . bf . it . bg $ "#1") <> "}"+macrodef defaultcol tokstyles tokt = "\\newcommand{\\"+ <> Text.pack (show tokt)+ <> "}[1]{"+ <> Text.pack (co . ul . bf . it . bg $ "#1")+ <> "}" where tokf = case lookup tokt tokstyles of Nothing -> defStyle Just x -> x@@ -117,16 +120,16 @@ bf x = if tokenBold tokf then "\\textbf{" <> x <> "}" else x- bcol = fromColor `fmap` tokenBackground tokf :: Maybe (Double, Double, Double)- bg x = Text.pack $- case bcol of+ bcol = fromColor `fmap` tokenBackground tokf+ :: Maybe (Double, Double, Double)+ bg x = case bcol of Nothing -> x Just (r, g, b) -> printf "\\colorbox[rgb]{%0.2f,%0.2f,%0.2f}{%s}" r g b x- col = fromColor `fmap`- (tokenColor tokf `mplus` defaultcol) :: Maybe (Double, Double, Double)+ col = fromColor `fmap` (tokenColor tokf `mplus` defaultcol)+ :: Maybe (Double, Double, Double) co x = case col of Nothing -> x- Just (r, g, b) -> Text.pack $+ Just (r, g, b) -> printf "\\textcolor[rgb]{%0.2f,%0.2f,%0.2f}{%s}" r g b x