From bd73d73a28acc2863bd52bdc6f0f9d850fa34d84 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 13 Aug 2013 18:25:20 -0700 Subject: Removed `--print-sample-lua-writer`, added `--print-default-data-file`. Closes #943. --- README | 7 +++---- pandoc.hs | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README b/README index e85ca1905..e5de97556 100644 --- a/README +++ b/README @@ -311,9 +311,8 @@ General writer options : Print the default template for an output *FORMAT*. (See `-t` for a list of possible *FORMAT*s.) -`--print-sample-lua-writer` -: Print a sample lua custom writer (see [Custom writers](#custom-writers), - below. +`--print-default-data-file=`*FILE* +: Print a default data file. `--no-wrap` : Disable text wrapping in output. By default, text is wrapped @@ -2759,7 +2758,7 @@ Creating a custom writer requires writing a lua function for each possible element in a pandoc document. To get a documented example which you can modify according to your needs, do - pandoc --print-sample-lua-writer + pandoc --print-default-data-file sample.lua Authors ======= diff --git a/pandoc.hs b/pandoc.hs index 81672e16c..1c0a49a73 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -33,8 +33,8 @@ module Main where import Text.Pandoc import Text.Pandoc.PDF (makePDF) import Text.Pandoc.Readers.LaTeX (handleIncludes) -import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, safeRead, - headerShift, normalize, err, warn ) +import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, readDataFile, + safeRead, headerShift, normalize, err, warn ) import Text.Pandoc.XML ( toEntities, fromEntities ) import Text.Pandoc.SelfContained ( makeSelfContained ) import Text.Pandoc.Process (pipeProcess) @@ -58,6 +58,7 @@ import Data.Foldable (foldrM) import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..)) import Network.URI (parseURI, isURI, URI(..)) import qualified Data.ByteString.Lazy as B +import qualified Data.ByteString as BS import Text.CSL.Reference (Reference(..)) import Data.Aeson (eitherDecode', encode) @@ -347,13 +348,13 @@ options = "FORMAT") "" -- "Print default template for FORMAT" - , Option "" ["print-sample-lua-writer"] - (NoArg - (\_ -> do - sample <- readDataFileUTF8 Nothing "sample.lua" - UTF8.hPutStr stdout sample - exitWith ExitSuccess)) - "" -- "Print sample lua custom writer" + , Option "" ["print-default-data-file"] + (ReqArg + (\arg _ -> do + readDataFile Nothing arg >>= BS.hPutStr stdout + exitWith ExitSuccess) + "FILE") + "" -- "Print default data file" , Option "" ["no-wrap"] (NoArg -- cgit v1.2.3