vdoc: fix wrong escaping in HTML docs (#10638)
parent
6674d65397
commit
0f09228adb
|
@ -4,6 +4,7 @@ import os
|
|||
import net.urllib
|
||||
import strings
|
||||
import markdown
|
||||
import regex
|
||||
import v.scanner
|
||||
import v.ast
|
||||
import v.token
|
||||
|
@ -493,7 +494,12 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
|
|||
}
|
||||
|
||||
fn html_tag_escape(str string) string {
|
||||
return str.replace_each(['<', '<', '>', '>'])
|
||||
excaped_string := str.replace_each(['<', '<', '>', '>'])
|
||||
mut re := regex.regex_opt(r'`.+[(<)(>)].+`') or { regex.RE{} }
|
||||
if re.find_all_str(excaped_string).len > 0 {
|
||||
return str
|
||||
}
|
||||
return excaped_string
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
module main
|
||||
|
||||
fn test_html_tag_escape() {
|
||||
assert html_tag_escape('<abc>') == '<abc>'
|
||||
assert html_tag_escape('`<abc>`') == '`<abc>`'
|
||||
}
|
Loading…
Reference in New Issue