count div as newline
This commit is contained in:
@@ -132,7 +132,7 @@ fn handle_tag(s: &str) -> (String, usize) {
|
|||||||
(link, total_skip)
|
(link, total_skip)
|
||||||
}
|
}
|
||||||
// Line breaks and list items
|
// Line breaks and list items
|
||||||
"br" | "br/" | "li" | "/ol" | "/ul" => ("\r\n".to_string(), tag_content.len() + 1),
|
"div" | "br" | "br/" | "li" | "/ol" | "/ul" => ("\r\n".to_string(), tag_content.len() + 1),
|
||||||
|
|
||||||
// Paragraphs and headings
|
// Paragraphs and headings
|
||||||
"p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "/h1" | "/h2" | "/h3" | "/h4" | "/h5" | "/h6" => ("\r\n\r\n".to_string(), tag_content.len() + 1),
|
"p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "/h1" | "/h2" | "/h3" | "/h4" | "/h5" | "/h6" => ("\r\n\r\n".to_string(), tag_content.len() + 1),
|
||||||
@@ -230,7 +230,7 @@ mod tests {
|
|||||||
link_ignore_attributes_2: "<a rel=\"mw:WikiLink\" href=\"/wiki/yet#English\" title=\"yet\">yet</a>, <a rel=\"mw:WikiLink\" href=\"/wiki/not_yet#English\" title=\"not yet\">not yet</a>" to "yet (/wiki/yet#English), not yet (/wiki/not_yet#English)",
|
link_ignore_attributes_2: "<a rel=\"mw:WikiLink\" href=\"/wiki/yet#English\" title=\"yet\">yet</a>, <a rel=\"mw:WikiLink\" href=\"/wiki/not_yet#English\" title=\"not yet\">not yet</a>" to "yet (/wiki/yet#English), not yet (/wiki/not_yet#English)",
|
||||||
// Inline elements
|
// Inline elements
|
||||||
ignore_inline: "strong <strong>text</strong>" to "strong text",
|
ignore_inline: "strong <strong>text</strong>" to "strong text",
|
||||||
ignore_inline_attributes: "some <div id=\"a\" class=\"b\">div</div>" to "some div",
|
ignore_inline_attributes: "some <div id=\"a\" class=\"b\">div</div>" to "some \r\ndiv",
|
||||||
// Line breaks and spaces
|
// Line breaks and spaces
|
||||||
collapse_spaces: "should ignore more spaces" to "should ignore more spaces",
|
collapse_spaces: "should ignore more spaces" to "should ignore more spaces",
|
||||||
collapse_linebreaks: "a\nb\nc" to "a b c",
|
collapse_linebreaks: "a\nb\nc" to "a b c",
|
||||||
|
|||||||
Reference in New Issue
Block a user