diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-04-01 15:52:32 -0700 |
---|---|---|
committer | mb21 <mb21@users.noreply.github.com> | 2015-07-27 21:52:43 +0200 |
commit | 5df099957e0ed252a4d36161fc6c4ce7b18f528b (patch) | |
tree | 0abf62e67dfdd1d57b9512f66a39dc367c9985e1 /pandoc.hs | |
parent | 2e8064346d17bbb25a16650fc074393e834d67f7 (diff) | |
download | pandoc-5df099957e0ed252a4d36161fc6c4ce7b18f528b.tar.gz |
Text.Pandoc.Options: modifications for image attributes.
* Added `Ext_common_link_attributes` constructor to `Extension`
(for link and image attributes).
* Added this to `pandocExtensions` and `phpMarkdownExtraExtensions`.
* Added `writerDpi` to `WriterOptions`.
* pandoc.hs: Added `--dpi` option.
* Updated README for `--dpi` and `common_link_attributes` extension.
Patch due to mb21, with some modifications: `writerDpi` is now an
`Int` rather than a `Double`.
Diffstat (limited to 'pandoc.hs')
-rw-r--r-- | pandoc.hs | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -196,6 +196,7 @@ data Opt = Opt , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments , optVerbose :: Bool -- ^ Verbose diagnostic output , optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst + , optDpi :: Int -- ^ Dpi , optWrapText :: Bool -- ^ Wrap text , optColumns :: Int -- ^ Line length in characters , optFilters :: [FilePath] -- ^ Filters to apply @@ -258,6 +259,7 @@ defaultOpts = Opt , optIgnoreArgs = False , optVerbose = False , optReferenceLinks = False + , optDpi = 96 , optWrapText = True , optColumns = 72 , optFilters = [] @@ -454,6 +456,16 @@ options = "FILE") "" -- "Print default data file" + , Option "" ["dpi"] + (ReqArg + (\arg opt -> + case safeRead arg of + Just t | t > 0 -> return opt { optDpi = t } + _ -> err 31 + "dpi must be a number greater than 0") + "NUMBER") + "" -- "Dpi (default 96)" + , Option "" ["no-wrap"] (NoArg (\opt -> return opt { optWrapText = False })) @@ -1012,8 +1024,8 @@ extractMedia media dir d = return $ walk (adjustImagePath dir fps) d adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline -adjustImagePath dir paths (Image lab (src, tit)) - | src `elem` paths = Image lab (dir ++ "/" ++ src, tit) +adjustImagePath dir paths (Image attr lab (src, tit)) + | src `elem` paths = Image attr lab (dir ++ "/" ++ src, tit) adjustImagePath _ _ x = x adjustMetadata :: M.Map String MetaValue -> Pandoc -> IO Pandoc @@ -1087,6 +1099,7 @@ main = do , optIgnoreArgs = ignoreArgs , optVerbose = verbose , optReferenceLinks = referenceLinks + , optDpi = dpi , optWrapText = wrap , optColumns = columns , optFilters = filters @@ -1304,6 +1317,7 @@ main = do writerNumberOffset = numberFrom, writerSectionDivs = sectionDivs, writerReferenceLinks = referenceLinks, + writerDpi = dpi, writerWrapText = wrap, writerColumns = columns, writerEmailObfuscation = obfuscationMethod, |