git.iko.soy/typeable/pandoc
on master help sign in
Removed readerOldDashes and --old-dashes option, added old_dashes extension.

API change. CLI option change.

commit5bf912577092fd1fd8874ccc89370396f22b5388 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 14 Jan 2017, 21:00 (10 years ago) parent6f8b967
8 files changed+22−33
MANUAL.txt+7−6 pandoc.hs−9 src/Text/Pandoc.hs+4−2 src/Text/Pandoc/Extensions.hs+1 src/Text/Pandoc/Options.hs−4 src/Text/Pandoc/Parsing.hs+1−1 src/Text/Pandoc/Readers/Textile.hs+1−3 tests/textile-reader.native+8−8
MANUAL.txt+7−6
@@ -394,12 +394,6 @@ Reader options
394394 HTML codes and LaTeX environments. (The LaTeX reader does pass through
395395 untranslatable LaTeX *commands*, even if `-R` is not specified.)
396396
397−`--old-dashes`
398−
399−: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
400− a numeral is an en-dash, and `--` is an em-dash. This option is selected
401− automatically for `textile` input.
402−
403397`--base-header-level=`*NUMBER*
404398
405399: Specify the base level for headers (defaults to 1).
@@ -3401,6 +3395,13 @@ Note: if your LaTeX template or any included header file call
34013395for the [`csquotes`] package, pandoc will detect this
34023396automatically and use `\enquote{...}` for quoted text.
34033397
3398+#### Extension: `old_dashes` ####
3399+
3400+Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
3401+`-` before a numeral is an en-dash, and `--` is an em-dash.
3402+This option only has an effect if `smart` is enabled. It is
3403+selected automatically for `textile` input.
3404+
34043405#### Extension: `angle_brackets_escapable` ####
34053406
34063407Allow `<` and `>` to be backslash-escaped, as they can be in
pandoc.hs−9
@@ -112,7 +112,6 @@ convertWithOpts opts args = do
112112 , optSectionDivs = sectionDivs
113113 , optIncremental = incremental
114114 , optSelfContained = selfContained
115− , optOldDashes = oldDashes
116115 , optHtml5 = html5
117116 , optHtmlQTags = htmlQTags
118117 , optHighlight = highlight
@@ -302,7 +301,6 @@ convertWithOpts opts args = do
302301 , readerParseRaw = parseRaw
303302 , readerColumns = columns
304303 , readerTabStop = tabStop
305− , readerOldDashes = oldDashes
306304 , readerIndentedCodeClasses = codeBlockClasses
307305 , readerApplyMacros = not laTeXOutput
308306 , readerDefaultImageExtension = defaultImageExtension
@@ -546,7 +544,6 @@ data Opt = Opt
546544 , optSectionDivs :: Bool -- ^ Put sections in div tags in HTML
547545 , optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5
548546 , optSelfContained :: Bool -- ^ Make HTML accessible offline
549− , optOldDashes :: Bool -- ^ Parse dashes like pandoc <=1.8.2.1
550547 , optHtml5 :: Bool -- ^ Produce HTML5 in HTML
551548 , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
552549 , optHighlight :: Bool -- ^ Highlight source code
@@ -611,7 +608,6 @@ defaultOpts = Opt
611608 , optSectionDivs = False
612609 , optIncremental = False
613610 , optSelfContained = False
614− , optOldDashes = False
615611 , optHtml5 = False
616612 , optHtmlQTags = False
617613 , optHighlight = True
@@ -689,11 +685,6 @@ options =
689685 (\opt -> return opt { optParseRaw = True }))
690686 "" -- "Parse untranslatable HTML codes and LaTeX environments as raw"
691687
692− , Option "" ["old-dashes"]
693− (NoArg
694− (\opt -> return opt { optOldDashes = True }))
695− "" -- "Use smart quotes, dashes, and ellipses"
696−
697688 , Option "" ["base-header-level"]
698689 (ReqArg
699690 (\arg opt ->
src/Text/Pandoc.hs+4−2
@@ -338,8 +338,6 @@ getDefaultExtensions "plain" = plainExtensions
338338getDefaultExtensions "org" = extensionsFromList
339339 [Ext_citations,
340340 Ext_auto_identifiers]
341−getDefaultExtensions "textile" = extensionsFromList
342− [Ext_auto_identifiers]
343341getDefaultExtensions "html" = extensionsFromList
344342 [Ext_auto_identifiers,
345343 Ext_native_divs,
@@ -356,6 +354,10 @@ getDefaultExtensions "latex" = extensionsFromList
356354getDefaultExtensions "context" = extensionsFromList
357355 [Ext_smart,
358356 Ext_auto_identifiers]
357+getDefaultExtensions "textile" = extensionsFromList
358+ [Ext_old_dashes,
359+ Ext_smart,
360+ Ext_auto_identifiers]
359361getDefaultExtensions _ = extensionsFromList
360362 [Ext_auto_identifiers]
361363
src/Text/Pandoc/Extensions.hs+1
@@ -131,6 +131,7 @@ data Extension =
131131 | Ext_epub_html_exts -- ^ Recognise the EPUB extended version of HTML
132132 | Ext_shortcut_reference_links -- ^ Shortcut reference links
133133 | Ext_smart -- ^ "Smart" quotes, apostrophes, ellipses, dashes
134+ | Ext_old_dashes -- ^ -- = em, - before number = en
134135 deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
135136
136137pandocExtensions :: Extensions
src/Text/Pandoc/Options.hs−4
@@ -58,9 +58,6 @@ data ReaderOptions = ReaderOptions{
5858 , readerParseRaw :: Bool -- ^ Parse raw HTML, LaTeX
5959 , readerColumns :: Int -- ^ Number of columns in terminal
6060 , readerTabStop :: Int -- ^ Tab stop
61− , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
62− -- in parsing dashes; -- is em-dash;
63− -- - before numerial is en-dash
6461 , readerApplyMacros :: Bool -- ^ Apply macros to TeX math
6562 , readerIndentedCodeClasses :: [String] -- ^ Default classes for
6663 -- indented code blocks
@@ -77,7 +74,6 @@ instance Default ReaderOptions
7774 , readerParseRaw = False
7875 , readerColumns = 80
7976 , readerTabStop = 4
80− , readerOldDashes = False
8177 , readerApplyMacros = True
8278 , readerIndentedCodeClasses = []
8379 , readerDefaultImageExtension = ""
src/Text/Pandoc/Parsing.hs+1−1
@@ -1183,7 +1183,7 @@ ellipses = try (string "..." >> return (B.str "\8230"))
11831183dash :: (HasReaderOptions st, Stream s m Char)
11841184 => ParserT s st m Inlines
11851185dash = try $ do
1186− oldDashes <- getOption readerOldDashes
1186+ oldDashes <- extensionEnabled Ext_old_dashes <$> getOption readerExtensions
11871187 if oldDashes
11881188 then do
11891189 char '-'
src/Text/Pandoc/Readers/Textile.hs+1−3
@@ -91,9 +91,7 @@ parseTextile = do
9191 -- asked for, for better conversion to other light markup formats
9292 oldOpts <- stateOptions `fmap` getState
9393 updateState $ \state -> state{ stateOptions =
94− oldOpts{ readerParseRaw = True
95− , readerOldDashes = True
96− } }
94+ oldOpts{ readerParseRaw = True } }
9795 many blankline
9896 startPos <- getPosition
9997 -- go through once just to get list of reference keys and notes
tests/textile-reader.native+8−8
@@ -1,5 +1,5 @@
11Pandoc (Meta {unMeta = fromList []})
2−[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Space,Str "Textile",Space,Str "Reader.",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
2+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Space,Str "Textile",Space,Str "Reader.",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
33,HorizontalRule
44,Header 1 ("headers",[],[]) [Str "Headers"]
55,Header 2 ("level-2-with-an-embeded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link ("",[],[]) [Str "embeded",Space,Str "link"] ("http://www.example.com","")]
@@ -8,9 +8,9 @@ Pandoc (Meta {unMeta = fromList []})
88,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
99,Header 6 ("level-6",[],[]) [Str "Level",Space,Str "6"]
1010,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
11−,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
11+,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
1212,Para [Str "Line",Space,Str "breaks",Space,Str "are",Space,Str "preserved",Space,Str "in",Space,Str "textile,",Space,Str "so",Space,Str "you",Space,Str "can",Space,Str "not",Space,Str "wrap",Space,Str "your",Space,Str "very",LineBreak,Str "long",Space,Str "paragraph",Space,Str "with",Space,Str "your",Space,Str "favourite",Space,Str "text",Space,Str "editor",Space,Str "and",Space,Str "have",Space,Str "it",Space,Str "rendered",LineBreak,Str "with",Space,Str "no",Space,Str "break."]
13−,Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
13+,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
1414,BulletList
1515 [[Plain [Str "criminey."]]]
1616,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "paragraph",Space,Str "break",Space,Str "between",Space,Str "here"]
@@ -89,14 +89,14 @@ Pandoc (Meta {unMeta = fromList []})
8989,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str ".",LineBreak,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str ".",LineBreak,Str "Hyphenated-words-are-ok,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "strange_underscore_notation.",LineBreak,Str "A",Space,Link ("",[],[]) [Strong [Str "strong",Space,Str "link"]] ("http://www.foobar.com",""),Str "."]
9090,Para [Emph [Strong [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]],LineBreak,Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Space,Str "and",Space,Emph [Strong [Str "that",Space,Str "one"]],Str ".",LineBreak,Strikeout [Str "This",Space,Str "is",Space,Str "strikeout",Space,Str "and",Space,Strong [Str "strong"]]]
9191,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Space,Superscript [Strong [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str ".",LineBreak,Str "Subscripts:",Space,Subscript [Str "here"],Space,Str "H",Space,Subscript [Str "2"],Str "O,",Space,Str "H",Space,Subscript [Str "23"],Str "O,",Space,Str "H",Space,Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O."]
92−,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "--",Space,Str "automatic",Space,Str "dashes."]
93−,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "...",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more."]
94−,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Str "\"I'd",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you\"",Space,Str "for",Space,Str "example."]
92+,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes."]
93+,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "\8230",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more."]
94+,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I\8217d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example."]
9595,Header 1 ("links",[],[]) [Str "Links"]
9696,Header 2 ("explicit",[],[]) [Str "Explicit"]
9797,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "url"] ("http://www.url.com","")]
9898,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
99−,Para [Str "\"not",Space,Str "a",Space,Str "link\":",Space,Str "foo"]
99+,Para [Quoted DoubleQuote [Str "not",Space,Str "a",Space,Str "link"],Str ":",Space,Str "foo"]
100100,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
101101,Para [Link ("",[],[]) [Str "Example"] ("http://www.example.com/",""),Str ":",Space,Str "Example",Space,Str "of",Space,Str "a",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "colon."]
102102,Para [Str "A",Space,Str "link",Link ("",[],[]) [Str "with",Space,Str "brackets"] ("http://www.example.com",""),Str "and",Space,Str "no",Space,Str "spaces."]
@@ -117,7 +117,7 @@ Pandoc (Meta {unMeta = fromList []})
117117 ,[[Plain [Str "bella"]]
118118 ,[Plain [Str "45"]]
119119 ,[Plain [Str "f"]]]]
120−,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "..."]
120+,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "\8230"]
121121,Header 2 ("with-headers",[],[]) [Str "With",Space,Str "headers"]
122122,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
123123 [[Plain [Str "name"]]