From aca4137c4094ec921276bf50278dfc58db5634a3 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Wed, 14 Mar 2018 12:23:51 +0300 Subject: Muse writer: only escape brackets when necessary It includes cases when they can be mistaken for footnotes and links, as well as inside link description. --- test/Tests/Writers/Muse.hs | 3 +++ test/writer.muse | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 88d2db8cf..eca7ed736 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -301,8 +301,11 @@ tests = [ testGroup "block elements" [ testGroup "string" [ "string" =: str "foo" =?> "foo" , "escape footnote" =: str "[1]" =?> "[1]" + , "do not escape brackets" =: str "[12ab]" =?> "[12ab]" , "escape verbatim close tag" =: str "foobar" =?> "foo</verbatim>bar" + , "escape link-like text" =: str "[[https://www.example.org]]" + =?> "[[https://www.example.org]]" , "escape pipe to avoid accidental tables" =: str "foo | bar" =?> "foo | bar" , "escape hash to avoid accidental anchors" =: text "#foo bar" diff --git a/test/writer.muse b/test/writer.muse index c534b63b3..83a53a1ab 100644 --- a/test/writer.muse +++ b/test/writer.muse @@ -576,9 +576,9 @@ Left brace: { Right brace: } -Left bracket: [ +Left bracket: [ -Right bracket: ] +Right bracket: ] Left paren: ( @@ -634,7 +634,7 @@ Indented [[/url][twice]]. Indented [[/url][thrice]]. -This should [not][] be a link. +This should [not][] be a link. [not]: /url @@ -690,8 +690,8 @@ Here is a movie [[movie.jpg][movie]] icon. * Footnotes Here is a footnote reference,[1] and another.[2] This should not be a -footnote reference, because it contains a space.[^my -note] Here is an inline note.[3] +footnote reference, because it contains a space.[^my note] Here is an inline +note.[3] Notes can go in quotes.[4] @@ -718,7 +718,7 @@ This paragraph should not be part of the note, as it is not indented. [3] This is easier to type. Inline notes may contain [[http://google.com][links]] and ] verbatim characters, as - well as [bracketed text]. + well as [bracketed text]. [4] In quote. -- cgit v1.2.3