| @@ -330,21 +330,27 @@ impl Audit { |
| 330 | rest = &after[end..]; |
330 | rest = &after[end..]; |
| 331 | } |
331 | } |
| 332 | |
332 | |
| 333 | if has_timestamp(line) { |
333 | // The rest read a line that has had its `=verbatim=` and `~code~` spans blanked: |
| |
334 | // a construct shown inside verbatim is displayed rather than rendered, so a page |
| |
335 | // documenting org syntax is not a use of the syntax it names. Emphasis pairs |
| |
336 | // below deliberately still see the raw line — `=` is one of the markers scanned. |
| |
337 | let bare = without_literal_spans(line); |
| |
338 | |
| |
339 | if has_timestamp(&bare) { |
| 334 | self.count(Scope::In, "timestamp", at); |
340 | self.count(Scope::In, "timestamp", at); |
| 335 | } |
341 | } |
| 336 | if line.contains("{{{") { |
342 | if bare.contains("{{{") { |
| 337 | self.count(Scope::Out, "macro call", at); |
343 | self.count(Scope::Out, "macro call", at); |
| 338 | } |
344 | } |
| 339 | if line.contains("<<<") { |
345 | if bare.contains("<<<") { |
| 340 | self.count(Scope::Out, "radio target", at); |
346 | self.count(Scope::Out, "radio target", at); |
| 341 | } else if line.contains("<<") && line.contains(">>") { |
347 | } else if bare.contains("<<") && bare.contains(">>") { |
| 342 | self.count(Scope::Out, "internal target", at); |
348 | self.count(Scope::Out, "internal target", at); |
| 343 | } |
349 | } |
| 344 | if line.contains("\\begin{") || latex_inline(line) { |
350 | if bare.contains("\\begin{") || latex_inline(&bare) { |
| 345 | self.count(Scope::Out, "LaTeX fragment", at); |
351 | self.count(Scope::Out, "LaTeX fragment", at); |
| 346 | } |
352 | } |
| 347 | if entity_ref(line) { |
353 | if entity_ref(&bare) { |
| 348 | // Rendered, and rendered as org renders it: `\alpha` becomes `α` in |
354 | // Rendered, and rendered as org renders it: `\alpha` becomes `α` in |
| 349 | // both exporters. `fixtures/audit-entities.org` holds the oracle to that. |
355 | // both exporters. `fixtures/audit-entities.org` holds the oracle to that. |
| 350 | self.count(Scope::In, "entity (\\name)", at); |
356 | self.count(Scope::In, "entity (\\name)", at); |
| @@ -510,11 +516,7 @@ fn latex_inline(line: &str) -> bool { |
| 510 | /// Only names org knows count, matching [`crate::parser`]'s rule for rendering one: a |
516 | /// Only names org knows count, matching [`crate::parser`]'s rule for rendering one: a |
| 511 | /// Windows path (`C:\Users\me`) and a namespaced identifier (`Tumblr\API\Client`) are not |
517 | /// Windows path (`C:\Users\me`) and a namespaced identifier (`Tumblr\API\Client`) are not |
| 512 | /// entity references. |
518 | /// entity references. |
| 513 | /// |
| |
| 514 | /// Verbatim and code spans are skipped: `=\alpha=` shows the name rather than rendering |
| |
| 515 | /// the character, so it is not a use of the feature. |
| |
| 516 | fn entity_ref(line: &str) -> bool { |
519 | fn entity_ref(line: &str) -> bool { |
| 517 | let line = without_literal_spans(line); |
| |
| 518 | let chars: Vec<char> = line.chars().collect(); |
520 | let chars: Vec<char> = line.chars().collect(); |
| 519 | for (i, c) in chars.iter().enumerate() { |
521 | for (i, c) in chars.iter().enumerate() { |
| 520 | if *c != '\\' { |
522 | if *c != '\\' { |