Muse writer: escape > less often
> should be escaped only when it can start verse, i.e., at the beginning of the line.
This commit is contained in:
parent
72878adc63
commit
782ab73aa3
3 changed files with 6 additions and 4 deletions
|
@ -324,7 +324,7 @@ containsFootnotes st =
|
|||
|
||||
conditionalEscapeString :: Bool -> String -> String
|
||||
conditionalEscapeString isInsideLinkDescription s =
|
||||
if any (`elem` ("#*<=>|" :: String)) s ||
|
||||
if any (`elem` ("#*<=|" :: String)) s ||
|
||||
"::" `isInfixOf` s ||
|
||||
"~~" `isInfixOf` s ||
|
||||
"[[" `isInfixOf` s ||
|
||||
|
@ -403,6 +403,7 @@ isHorizontalRule s =
|
|||
fixOrEscape :: Bool -> Inline -> Bool
|
||||
fixOrEscape sp (Str "-") = sp
|
||||
fixOrEscape sp (Str ";") = not sp
|
||||
fixOrEscape _ (Str ">") = True
|
||||
fixOrEscape sp (Str s) = (sp && (startsWithMarker isDigit s ||
|
||||
startsWithMarker isAsciiLower s ||
|
||||
startsWithMarker isAsciiUpper s))
|
||||
|
|
|
@ -264,6 +264,7 @@ tests = [ testGroup "block elements"
|
|||
, "escape long horizontal rule" =: para (text "----------") =?> "<verbatim></verbatim>----------"
|
||||
, "don't escape horizontal inside paragraph" =: para (text "foo ---- bar") =?> "foo ---- bar"
|
||||
, "escape nonbreaking space" =: para (text "~~") =?> "<verbatim>~~</verbatim>"
|
||||
, "escape > in the beginning of line" =: para (text "> foo bar") =?> "<verbatim></verbatim>> foo bar"
|
||||
, testGroup "tables"
|
||||
[ "table without header" =:
|
||||
let rows = [[para $ text "Para 1.1", para $ text "Para 1.2"]
|
||||
|
|
|
@ -79,7 +79,7 @@ nested
|
|||
</quote>
|
||||
</quote>
|
||||
|
||||
This should not be a block quote: 2 <verbatim>></verbatim> 1.
|
||||
This should not be a block quote: 2 > 1.
|
||||
|
||||
And a following paragraph.
|
||||
|
||||
|
@ -562,7 +562,7 @@ This & that.
|
|||
|
||||
4 <verbatim><</verbatim> 5.
|
||||
|
||||
6 <verbatim>></verbatim> 5.
|
||||
6 > 5.
|
||||
|
||||
Backslash: \
|
||||
|
||||
|
@ -584,7 +584,7 @@ Left paren: (
|
|||
|
||||
Right paren: )
|
||||
|
||||
Greater-than: <verbatim>></verbatim>
|
||||
Greater-than: >
|
||||
|
||||
Hash: <verbatim>#</verbatim>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue