summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-05 20:08:00 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-05 20:08:00 -0800
commitc5f1a8ad2d2f7972e2c3e8bd22686bb99e84356d (patch)
treefddc9cc35071f7bb46477c9872f65d537506c7d6 /pandoc.hs
parent1aa74199cf26ce5c603b2431b821cbf39e8eccf9 (diff)
Added `--default-image-extension` and `readerDefaultImageExtension`.
Note: Currently this only affects the markdown reader.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs208
1 files changed, 109 insertions, 99 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 2b6ed3a46..dc7de52a8 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -137,61 +137,63 @@ data Opt = Opt
, optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2
, optAscii :: Bool -- ^ Use ascii characters only in html
, optTeXLigatures :: Bool -- ^ Use TeX ligatures for quotes/dashes
+ , optDefaultImageExtension :: String -- ^ Default image extension
}
-- | Defaults for command-line options.
defaultOpts :: Opt
defaultOpts = Opt
- { optTabStop = 4
- , optPreserveTabs = False
- , optStandalone = False
- , optReader = "" -- null for default reader
- , optWriter = "" -- null for default writer
- , optParseRaw = False
- , optTableOfContents = False
- , optTransforms = []
- , optTemplate = Nothing
- , optVariables = []
- , optOutputFile = "-" -- "-" means stdout
- , optNumberSections = False
- , optSectionDivs = False
- , optIncremental = False
- , optSelfContained = False
- , optSmart = False
- , optOldDashes = False
- , optHtml5 = False
- , optHtmlQTags = False
- , optHighlight = True
- , optHighlightStyle = pygments
- , optChapters = False
- , optHTMLMathMethod = PlainMath
- , optReferenceODT = Nothing
- , optReferenceDocx = Nothing
- , optEpubStylesheet = Nothing
- , optEpubMetadata = ""
- , optEpubFonts = []
- , optEpubChapterLevel = 1
- , optTOCDepth = 3
- , optDumpArgs = False
- , optIgnoreArgs = False
- , optReferenceLinks = False
- , optWrapText = True
- , optColumns = 72
- , optPlugins = []
- , optEmailObfuscation = JavascriptObfuscation
- , optIdentifierPrefix = ""
- , optIndentedCodeClasses = []
- , optDataDir = Nothing
- , optCiteMethod = Citeproc
- , optBibliography = []
- , optCslFile = Nothing
- , optAbbrevsFile = Nothing
- , optListings = False
- , optLaTeXEngine = "pdflatex"
- , optSlideLevel = Nothing
- , optSetextHeaders = True
- , optAscii = False
- , optTeXLigatures = True
+ { optTabStop = 4
+ , optPreserveTabs = False
+ , optStandalone = False
+ , optReader = "" -- null for default reader
+ , optWriter = "" -- null for default writer
+ , optParseRaw = False
+ , optTableOfContents = False
+ , optTransforms = []
+ , optTemplate = Nothing
+ , optVariables = []
+ , optOutputFile = "-" -- "-" means stdout
+ , optNumberSections = False
+ , optSectionDivs = False
+ , optIncremental = False
+ , optSelfContained = False
+ , optSmart = False
+ , optOldDashes = False
+ , optHtml5 = False
+ , optHtmlQTags = False
+ , optHighlight = True
+ , optHighlightStyle = pygments
+ , optChapters = False
+ , optHTMLMathMethod = PlainMath
+ , optReferenceODT = Nothing
+ , optReferenceDocx = Nothing
+ , optEpubStylesheet = Nothing
+ , optEpubMetadata = ""
+ , optEpubFonts = []
+ , optEpubChapterLevel = 1
+ , optTOCDepth = 3
+ , optDumpArgs = False
+ , optIgnoreArgs = False
+ , optReferenceLinks = False
+ , optWrapText = True
+ , optColumns = 72
+ , optPlugins = []
+ , optEmailObfuscation = JavascriptObfuscation
+ , optIdentifierPrefix = ""
+ , optIndentedCodeClasses = []
+ , optDataDir = Nothing
+ , optCiteMethod = Citeproc
+ , optBibliography = []
+ , optCslFile = Nothing
+ , optAbbrevsFile = Nothing
+ , optListings = False
+ , optLaTeXEngine = "pdflatex"
+ , optSlideLevel = Nothing
+ , optSetextHeaders = True
+ , optAscii = False
+ , optTeXLigatures = True
+ , optDefaultImageExtension = ""
}
-- | A list of functions, each transforming the options data structure
@@ -495,6 +497,12 @@ options =
(\opt -> return opt { optSectionDivs = True }))
"" -- "Put sections in div tags in HTML"
+ , Option "" ["default-image-extension"]
+ (ReqArg
+ (\arg opt -> return opt { optDefaultImageExtension = arg })
+ "extension")
+ "" -- "Default extension for extensionless images"
+
, Option "" ["email-obfuscation"]
(ReqArg
(\arg opt -> do
@@ -806,55 +814,56 @@ main = do
-- thread option data structure through all supplied option actions
opts <- foldl (>>=) (return defaultOpts') actions
- let Opt { optTabStop = tabStop
- , optPreserveTabs = preserveTabs
- , optStandalone = standalone
- , optReader = readerName
- , optWriter = writerName
- , optParseRaw = parseRaw
- , optVariables = variables
- , optTableOfContents = toc
- , optTransforms = transforms
- , optTemplate = templatePath
- , optOutputFile = outputFile
- , optNumberSections = numberSections
- , optSectionDivs = sectionDivs
- , optIncremental = incremental
- , optSelfContained = selfContained
- , optSmart = smart
- , optOldDashes = oldDashes
- , optHtml5 = html5
- , optHtmlQTags = htmlQTags
- , optHighlight = highlight
- , optHighlightStyle = highlightStyle
- , optChapters = chapters
- , optHTMLMathMethod = mathMethod
- , optReferenceODT = referenceODT
- , optReferenceDocx = referenceDocx
- , optEpubStylesheet = epubStylesheet
- , optEpubMetadata = epubMetadata
- , optEpubFonts = epubFonts
- , optEpubChapterLevel = epubChapterLevel
- , optTOCDepth = epubTOCDepth
- , optDumpArgs = dumpArgs
- , optIgnoreArgs = ignoreArgs
- , optReferenceLinks = referenceLinks
- , optWrapText = wrap
- , optColumns = columns
- , optEmailObfuscation = obfuscationMethod
- , optIdentifierPrefix = idPrefix
- , optIndentedCodeClasses = codeBlockClasses
- , optDataDir = mbDataDir
- , optBibliography = reffiles
- , optCslFile = mbCsl
- , optAbbrevsFile = cslabbrevs
- , optCiteMethod = citeMethod
- , optListings = listings
- , optLaTeXEngine = latexEngine
- , optSlideLevel = slideLevel
- , optSetextHeaders = setextHeaders
- , optAscii = ascii
- , optTeXLigatures = texLigatures
+ let Opt { optTabStop = tabStop
+ , optPreserveTabs = preserveTabs
+ , optStandalone = standalone
+ , optReader = readerName
+ , optWriter = writerName
+ , optParseRaw = parseRaw
+ , optVariables = variables
+ , optTableOfContents = toc
+ , optTransforms = transforms
+ , optTemplate = templatePath
+ , optOutputFile = outputFile
+ , optNumberSections = numberSections
+ , optSectionDivs = sectionDivs
+ , optIncremental = incremental
+ , optSelfContained = selfContained
+ , optSmart = smart
+ , optOldDashes = oldDashes
+ , optHtml5 = html5
+ , optHtmlQTags = htmlQTags
+ , optHighlight = highlight
+ , optHighlightStyle = highlightStyle
+ , optChapters = chapters
+ , optHTMLMathMethod = mathMethod
+ , optReferenceODT = referenceODT
+ , optReferenceDocx = referenceDocx
+ , optEpubStylesheet = epubStylesheet
+ , optEpubMetadata = epubMetadata
+ , optEpubFonts = epubFonts
+ , optEpubChapterLevel = epubChapterLevel
+ , optTOCDepth = epubTOCDepth
+ , optDumpArgs = dumpArgs
+ , optIgnoreArgs = ignoreArgs
+ , optReferenceLinks = referenceLinks
+ , optWrapText = wrap
+ , optColumns = columns
+ , optEmailObfuscation = obfuscationMethod
+ , optIdentifierPrefix = idPrefix
+ , optIndentedCodeClasses = codeBlockClasses
+ , optDataDir = mbDataDir
+ , optBibliography = reffiles
+ , optCslFile = mbCsl
+ , optAbbrevsFile = cslabbrevs
+ , optCiteMethod = citeMethod
+ , optListings = listings
+ , optLaTeXEngine = latexEngine
+ , optSlideLevel = slideLevel
+ , optSetextHeaders = setextHeaders
+ , optAscii = ascii
+ , optTeXLigatures = texLigatures
+ , optDefaultImageExtension = defaultImageExtension
} = opts
when dumpArgs $
@@ -996,6 +1005,7 @@ main = do
, readerCitationStyle = mbsty
, readerIndentedCodeClasses = codeBlockClasses
, readerApplyMacros = not laTeXOutput
+ , readerDefaultImageExtension = defaultImageExtension
}
let writerOptions = def { writerStandalone = standalone',