packages feed

skylighting 0.4.3.2 → 0.4.4

raw patch · 5 files changed

+30/−17 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -60,9 +60,9 @@  Using cabal: -    cabal install -fbootstrap --disable-optimizations+    cabal install -fbootstrap --disable-optimization     cabal run skylighting-extract -- xml/*.xml-    cabal install -f-bootstrap --disable-optimizations+    cabal install -f-bootstrap --disable-optimization  Command-line tool -----------------
bin/main.hs view
@@ -216,8 +216,14 @@ hlHtml frag fname opts sty sourceLines =  if frag     then putStrLn $ renderHtml fragment-    else putStrLn $ renderHtml $ H.html $-           H.head (pageTitle >> metadata >> css) >> H.body (H.toHtml fragment)+    else putStrLn $ renderHtml $ do+           H.docType+           H.html $ do+             H.head $ do+               pageTitle+               metadata+               css+             H.body $ H.toHtml fragment   where fragment = formatHtmlBlock opts sourceLines         css = H.style H.! A.type_ "text/css" $ H.toHtml $ styleToCss sty         pageTitle = H.title $ H.toHtml fname
changelog.md view
@@ -1,5 +1,14 @@ # Revision history for skylighting +## 0.4.4 -- 2017-11-21++  * HTML formatter: always use an a element (rather than a div)+    for source lines.  The divs were invalid, because code+    elements must contain phrasing content.  Previously we used+    a elements when line anchors were called for, but there is+    no clear reason not to use them always.+  * skylighting binary: add doctype to generated HTML.+ ## 0.4.3.2 -- 2017-11-04    * Fixed regression in `data-line-number` attributes in HTML
skylighting.cabal view
@@ -1,5 +1,5 @@ name:                skylighting-version:             0.4.3.2+version:             0.4.4 synopsis:            syntax highlighting library description:         Skylighting is a syntax highlighting library with                      support for over one hundred languages.  It derives
src/Skylighting/Format/HTML.hs view
@@ -52,13 +52,11 @@                       . mconcat . intersperse (toHtml "\n")                       . map (mapM_ (tokenToHtml opts)) --- | Format tokens as an HTML @pre@ block. Each line is wrapped in a div--- with the class ‘source-line’. If line numbering--- is selected, this surrounding div is given the class ‘number-source’,+-- | Format tokens as an HTML @pre@ block. Each line is wrapped in an a+-- element with the class ‘source-line’. If line numbering+-- is selected, the surrounding pre is given the class ‘numberSource’, -- and the resulting html will display line numbers thanks to the included--- css. Note that the html produced will always include the line numbers as--- the 'data-line-number' attribute.--- See the documentation for 'formatHtmlInline' for information about how+-- CSS.  See the documentation for 'formatHtmlInline' for information about how -- tokens are encoded. formatHtmlBlock :: FormatOptions -> [SourceLine] -> Html formatHtmlBlock opts ls =@@ -77,7 +75,7 @@                                              $ Text.pack "sourceCode"                                                : codeClasses opts) $ h --- | Each line of source is wrapped in an (inline-block) div that makes+-- | Each line of source is wrapped in an (inline-block) anchor that makes -- subsequent per-line processing (e.g. adding line numnbers) possible. sourceLineToHtml :: FormatOptions -> LineNo -> SourceLine -> Html sourceLineToHtml opts lno cont =@@ -86,7 +84,7 @@                  ! A.id lineNum                  ! A.href lineRef                  ! dataAttrib-      else H.div ! A.class_ sourceLine+      else H.a   ! A.class_ sourceLine                  ! A.id lineNum                  ! dataAttrib) $ mapM_ (tokenToHtml opts) cont   where  sourceLine = toValue "sourceLine"@@ -147,9 +145,9 @@                           (Just c1, Just c2) -> ["pre, code { color: " ++ fromColor c1 ++ "; background-color: " ++                                                   fromColor c2 ++ "; }"]          numberspec = [-            "pre.numberSource div.sourceLine, .numberSource a.sourceLine"+            "pre.numberSource a.sourceLine"           , "  { position: relative; }"-          , "pre.numberSource div.sourceLine::before, .numberSource a.sourceLine::before"+          , "pre.numberSource a.sourceLine::before"           , "  { content: attr(data-line-number);"           , "    position: absolute; left: -5em; text-align: right; vertical-align: baseline;"           , "    border: none; pointer-events: all;"@@ -164,13 +162,13 @@               " padding-left: 4px; }"           ]          divspec = [-            "div.sourceLine, a.sourceLine { display: inline-block; min-height: 1.25em; }"+            "a.sourceLine { display: inline-block; min-height: 1.25em; }"           , "a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }"           , ".sourceCode { overflow: visible; }"           , "code.sourceCode { white-space: pre; }"           , "@media print {"           , "code.sourceCode { white-space: pre-wrap; }"-          , "div.sourceLine, a.sourceLine { text-indent: -1em; padding-left: 1em; }"+          , "a.sourceLine { text-indent: -1em; padding-left: 1em; }"           , "}"           ]          linkspec = [ "@media screen {"