mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 02:06:32 +00:00
Split Text.Pandoc.Version from Text.Pandoc.Shared.
This new module exports `pandocVersion` and `pandocVersionText`, which are no longer exported from Text.Pandoc.Shared. [API change] Also, we now set the `pandoc-version` variable centrally rather than in the writers. One effect is the man writer now emits a comment with the pandoc version (this was intended before, judging from the template, but it didn't happen because the vairable wasn't set).
This commit is contained in:
@@ -3158,6 +3158,9 @@ on the output format, and include the following:
|
||||
`curdir`
|
||||
: working directory from which pandoc is run.
|
||||
|
||||
`pandoc-version`
|
||||
: pandoc version.
|
||||
|
||||
`toc`
|
||||
: non-null value if `--toc/--table-of-contents` was specified
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import HsLua.CLI (EnvBehavior (..), Settings (..), runStandalone)
|
||||
import Text.Pandoc.Class (runIOorExplode)
|
||||
import Text.Pandoc.Error (handleError)
|
||||
import Text.Pandoc.Lua (runLua, runLuaNoEnv, getEngine)
|
||||
import Text.Pandoc.Shared (pandocVersionText)
|
||||
import Text.Pandoc.Version (pandocVersionText)
|
||||
|
||||
-- | Runs pandoc as a Lua interpreter that is (mostly) compatible with
|
||||
-- the default @lua@ program shipping with Lua.
|
||||
|
||||
@@ -24,7 +24,8 @@ import Data.Monoid (Any(..))
|
||||
import Control.Monad (when)
|
||||
import PandocCLI.Lua
|
||||
import PandocCLI.Server
|
||||
import Text.Pandoc.Shared (pandocVersion, defaultUserDataDir)
|
||||
import Text.Pandoc.Version (pandocVersion)
|
||||
import Text.Pandoc.Shared (defaultUserDataDir)
|
||||
import Text.Pandoc.Scripting (ScriptingEngine(..))
|
||||
import Data.Version (showVersion)
|
||||
import qualified Data.Text as T
|
||||
|
||||
@@ -25,7 +25,7 @@ import Text.Pandoc.Lua.Marshal.ReaderOptions (pushReaderOptionsReadonly)
|
||||
import Text.Pandoc.Lua.Marshal.WriterOptions (pushWriterOptions)
|
||||
import Text.Pandoc.Lua.PandocLua ()
|
||||
import Text.Pandoc.Options (ReaderOptions, WriterOptions)
|
||||
import Text.Pandoc.Shared (pandocVersion)
|
||||
import Text.Pandoc.Version (pandocVersion)
|
||||
|
||||
import qualified Data.Text as Text
|
||||
|
||||
|
||||
+2
-1
@@ -636,7 +636,8 @@ library
|
||||
Text.Pandoc.ImageSize,
|
||||
Text.Pandoc.Class,
|
||||
Text.Pandoc.Class.IO,
|
||||
Text.Pandoc.Citeproc
|
||||
Text.Pandoc.Citeproc,
|
||||
Text.Pandoc.Version
|
||||
other-modules: Text.Pandoc.App.CommandLineOptions,
|
||||
Text.Pandoc.App.FormatHeuristics,
|
||||
Text.Pandoc.App.Input,
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ import Text.Pandoc.Generic
|
||||
import Text.Pandoc.Logging
|
||||
import Text.Pandoc.Options
|
||||
import Text.Pandoc.Readers
|
||||
import Text.Pandoc.Shared (pandocVersion, pandocVersionText)
|
||||
import Text.Pandoc.Version (pandocVersion, pandocVersionText)
|
||||
import Text.Pandoc.Templates
|
||||
import Text.Pandoc.Translations (setTranslations, translateTerm)
|
||||
import Text.Pandoc.Writers
|
||||
|
||||
@@ -181,6 +181,8 @@ optToOutputSettings scriptingEngine opts = do
|
||||
>>=
|
||||
setVariableM "outputfile" (T.pack outputFile)
|
||||
>>=
|
||||
setVariableM "pandoc-version" pandocVersionText
|
||||
>>=
|
||||
setFilesVariableM "include-before" (optIncludeBeforeBody opts)
|
||||
>>=
|
||||
setFilesVariableM "include-after" (optIncludeAfterBody opts)
|
||||
|
||||
@@ -27,7 +27,8 @@ import Text.Pandoc.Definition (Pandoc)
|
||||
import Text.Pandoc.Error (PandocError (PandocFilterError))
|
||||
import Text.Pandoc.Filter.Environment (Environment (..))
|
||||
import Text.Pandoc.Process (pipeProcess)
|
||||
import Text.Pandoc.Shared (pandocVersionText, tshow)
|
||||
import Text.Pandoc.Version (pandocVersionText)
|
||||
import Text.Pandoc.Shared (tshow)
|
||||
import qualified Control.Exception as E
|
||||
import qualified Text.Pandoc.UTF8 as UTF8
|
||||
|
||||
|
||||
@@ -88,9 +88,6 @@ module Text.Pandoc.Shared (
|
||||
safeStrRead,
|
||||
-- * User data directory
|
||||
defaultUserDataDir,
|
||||
-- * Version
|
||||
pandocVersion,
|
||||
pandocVersionText
|
||||
) where
|
||||
|
||||
import Codec.Archive.Zip
|
||||
@@ -110,8 +107,6 @@ import Data.Monoid (Any (..))
|
||||
import Data.Sequence (ViewL (..), ViewR (..), viewl, viewr)
|
||||
import qualified Data.Set as Set
|
||||
import qualified Data.Text as T
|
||||
import Data.Version (Version, showVersion)
|
||||
import Paths_pandoc (version)
|
||||
import System.Directory
|
||||
import System.FilePath (isPathSeparator, splitDirectories)
|
||||
import qualified System.FilePath.Posix as Posix
|
||||
@@ -127,14 +122,6 @@ import Text.Pandoc.Generic (bottomUp)
|
||||
import Text.DocLayout (charWidth)
|
||||
import Text.Pandoc.Walk
|
||||
|
||||
-- | Version number of pandoc library.
|
||||
pandocVersion :: Version
|
||||
pandocVersion = version
|
||||
|
||||
-- | Text representation of the library's version number.
|
||||
pandocVersionText :: T.Text
|
||||
pandocVersionText = T.pack $ showVersion version
|
||||
|
||||
--
|
||||
-- List processing
|
||||
--
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{- |
|
||||
Module : Text.Pandoc.Version
|
||||
Copyright : Copyright (C) 2022 John MacFarlane
|
||||
License : GNU GPL, version 2 or above
|
||||
|
||||
Maintainer : John MacFarlane <jgm@berkeley.edu>
|
||||
Stability : alpha
|
||||
Portability : portable
|
||||
|
||||
Version information.
|
||||
-}
|
||||
module Text.Pandoc.Version (
|
||||
pandocVersion,
|
||||
pandocVersionText
|
||||
) where
|
||||
|
||||
import Data.Version (Version, showVersion)
|
||||
import Paths_pandoc (version)
|
||||
import qualified Data.Text as T
|
||||
|
||||
-- | Version number of pandoc library.
|
||||
pandocVersion :: Version
|
||||
pandocVersion = version
|
||||
|
||||
-- | Text representation of the library's version number.
|
||||
pandocVersionText :: T.Text
|
||||
pandocVersionText = T.pack $ showVersion version
|
||||
@@ -74,7 +74,7 @@ pandocToMan opts (Pandoc meta blocks) = do
|
||||
$ setFieldsFromTitle
|
||||
$ defField "has-tables" hasTables
|
||||
$ defField "hyphenate" True
|
||||
$ defField "pandoc-version" pandocVersionText metadata
|
||||
$ metadata
|
||||
return $ render colwidth $
|
||||
case writerTemplate opts of
|
||||
Nothing -> main
|
||||
|
||||
@@ -76,7 +76,6 @@ pandocToMs opts (Pandoc meta blocks) = do
|
||||
let context = defField "body" main
|
||||
$ defField "has-inline-math" hasInlineMath
|
||||
$ defField "hyphenate" True
|
||||
$ defField "pandoc-version" pandocVersionText
|
||||
$ defField "toc" (writerTableOfContents opts)
|
||||
$ defField "title-meta" titleMeta
|
||||
$ defField "author-meta" (T.intercalate "; " authorsMeta)
|
||||
|
||||
@@ -35,7 +35,8 @@ import Text.Pandoc.Logging
|
||||
import Text.Pandoc.MIME (extensionFromMimeType, getMimeType)
|
||||
import Text.Pandoc.Options (WrapOption (..), WriterOptions (..))
|
||||
import Text.DocLayout
|
||||
import Text.Pandoc.Shared (stringify, pandocVersionText, tshow)
|
||||
import Text.Pandoc.Shared (stringify, tshow)
|
||||
import Text.Pandoc.Version (pandocVersionText)
|
||||
import Text.Pandoc.Writers.Shared (lookupMetaString, lookupMetaBlocks,
|
||||
fixDisplayMath, getLang,
|
||||
ensureValidXmlIdentifiers)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.\" Automatically generated by Pandoc 3.0
|
||||
.\"
|
||||
.\" Define V font for inline verbatim, using C font in formats
|
||||
.\" that render this, and otherwise B font.
|
||||
.ie "\f[CB]x\f[]"x" \{\
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.\" Automatically generated by Pandoc 3.0
|
||||
.\"
|
||||
.\" **** Custom macro definitions *********************************
|
||||
.\" * Super/subscript
|
||||
.\" (https://lists.gnu.org/archive/html/groff/2012-07/msg00046.html)
|
||||
|
||||
Reference in New Issue
Block a user