Removed writerTeXLigatures.

Make `smart` extension work in LaTeX/ConTeXt writers instead.

Instead of `-t latex --no-tex-ligatures`, do `-t latex-smart`.
This commit is contained in:
John MacFarlane 2017-01-15 21:00:22 +01:00
parent 4f6e6247f9
commit 0bcc81c0b1
5 changed files with 16 additions and 33 deletions

View file

@ -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
---------

View file

@ -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 }))

View file

@ -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

View file

@ -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
'{' -> "\\{"
'}' -> "\\}"

View file

@ -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