From 0bcc81c0b149f1ae3eda7ce72f28199e48744a76 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 15 Jan 2017 21:00:22 +0100 Subject: Removed writerTeXLigatures. Make `smart` extension work in LaTeX/ConTeXt writers instead. Instead of `-t latex --no-tex-ligatures`, do `-t latex-smart`. --- MANUAL.txt | 30 ++++++++++++------------------ pandoc.hs | 9 --------- src/Text/Pandoc/Options.hs | 2 -- src/Text/Pandoc/Writers/ConTeXt.hs | 2 +- src/Text/Pandoc/Writers/LaTeX.hs | 6 +++--- 5 files changed, 16 insertions(+), 33 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index 2b55b8239..171f55955 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -697,20 +697,6 @@ Options affecting specific writers be numbered "1.5", specify `--number-offset=1,4`. Offsets are 0 by default. Implies `--number-sections`. -`--no-tex-ligatures` - -: Do not use the TeX ligatures for quotation marks, apostrophes, - and dashes (`` `...' ``, ` ``..'' `, `--`, `---`) when - writing or reading LaTeX or ConTeXt. In reading LaTeX, - parse the characters `` ` ``, `'`, and `-` literally, rather - than parsing ligatures for quotation marks and dashes. In - writing LaTeX or ConTeXt, print unicode quotation mark and - dash characters literally, rather than converting them to - the standard ASCII TeX ligatures. Note: If you use literal - curly quotes, dashes, and ellipses in your source, then you - may want to use disable the `smart` extension in your - source format. - `--listings` : Use the [`listings`] package for LaTeX code blocks @@ -3185,15 +3171,23 @@ Typography Interpret straight quotes as curly quotes, `---` as em-dashes, `--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are -inserted after certain abbreviations, such as "Mr." +inserted after certain abbreviations, such as "Mr." This +option currently affects the input formats `markdown`, +`commonmark`, `latex`, `mediawiki`, `org`, `rst`, and `twiki`, +and the output formats `markdown`, `latex`, and `context`. Note: If you are *writing* Markdown, then the `smart` extension has the reverse effect: what would have been curly quotes comes out straight. -If your LaTeX template or any included header file call -for the [`csquotes`] package, pandoc will detect this -automatically and use `\enquote{...}` for quoted text. +In LaTeX, `smart` means to use the standard TeX ligatures +for quotation marks (` `` ` and ` '' ` for double quotes, +`` ` `` and `` ' `` for single quotes) and dashes (`--` for +en-dash and `---` for em-dash). If `smart` is disabled, +then in reading LaTeX pandoc will parse these characters +literally. In writing LaTeX, enabling `smart` tells pandoc +to use the ligatures when possible; if `smart` is disabled +pandoc will use unicode quotation mark and dash characters. Citations --------- diff --git a/pandoc.hs b/pandoc.hs index 0baf555de..fe9cdba00 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -146,7 +146,6 @@ convertWithOpts opts args = do , optSlideLevel = slideLevel , optSetextHeaders = setextHeaders , optAscii = ascii - , optTeXLigatures = texLigatures , optDefaultImageExtension = defaultImageExtension , optExtractMedia = mbExtractMedia , optTrace = trace @@ -330,7 +329,6 @@ convertWithOpts opts args = do writerHighlight = highlight, writerHighlightStyle = highlightStyle, writerSetextHeaders = setextHeaders, - writerTeXLigatures = texLigatures, writerEpubMetadata = epubMetadata, writerEpubStylesheet = epubStylesheet, writerEpubFonts = epubFonts, @@ -570,7 +568,6 @@ data Opt = Opt , optSlideLevel :: Maybe Int -- ^ Header level that creates slides , 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 , optExtractMedia :: Maybe FilePath -- ^ Path to extract embedded media , optTrace :: Bool -- ^ Print debug information @@ -634,7 +631,6 @@ defaultOpts = Opt , optSlideLevel = Nothing , optSetextHeaders = True , optAscii = False - , optTeXLigatures = True , optDefaultImageExtension = "" , optExtractMedia = Nothing , optTrace = False @@ -955,11 +951,6 @@ options = "NUMBERS") "" -- "Starting number for sections, subsections, etc." - , Option "" ["no-tex-ligatures"] - (NoArg - (\opt -> return opt { optTeXLigatures = False })) - "" -- "Don't use tex ligatures for quotes, dashes" - , Option "" ["listings"] (NoArg (\opt -> return opt { optListings = True })) diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 5e4c51abf..4fe92dbbf 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -178,7 +178,6 @@ data WriterOptions = WriterOptions , writerHighlight :: Bool -- ^ Highlight source code , writerHighlightStyle :: Style -- ^ Style to use for highlighting , writerSetextHeaders :: Bool -- ^ Use setext headers for levels 1-2 in markdown - , writerTeXLigatures :: Bool -- ^ Use tex ligatures quotes, dashes in latex , writerEpubVersion :: Maybe EPUBVersion -- ^ Nothing or EPUB version , writerEpubMetadata :: String -- ^ Metadata to include in EPUB , writerEpubStylesheet :: Maybe String -- ^ EPUB stylesheet specified at command line @@ -224,7 +223,6 @@ instance Default WriterOptions where , writerHighlight = False , writerHighlightStyle = pygments , writerSetextHeaders = True - , writerTeXLigatures = True , writerEpubVersion = Nothing , writerEpubMetadata = "" , writerEpubStylesheet = Nothing diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index c8a4abfd5..b997c306a 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -111,7 +111,7 @@ toContextDir _ = "" -- | escape things as needed for ConTeXt escapeCharForConTeXt :: WriterOptions -> Char -> String escapeCharForConTeXt opts ch = - let ligatures = writerTeXLigatures opts in + let ligatures = isEnabled Ext_smart opts in case ch of '{' -> "\\{" '}' -> "\\}" diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index dbb8e4326..d9a31751e 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -272,7 +272,7 @@ stringToLaTeX _ [] = return "" stringToLaTeX ctx (x:xs) = do opts <- gets stOptions rest <- stringToLaTeX ctx xs - let ligatures = writerTeXLigatures opts && ctx == TextString + let ligatures = isEnabled Ext_smart opts && ctx == TextString let isUrl = ctx == URLString when (x == '€') $ modify $ \st -> st{ stUsesEuro = True } @@ -938,11 +938,11 @@ inlineToLaTeX (Quoted qt lst) = do let inner = s1 <> contents <> s2 return $ case qt of DoubleQuote -> - if writerTeXLigatures opts + if isEnabled Ext_smart opts then text "``" <> inner <> text "''" else char '\x201C' <> inner <> char '\x201D' SingleQuote -> - if writerTeXLigatures opts + if isEnabled Ext_smart opts then char '`' <> inner <> char '\'' else char '\x2018' <> inner <> char '\x2019' inlineToLaTeX (Str str) = liftM text $ stringToLaTeX TextString str -- cgit v1.2.3