File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: ae5ea85c361e2b383b01c1101d731843795ea0cb
5
+ refs/heads/try: e536e8a93354cd2b4e5ecc87eb0fdf30b835859c
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -7,6 +7,20 @@ fn mk_pass() -> pass {
7
7
}
8
8
9
9
fn escape ( s : str ) -> str {
10
+ let parts = str:: split_char ( s, '`' ) ;
11
+ let i = 0 ;
12
+ let parts = vec:: map ( parts) { |part|
13
+ i += 1 ;
14
+ if i % 2 != 0 {
15
+ escape_ ( part)
16
+ } else {
17
+ part
18
+ }
19
+ } ;
20
+ ret str:: connect ( parts, "`" ) ;
21
+ }
22
+
23
+ fn escape_ ( s : str ) -> str {
10
24
let s = str:: replace ( s, "&" , "&" ) ;
11
25
let s = str:: replace ( s, "<" , "<" ) ;
12
26
let s = str:: replace ( s, ">" , ">" ) ;
@@ -22,3 +36,9 @@ fn test() {
22
36
assert escape ( "\" " ) == """ ;
23
37
assert escape ( "<>&\" " ) == "<>&"" ;
24
38
}
39
+
40
+ #[ test]
41
+ fn should_not_escape_characters_in_backticks ( ) {
42
+ // Markdown will quote things in backticks itself
43
+ assert escape ( "<`<`<`<`<" ) == "<`<`<`<`<" ;
44
+ }
You can’t perform that action at this time.
0 commit comments