Removed readerOldDashes and --old-dashes option, added old_dashes extension.
API change. CLI option change.
This commit is contained in:
parent
6f8b967d98
commit
5bf9125770
8 changed files with 22 additions and 33 deletions
13
MANUAL.txt
13
MANUAL.txt
|
@ -394,12 +394,6 @@ Reader options
|
|||
HTML codes and LaTeX environments. (The LaTeX reader does pass through
|
||||
untranslatable LaTeX *commands*, even if `-R` is not specified.)
|
||||
|
||||
`--old-dashes`
|
||||
|
||||
: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
|
||||
a numeral is an en-dash, and `--` is an em-dash. This option is selected
|
||||
automatically for `textile` input.
|
||||
|
||||
`--base-header-level=`*NUMBER*
|
||||
|
||||
: Specify the base level for headers (defaults to 1).
|
||||
|
@ -3401,6 +3395,13 @@ Note: 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.
|
||||
|
||||
#### Extension: `old_dashes` ####
|
||||
|
||||
Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
|
||||
`-` before a numeral is an en-dash, and `--` is an em-dash.
|
||||
This option only has an effect if `smart` is enabled. It is
|
||||
selected automatically for `textile` input.
|
||||
|
||||
#### Extension: `angle_brackets_escapable` ####
|
||||
|
||||
Allow `<` and `>` to be backslash-escaped, as they can be in
|
||||
|
|
|
@ -112,7 +112,6 @@ convertWithOpts opts args = do
|
|||
, optSectionDivs = sectionDivs
|
||||
, optIncremental = incremental
|
||||
, optSelfContained = selfContained
|
||||
, optOldDashes = oldDashes
|
||||
, optHtml5 = html5
|
||||
, optHtmlQTags = htmlQTags
|
||||
, optHighlight = highlight
|
||||
|
@ -302,7 +301,6 @@ convertWithOpts opts args = do
|
|||
, readerParseRaw = parseRaw
|
||||
, readerColumns = columns
|
||||
, readerTabStop = tabStop
|
||||
, readerOldDashes = oldDashes
|
||||
, readerIndentedCodeClasses = codeBlockClasses
|
||||
, readerApplyMacros = not laTeXOutput
|
||||
, readerDefaultImageExtension = defaultImageExtension
|
||||
|
@ -546,7 +544,6 @@ data Opt = Opt
|
|||
, optSectionDivs :: Bool -- ^ Put sections in div tags in HTML
|
||||
, optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5
|
||||
, optSelfContained :: Bool -- ^ Make HTML accessible offline
|
||||
, optOldDashes :: Bool -- ^ Parse dashes like pandoc <=1.8.2.1
|
||||
, optHtml5 :: Bool -- ^ Produce HTML5 in HTML
|
||||
, optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
|
||||
, optHighlight :: Bool -- ^ Highlight source code
|
||||
|
@ -611,7 +608,6 @@ defaultOpts = Opt
|
|||
, optSectionDivs = False
|
||||
, optIncremental = False
|
||||
, optSelfContained = False
|
||||
, optOldDashes = False
|
||||
, optHtml5 = False
|
||||
, optHtmlQTags = False
|
||||
, optHighlight = True
|
||||
|
@ -689,11 +685,6 @@ options =
|
|||
(\opt -> return opt { optParseRaw = True }))
|
||||
"" -- "Parse untranslatable HTML codes and LaTeX environments as raw"
|
||||
|
||||
, Option "" ["old-dashes"]
|
||||
(NoArg
|
||||
(\opt -> return opt { optOldDashes = True }))
|
||||
"" -- "Use smart quotes, dashes, and ellipses"
|
||||
|
||||
, Option "" ["base-header-level"]
|
||||
(ReqArg
|
||||
(\arg opt ->
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -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 '-'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Pandoc (Meta {unMeta = fromList []})
|
||||
[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."]
|
||||
[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."]
|
||||
,HorizontalRule
|
||||
,Header 1 ("headers",[],[]) [Str "Headers"]
|
||||
,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 []})
|
|||
,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
|
||||
,Header 6 ("level-6",[],[]) [Str "Level",Space,Str "6"]
|
||||
,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
|
||||
,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
|
||||
,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
|
||||
,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."]
|
||||
,Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
|
||||
,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
|
||||
,BulletList
|
||||
[[Plain [Str "criminey."]]]
|
||||
,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 []})
|
|||
,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 "."]
|
||||
,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"]]]
|
||||
,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."]
|
||||
,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "--",Space,Str "automatic",Space,Str "dashes."]
|
||||
,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."]
|
||||
,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."]
|
||||
,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes."]
|
||||
,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."]
|
||||
,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."]
|
||||
,Header 1 ("links",[],[]) [Str "Links"]
|
||||
,Header 2 ("explicit",[],[]) [Str "Explicit"]
|
||||
,Para [Str "Just",Space,Str "a",Space,Link ("",[],[]) [Str "url"] ("http://www.url.com","")]
|
||||
,Para [Link ("",[],[]) [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
|
||||
,Para [Str "\"not",Space,Str "a",Space,Str "link\":",Space,Str "foo"]
|
||||
,Para [Quoted DoubleQuote [Str "not",Space,Str "a",Space,Str "link"],Str ":",Space,Str "foo"]
|
||||
,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
|
||||
,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."]
|
||||
,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 []})
|
|||
,[[Plain [Str "bella"]]
|
||||
,[Plain [Str "45"]]
|
||||
,[Plain [Str "f"]]]]
|
||||
,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "..."]
|
||||
,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "\8230"]
|
||||
,Header 2 ("with-headers",[],[]) [Str "With",Space,Str "headers"]
|
||||
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
|
||||
[[Plain [Str "name"]]
|
||||
|
|
Loading…
Add table
Reference in a new issue