From 5bf912577092fd1fd8874ccc89370396f22b5388 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 14 Jan 2017 21:00:22 +0100 Subject: Removed readerOldDashes and --old-dashes option, added old_dashes extension. API change. CLI option change. --- src/Text/Pandoc.hs | 6 ++++-- src/Text/Pandoc/Extensions.hs | 1 + src/Text/Pandoc/Options.hs | 4 ---- src/Text/Pandoc/Parsing.hs | 2 +- src/Text/Pandoc/Readers/Textile.hs | 4 +--- 5 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') 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 -- cgit v1.2.3