pandoc-vimhl 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+20/−18 lines, 4 filesdep −safe
Dependencies removed: safe
Files
- Changelog.md +4/−0
- LICENSE +1/−1
- pandoc-vimhl.cabal +6/−6
- vimhl.hs +9/−11
Changelog.md view
@@ -1,3 +1,7 @@+### 0.2.0.1++- Removed dependency on package *safe*.+ ### 0.2.0.0 - Removed dependency on packages *regex-compat* and *cond*.
LICENSE view
@@ -1,7 +1,7 @@ The following license covers this documentation, and the source code, except where otherwise indicated. -Copyright 2016-2022, Alexey Radkov. All rights reserved.+Copyright 2016-2023, Alexey Radkov. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
pandoc-vimhl.cabal view
@@ -1,16 +1,16 @@ name: pandoc-vimhl-version: 0.2.0.0+version: 0.2.0.1 synopsis: Pandoc filter for native Vim code highlighting description: Pandoc filter for native Vim code highlighting- in HTML and PDF documents. Requires Vim and plugin+ in HTML and PDF documents. Requires Vim (or Neovim) and plugin <http://github.com/lyokha/vim-publish-helper vim-publish-helper>. homepage: http://github.com/lyokha/vim-publish-helper license: BSD3 license-file: LICENSE-extra-source-files: Changelog.md+extra-doc-files: Changelog.md author: Alexey Radkov <alexey.radkov@gmail.com> maintainer: Alexey Radkov <alexey.radkov@gmail.com>-copyright: 2016-2022 Alexey Radkov+copyright: 2016-2023 Alexey Radkov category: Text build-type: Simple cabal-version: 1.20@@ -29,11 +29,11 @@ , process , temporary >= 1.1 , text- , safe- default-extensions: CPP if flag(debug) cpp-options: -DDEBUG++ ghc-options: -Wall main-is: vimhl.hs
vimhl.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ import Text.Pandoc.JSON import System.IO (IOMode (WriteMode), openFile, hFlush) import System.IO.Temp@@ -13,7 +15,7 @@ import Data.Bool (bool) import Data.Maybe (fromMaybe) import Data.Function (on)-import Control.Arrow ((&&&), (***))+import Control.Arrow import Control.Monad #if !MIN_VERSION_base(4,8,0) import Control.Applicative@@ -30,7 +32,6 @@ #ifdef DEBUG import System.IO (hPutStr, hPutStrLn, stderr) #endif-import Safe #if MIN_VERSION_pandoc_types(1,20,0) tOSTRING :: Text -> String@@ -41,12 +42,12 @@ #endif vimHl :: Maybe Format -> Block -> IO Block-vimHl (Just fm@(Format fmt)) (CodeBlock (_, cls@(ft:_), namevals) contents)+vimHl (Just fm@(Format fmt)) (CodeBlock (_, cls@(ft : _), namevals) contents) | lookup "hl" namevals' == Just "vim" && fmt' `elem` ["html", "latex"] = do let vimhlcmd = unwords [cmd fmt', nmb] where cmd "html" = "MakeHtmlCodeHighlight" cmd "latex" = "MakeTexCodeHighlight"- cmd x = error $ "Unexpected format '" ++ x ++ "'"+ cmd _ = undefined nmb | "numberLines" `elem` cls' = fromMaybe "-1" $ lookup "startfrom" namevals' | otherwise = ""@@ -56,9 +57,7 @@ cmds = maybe "" (unwords . map cmd . filter (not . null . fst)- . map ((strip *** strip . tailSafe)- . break (== '=')- )+ . map ((strip *** strip . drop 1) . break (== '=')) . filter (/= ",") . groupBy ((&&) `on` (/= ',')) ) $ lookup "vars" namevals'@@ -69,11 +68,10 @@ vimrccmd <- do home <- getHomeDirectory `catchIOError` const (return "") let vimrc = home </> ".vimrc.pandoc"- exists = doesFileExist &&>- (getPermissions >=> return . readable)+ exists = doesFileExist &&> (fmap readable . getPermissions) (&&>) = liftM2 andM- ($>) = liftM2 (<$>)- (bool "" . ("--noplugin -u '" ++) . (++ "'")) $> exists $ vimrc+ (<<$) = liftM2 (<$>)+ (bool "" . ("--noplugin -u '" ++) . (++ "'")) <<$ exists $ vimrc block <- withSystemTempFile "_vimhl_src." $ \src hsrc -> do P.hPutStr hsrc contents >> hFlush hsrc bracket (emptySystemTempFile "_vimhl_dst.") removeFile $