mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-24 15:44:59 +08:00
Oops! Forgot to munch whitespace / ignore body after directive.
This commit is contained in:
@@ -539,13 +539,16 @@ bulletList = many1 (listItem bulletListStart) >>=
|
||||
|
||||
defaultRoleBlock :: GenParser Char ParserState Block
|
||||
defaultRoleBlock = try $ do
|
||||
string ".. default-role:: "
|
||||
string ".. default-role::"
|
||||
-- doesn't enforce any restrictions on the role name; embedded spaces shouldn't be allowed, for one
|
||||
role <- manyTill anyChar newline >>= return . removeLeadingTrailingSpace
|
||||
updateState $ \s -> s { stateRstDefaultRole =
|
||||
if null role
|
||||
then stateRstDefaultRole defaultParserState
|
||||
else role
|
||||
}
|
||||
-- skip body of the directive if it exists
|
||||
many $ blanklines <|> (spaceChar >> manyTill anyChar newline)
|
||||
return Null
|
||||
|
||||
--
|
||||
|
||||
@@ -315,6 +315,9 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
|
||||
,Para [Str "All",Space,Str "done",Str "."]
|
||||
,Header 1 [Str "Default",Str "-",Str "Role"]
|
||||
,Para [Str "Try",Space,Str "changing",Space,Str "the",Space,Str "default",Space,Str "role",Space,Str "to",Space,Str "a",Space,Str "few",Space,Str "different",Space,Str "things",Str "."]
|
||||
,Header 2 [Str "Doesn",Str "\8217",Str "t",Space,Str "Break",Space,Str "Title",Space,Str "Parsing"]
|
||||
,Para [Str "Inline",Space,Str "math",Str ":",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Other",Space,Str "roles",Str ":",Space,Superscript [Str "super"],Str ",",Space,Subscript [Str "sub"],Str "."]
|
||||
,Para [Math DisplayMath "\\alpha = beta",Math DisplayMath "E = mc^2"]
|
||||
,Para [Str "Some",Space,Superscript [Str "of"],Space,Str "these",Space,Superscript [Str "words"],Space,Str "are",Space,Str "in",Space,Superscript [Str "superscript"],Str "."]
|
||||
,Para [Str "Reset",Space,Str "default",Str "-",Str "role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default",Str "."]]
|
||||
,Para [Str "Reset",Space,Str "default",Str "-",Str "role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default",Str "."]
|
||||
,Para [Str "And",Space,Str "now",Space,Str "`",Str "some",Str "-",Str "invalid",Str "-",Str "string",Str "-",Str "3231231",Str "`",Space,Str "is",Space,Str "nonsense",Str "."]]
|
||||
|
||||
@@ -572,9 +572,17 @@ Try changing the default role to a few different things.
|
||||
|
||||
.. default-role:: math
|
||||
|
||||
Doesn't Break Title Parsing
|
||||
---------------------------
|
||||
|
||||
Inline math: `E=mc^2` or :math:`E=mc^2` or `E=mc^2`:math:.
|
||||
Other roles: :sup:`super`, `sub`:sub:.
|
||||
|
||||
.. math::
|
||||
\alpha = beta
|
||||
|
||||
E = mc^2
|
||||
|
||||
.. default-role:: sup
|
||||
|
||||
Some `of` these :sup:`words` are in `superscript`:sup:.
|
||||
@@ -583,3 +591,5 @@ Reset default-role to the default default.
|
||||
|
||||
.. default-role::
|
||||
|
||||
And now `some-invalid-string-3231231` is nonsense.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user