aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-29 09:45:38 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-29 09:45:38 -0800
commita276bb0a8a07650368f3007820b96909c2734ff0 (patch)
treea0de51ec9edeb7fe698010912ef01dbd4869a1d0
parent7751391fce9a51066e02ecbe3677e69224c2161d (diff)
downloadpandoc-a276bb0a8a07650368f3007820b96909c2734ff0.tar.gz
Let papersizes a0, a1, a2, ... be case-insensitive in LaTeX and ConTeXt.
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs7
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs6
2 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 63113ac82..f0f4cd00e 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -31,7 +31,7 @@ Conversion of 'Pandoc' format into ConTeXt.
-}
module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where
import Control.Monad.State.Strict
-import Data.Char (ord)
+import Data.Char (ord, isDigit)
import Data.List (intercalate, intersperse)
import Data.Maybe (mapMaybe)
import Data.Text (Text)
@@ -104,8 +104,9 @@ pandocToConTeXt options (Pandoc meta blocks) = do
$ defField "number-sections" (writerNumberSections options)
$ maybe id (defField "context-lang") mblang
$ (case getField "papersize" metadata of
- Just ("a4" :: String) -> resetField "papersize"
- ("A4" :: String)
+ Just (('a':d:ds) :: String)
+ | all isDigit (d:ds) -> resetField "papersize"
+ (('A':d:ds) :: String)
_ -> id) metadata
let context' = defField "context-dir" (toContextDir
$ getField "dir" context) context
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 156af4bb2..8620f989b 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -253,8 +253,10 @@ pandocToLaTeX options (Pandoc meta blocks) = do
defField "section-titles" True $
defField "geometry" geometryFromMargins $
(case getField "papersize" metadata of
- Just ("A4" :: String) -> resetField "papersize"
- ("a4" :: String)
+ -- uppercase a4, a5, etc.
+ Just (('A':d:ds) :: String)
+ | all isDigit (d:ds) -> resetField "papersize"
+ (('a':d:ds) :: String)
_ -> id)
metadata
let context' =