packages feed

pandoc-vimhl 0.3.0.0 → 0.3.1.0

raw patch · 3 files changed

+19/−8 lines, 3 files

Files

Changelog.md view
@@ -1,3 +1,9 @@+### 0.3.1.0++- Do not throw the error if */dev/tty* cannot be open. Note that Neovim loads+  the syntax engine without *tty* emulation just fine. This allows using Neovim+  as *VIMHL_BACKEND* in environments where */dev/tty* is unavailable.+ ### 0.3.0.0  - Support for packages *base* < *4.8* and *pandoc-types* < *1.20* was
pandoc-vimhl.cabal view
@@ -1,5 +1,5 @@ name:                    pandoc-vimhl-version:                 0.3.0.0+version:                 0.3.1.0 synopsis:                Pandoc filter for native Vim code highlighting description:             Pandoc filter for native Vim code highlighting         in HTML and PDF documents. Requires Vim (or Neovim) and plugin
vimhl.hs view
@@ -65,17 +65,20 @@                                 ,vimhlcmd ++ "' -c 'w!", dst ++ "' -c 'qa!'"                                 ,src                                 ]-                    {- vim must think that it was launched from a terminal,+                    {- Vim must think that it was launched from a terminal,                      - otherwise it won't load its usual environment and the-                     - syntax engine! Using WriteMode for stdin prevents vim+                     - syntax engine! Using WriteMode for stdin prevents Vim                      - from getting unresponsive on Ctrl-C interrupts while-                     - still doing well its task (vim checks that input is a+                     - still doing well its task (Vim checks that input is a                      - terminal using isatty(), however it does not check the-                     - mode of the handle). -}-                    hin <- openFile "/dev/tty" WriteMode+                     - mode of the handle). Note that Neovim loads the syntax+                     - engine without tty emulation just fine. -}+                    hin <- (Just <$> openFile "/dev/tty" WriteMode)+                        `catchIOError` const (return Nothing)                     hout <- openFile "/dev/null" WriteMode-                    (_, _, _, handle) <- createProcess (shell vimcmd)-                        {std_in = UseHandle hin, std_out = UseHandle hout}+                    (_, _, _, handle) <- createProcess $+                        let cmd = (shell vimcmd) {std_out = UseHandle hout}+                        in maybe cmd (\h -> cmd {std_in = UseHandle h}) hin                     r <- waitForProcess handle                     unless (r == ExitSuccess) $ exitWith r                     T.readFile dst@@ -83,6 +86,8 @@     where namevals' = map (map toLower . T.unpack *** T.unpack) namevals           fm' | fm == Format "latex" = fm               | otherwise = Format "html"+          {- Note that Github markdown sanitizer strips CSS styles in HTML+           - tags. See details at https://github.com/github/markup. -}           wrap "gfm" block = T.concat               ["<div class=\"highlight notranslate \                \position-relative overflow-auto\" dir=\"auto\" \