summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-11-19 20:18:06 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-11-19 20:30:41 -0800
commited1173ace6c545f5b98c2b84859db89a6b9e799d (patch)
treee12d51c062cb0910b63dcf6fb407889058acd9f2 /pandoc.hs
parentda4103bc42c2b1d41d5b75f70344f1e3c443dbbb (diff)
Rationalized behavior of --no-tex-ligatures and --smart.
This change makes `--no-tex-ligatures` affect the LaTeX reader as well as the LaTeX and ConTeXt writers. If it is used, the LaTeX reader will parse characters `` ` ``, `'`, and `-` literally, rather than parsing ligatures for quotation marks and dashes. And the LaTeX writer will print unicode quotation mark and dash characters literally, rather than converting them to the standard ASCII ligatures. Note that `--smart` has no affect on the LaTeX reader. `--smart` is still the default for all input formats when LaTeX or ConTeXt is the output format, *unless* `--no-tex-ligatures` is used. Some examples to illustrate the logic: ``` % echo "'hi'" | pandoc -t latex `hi' % echo "'hi'" | pandoc -t latex --no-tex-ligatures 'hi' % echo "'hi'" | pandoc -t latex --no-tex-ligatures --smart ‘hi’ % echo "'hi'" | pandoc -f latex --no-tex-ligatures <p>'hi'</p> % echo "'hi'" | pandoc -f latex <p>’hi’</p> ``` Closes #2541.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/pandoc.hs b/pandoc.hs
index edcaa4bb9..2353ebb11 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1176,6 +1176,9 @@ main = do
"beamer" `isPrefixOf` writerName'
let conTeXtOutput = "context" `isPrefixOf` writerName'
+ let laTeXInput = "latex" `isPrefixOf` readerName' ||
+ "beamer" `isPrefixOf` readerName'
+
writer <- if ".lua" `isSuffixOf` writerName'
-- note: use non-lowercased version writerName
then return $ IOStringWriter $ writeCustom writerName
@@ -1257,8 +1260,10 @@ main = do
uriFragment = "" }
_ -> Nothing
- let readerOpts = def{ readerSmart = smart || (texLigatures &&
- (laTeXOutput || conTeXtOutput))
+ let readerOpts = def{ readerSmart = if laTeXInput
+ then texLigatures
+ else smart || (texLigatures &&
+ (laTeXOutput || conTeXtOutput))
, readerStandalone = standalone'
, readerParseRaw = parseRaw
, readerColumns = columns