aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-01-14 21:00:22 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:42 +0100
commit5bf912577092fd1fd8874ccc89370396f22b5388 (patch)
tree16cecc3456e1bf7e339a6ccfa2826915cc4d6abd /src/Text
parent6f8b967d98ea4270aa2492688fbcdfe8bad150b2 (diff)
downloadpandoc-5bf912577092fd1fd8874ccc89370396f22b5388.tar.gz
Removed readerOldDashes and --old-dashes option, added old_dashes extension.
API change. CLI option change.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc.hs6
-rw-r--r--src/Text/Pandoc/Extensions.hs1
-rw-r--r--src/Text/Pandoc/Options.hs4
-rw-r--r--src/Text/Pandoc/Parsing.hs2
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs4
5 files changed, 7 insertions, 10 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 3671b08ad..f9e032f4f 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -338,8 +338,6 @@ getDefaultExtensions "plain" = plainExtensions
getDefaultExtensions "org" = extensionsFromList
[Ext_citations,
Ext_auto_identifiers]
-getDefaultExtensions "textile" = extensionsFromList
- [Ext_auto_identifiers]
getDefaultExtensions "html" = extensionsFromList
[Ext_auto_identifiers,
Ext_native_divs,
@@ -356,6 +354,10 @@ getDefaultExtensions "latex" = extensionsFromList
getDefaultExtensions "context" = extensionsFromList
[Ext_smart,
Ext_auto_identifiers]
+getDefaultExtensions "textile" = extensionsFromList
+ [Ext_old_dashes,
+ Ext_smart,
+ Ext_auto_identifiers]
getDefaultExtensions _ = extensionsFromList
[Ext_auto_identifiers]
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index 584aa18e2..7278ece61 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -131,6 +131,7 @@ data Extension =
| Ext_epub_html_exts -- ^ Recognise the EPUB extended version of HTML
| Ext_shortcut_reference_links -- ^ Shortcut reference links
| Ext_smart -- ^ "Smart" quotes, apostrophes, ellipses, dashes
+ | Ext_old_dashes -- ^ -- = em, - before number = en
deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
pandocExtensions :: Extensions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index f325e9905..61cb7b9ec 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -58,9 +58,6 @@ data ReaderOptions = ReaderOptions{
, readerParseRaw :: Bool -- ^ Parse raw HTML, LaTeX
, readerColumns :: Int -- ^ Number of columns in terminal
, readerTabStop :: Int -- ^ Tab stop
- , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
- -- in parsing dashes; -- is em-dash;
- -- - before numerial is en-dash
, readerApplyMacros :: Bool -- ^ Apply macros to TeX math
, readerIndentedCodeClasses :: [String] -- ^ Default classes for
-- indented code blocks
@@ -77,7 +74,6 @@ instance Default ReaderOptions
, readerParseRaw = False
, readerColumns = 80
, readerTabStop = 4
- , readerOldDashes = False
, readerApplyMacros = True
, readerIndentedCodeClasses = []
, readerDefaultImageExtension = ""
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index b92894dd7..e8f4c776c 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -1183,7 +1183,7 @@ ellipses = try (string "..." >> return (B.str "\8230"))
dash :: (HasReaderOptions st, Stream s m Char)
=> ParserT s st m Inlines
dash = try $ do
- oldDashes <- getOption readerOldDashes
+ oldDashes <- extensionEnabled Ext_old_dashes <$> getOption readerExtensions
if oldDashes
then do
char '-'
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 721b57f46..404913926 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -91,9 +91,7 @@ parseTextile = do
-- asked for, for better conversion to other light markup formats
oldOpts <- stateOptions `fmap` getState
updateState $ \state -> state{ stateOptions =
- oldOpts{ readerParseRaw = True
- , readerOldDashes = True
- } }
+ oldOpts{ readerParseRaw = True } }
many blankline
startPos <- getPosition
-- go through once just to get list of reference keys and notes