Drop `<!-- … -->` spans so template guidance comments never trip the embedded-directive check.
(line: &str)
| 271 | /// Drop `<!-- … -->` spans so template guidance comments never trip the |
| 272 | /// embedded-directive check. |
| 273 | fn strip_html_comments(line: &str) -> String { |
| 274 | let mut out = String::with_capacity(line.len()); |
| 275 | let mut rest = line; |
| 276 | while let Some(open) = rest.find("<!--") { |
| 277 | out.push_str(&rest[..open]); |
| 278 | match rest[open..].find("-->") { |
| 279 | Some(close) => rest = &rest[open + close + 3..], |
| 280 | None => return out, |
| 281 | } |
| 282 | } |
| 283 | out.push_str(rest); |
| 284 | out |
| 285 | } |
| 286 | |
| 287 | fn check_known(name: &str) -> Result<()> { |
| 288 | if !vocab::is_known_directive(name) { |
no test coverage detected