aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / crates / site-builder / src / components / voice.rs
| 1 | //! Drake writes the site alone, in first person singular (I, me, my). |
| 2 | //! Plural first-person words (we, us, our, ours, ourselves and their |
| 3 | //! contractions) in rendered copy fail the build. Quoted third-party words |
| 4 | //! and code identifiers are the only exceptions, listed in `ALLOW`. Text |
| 5 | //! copied verbatim from the published work ledger (`data/now.tsv`, shown on |
| 6 | //! /now/) is a dated record of what was said, not copy, and is matched out. |
| 7 | //! Drake's own sourced words in `data/quotes.json` are a record too: an HTML |
| 8 | //! element marked `data-quote-id="qNN"` whose text is exactly quote qNN is |
| 9 | //! removed before matching, and a marked element that does not match its |
| 10 | //! quote fails the build. Markdown and text mirrors carry no markup, so |
| 11 | //! there only the exact quote strings are removed. |
| 12 | |
| 13 | use regex::Regex; |
| 14 | use std::fs; |
| 15 | use std::path::Path; |
| 16 | |
| 17 | /// (file under dist, exact phrase containing the plural word). Keep it small: |
| 18 | /// every entry is someone else's words or a code identifier, never site copy. |
| 19 | pub const ALLOW: &[(&str, &str)] = &[ |
| 20 | // Yann LeCun, quoted on the post-LLM case and in its markdown and llms mirrors. |
| 21 | ("post-llm-case/index.html", "We need the real world."), |
| 22 | ("post-llm-case/index.md", "We need the real world."), |
| 23 | ("post-llm-case.md", "We need the real world."), |
| 24 | ("llms-full.txt", "We need the real world."), |
| 25 | // The Continuation Test quotes the objections it answers, in the objectors' words. |
| 26 | ("engineer/works/the-continuation-test/index.html", "It only does what we tell it."), |
| 27 | ("engineer/works/the-continuation-test/index.md", "It only does what we tell it."), |
| 28 | ("engineer/works/the-continuation-test.md", "It only does what we tell it."), |
| 29 | ("engineer/papers/the-continuation-test.md", "It only does what we tell it."), |
| 30 | ("llms-full.txt", "It only does what we tell it."), |
| 31 | ("engineer/works/the-continuation-test/index.html", "If we can't write down the rules for good thinking"), |
| 32 | ("engineer/works/the-continuation-test/index.md", "If we can't write down the rules for good thinking"), |
| 33 | ("engineer/works/the-continuation-test.md", "If we can't write down the rules for good thinking"), |
| 34 | ("engineer/papers/the-continuation-test.md", "If we can't write down the rules for good thinking"), |
| 35 | ("llms-full.txt", "If we can't write down the rules for good thinking"), |
| 36 | // The first Atlas Symphony run, quoted verbatim as the historical record of 30 July 2026. |
| 37 | ("engineer/works/atlas-symphony/index.html", "What's left in our development plan?"), |
| 38 | ("engineer/works/atlas-symphony/index.md", "What's left in our development plan?"), |
| 39 | ("engineer/works/atlas-symphony.md", "What's left in our development plan?"), |
| 40 | ("llms-full.txt", "What's left in our development plan?"), |
| 41 | ("engineer/works/atlas-symphony/index.html", "Please proceed with our Symphony."), |
| 42 | ("engineer/works/atlas-symphony/index.md", "Please proceed with our Symphony."), |
| 43 | ("engineer/works/atlas-symphony.md", "Please proceed with our Symphony."), |
| 44 | ("llms-full.txt", "Please proceed with our Symphony."), |
| 45 | ]; |
| 46 | |
| 47 | /// Pages that embed ledger rows; only these may match text out of the ledger. |
| 48 | pub const LEDGER_PAGES: &[&str] = &["now/index.html", "now/index.md", "now.md", "llms-full.txt"]; |
| 49 | |
| 50 | /// Drake's sourced quotes, compiled in from the repository so a generated |
| 51 | /// tree cannot add its own exemptions. |
| 52 | pub const QUOTES_RAW: &str = include_str!("../../../../data/quotes.json"); |
| 53 | |
| 54 | /// The attribute that marks one quote in HTML. |
| 55 | pub const QUOTE_ATTR: &str = "data-quote-id=\""; |
| 56 | |
| 57 | /// (id, quote) for every entry of `data/quotes.json`. Ids are unique and |
| 58 | /// quotes non-empty, or the verifier refuses to run. |
| 59 | pub fn quotes() -> Vec<(String, String)> { |
| 60 | parse_quotes(QUOTES_RAW) |
| 61 | } |
| 62 | |
| 63 | /// (id, quote) for every entry of a quote record shaped like `data/quotes.json`. |
| 64 | pub fn parse_quotes(raw: &str) -> Vec<(String, String)> { |
| 65 | let v: serde_json::Value = serde_json::from_str(raw).expect("data/quotes.json parses"); |
| 66 | let mut out: Vec<(String, String)> = Vec::new(); |
| 67 | for q in v["quotes"].as_array().expect("data/quotes.json has quotes") { |
| 68 | let id = q["id"].as_str().expect("every quote has an id").to_string(); |
| 69 | let text = q["quote"].as_str().expect("every quote has its text").to_string(); |
| 70 | assert!(!text.trim().is_empty(), "quote {id} is empty"); |
| 71 | assert!(out.iter().all(|(i, _)| *i != id), "quote id {id} is used twice"); |
| 72 | out.push((id, text)); |
| 73 | } |
| 74 | out |
| 75 | } |
| 76 | |
| 77 | /// Removes every element marked [`QUOTE_ATTR`] whose reader text equals |
| 78 | /// its quote exactly (entities decoded, whitespace squashed). An unknown |
| 79 | /// id, a different text, or an element that never closes is an error. |
| 80 | pub fn without_sourced_quotes(raw: &str, quotes: &[(String, String)]) -> Result<String, String> { |
| 81 | use crate::oracle::{element_end, reader_text}; |
| 82 | let mut s = raw.to_string(); |
| 83 | let mut from = 0; |
| 84 | while let Some(at) = s[from..].find(QUOTE_ATTR).map(|i| from + i) { |
| 85 | let open = s[..at].rfind('<'); |
| 86 | let gt = open.and_then(|o| s[o..].find('>').map(|g| o + g)); |
| 87 | let (Some(open), Some(gt)) = (open, gt) else { |
| 88 | from = at + QUOTE_ATTR.len(); |
| 89 | continue; |
| 90 | }; |
| 91 | if gt < at || !s[..at].ends_with(|c: char| c.is_ascii_whitespace()) { |
| 92 | // Plain text or a lookalike attribute: not a marker, exempts nothing. |
| 93 | from = at + QUOTE_ATTR.len(); |
| 94 | continue; |
| 95 | } |
| 96 | let id_start = at + QUOTE_ATTR.len(); |
| 97 | let id = &s[id_start..id_start + s[id_start..].find('"').ok_or("unterminated data-quote-id")?]; |
| 98 | let quote = "es.iter().find(|(i, _)| i == id).ok_or(format!("data-quote-id {id:?} is not in data/quotes.json"))?.1; |
| 99 | let name = crate::seo::tag_name(&s[open..]); |
| 100 | let end = element_end(&s, gt + 1, &name).ok_or(format!("quote {id} never closes"))?; |
| 101 | let inner = &s[gt + 1..end - format!("</{name}>").len()]; |
| 102 | let shown = reader_text(inner); |
| 103 | if shown != squash(quote) { |
| 104 | return Err(format!("quote {id} is not verbatim: shows {shown:?}, data/quotes.json has {quote:?}")); |
| 105 | } |
| 106 | s.replace_range(open..end, " "); |
| 107 | from = open; |
| 108 | } |
| 109 | Ok(s) |
| 110 | } |
| 111 | |
| 112 | /// A markdown or text mirror with every exact quote string removed. |
| 113 | pub fn without_quote_strings(raw: &str, quotes: &[(String, String)]) -> String { |
| 114 | let mut s = raw.to_string(); |
| 115 | for (_, q) in quotes { |
| 116 | s = s.replace(q.as_str(), " "); |
| 117 | } |
| 118 | s |
| 119 | } |
| 120 | |
| 121 | fn plural() -> Regex { |
| 122 | Regex::new(r"(?i)\b(?:we|we['\u{2019}](?:re|ve|ll|d)|us|our|ours|ourselves)\b").unwrap() |
| 123 | } |
| 124 | |
| 125 | /// Visible text of an HTML page: scripts, styles and tags removed, common |
| 126 | /// entities decoded. Markdown and plain text pass through unchanged. |
| 127 | pub fn visible_text(name: &str, raw: &str) -> String { |
| 128 | if !name.ends_with(".html") { |
| 129 | return raw.to_string(); |
| 130 | } |
| 131 | let blocks = Regex::new(r"(?is)<script\b.*?</script>|<style\b.*?</style>").unwrap(); |
| 132 | let tags = Regex::new(r"(?s)<[^>]*>").unwrap(); |
| 133 | let t = blocks.replace_all(raw, " "); |
| 134 | let t = tags.replace_all(&t, " "); |
| 135 | t.replace("&", "&") |
| 136 | .replace("'", "'") |
| 137 | .replace("'", "'") |
| 138 | .replace(""", "\"") |
| 139 | .replace("<", "<") |
| 140 | .replace(">", ">") |
| 141 | .replace(" ", " ") |
| 142 | } |
| 143 | |
| 144 | fn squash(s: &str) -> String { |
| 145 | s.split_whitespace().collect::<Vec<_>>().join(" ") |
| 146 | } |
| 147 | |
| 148 | /// Plural first-person words in `text`, after removing allowed phrases, |
| 149 | /// link targets, units (`50 us`) and phrases found verbatim in `record`. |
| 150 | pub fn violations(rel: &str, text: &str, record: &str) -> Vec<String> { |
| 151 | let mut t = text.to_string(); |
| 152 | for (file, phrase) in ALLOW { |
| 153 | if *file == rel { |
| 154 | t = t.replace(phrase, " "); |
| 155 | } |
| 156 | } |
| 157 | let links = Regex::new(r"\]\([^)\s]*\)|https?://\S+").unwrap(); |
| 158 | let t = squash(&links.replace_all(&t, " ")); |
| 159 | plural() |
| 160 | .find_iter(&t) |
| 161 | .filter(|m| m.as_str() != "US") |
| 162 | .filter(|m| { |
| 163 | // Path and identifier parts (docs/how-we-did-it, HOW_WE_DID_IT) and units (50 us). |
| 164 | let joined = |c: Option<char>| c.is_some_and(|c| matches!(c, '-' | '_' | '/' | '.' | '#')); |
| 165 | let before = t[..m.start()].trim_end(); |
| 166 | let unit = m.as_str().eq_ignore_ascii_case("us") && before.ends_with(|c: char| c.is_ascii_digit()); |
| 167 | !(unit || joined(t[..m.start()].chars().last()) || joined(t[m.end()..].chars().next())) |
| 168 | }) |
| 169 | .filter(|m| { |
| 170 | let s = t[..m.start()].char_indices().rev().nth(11).map_or(0, |(i, _)| i); |
| 171 | let e = t[m.end()..].char_indices().nth(12).map_or(t.len(), |(i, _)| m.end() + i); |
| 172 | // A redacted span ([private path]) may sit on one side, so either half counts. |
| 173 | record.is_empty() || !(record.contains(&t[s..m.end()]) || record.contains(&t[m.start()..e])) |
| 174 | }) |
| 175 | .map(|m| { |
| 176 | let s = t[..m.start()].char_indices().rev().nth(50).map_or(0, |(i, _)| i); |
| 177 | let e = t[m.end()..].char_indices().nth(30).map_or(t.len(), |(i, _)| m.end() + i); |
| 178 | t[s..e].to_string() |
| 179 | }) |
| 180 | .collect() |
| 181 | } |
| 182 | |
| 183 | fn walk(dir: &Path, root: &Path, record: &str, quotes: &[(String, String)], out: &mut Vec<String>) { |
| 184 | for entry in fs::read_dir(dir).expect("read dist dir") { |
| 185 | let path = entry.expect("dist entry").path(); |
| 186 | if path.is_dir() { |
| 187 | walk(&path, root, record, quotes, out); |
| 188 | continue; |
| 189 | } |
| 190 | let rel = path.strip_prefix(root).unwrap().to_string_lossy().replace('\\', "/"); |
| 191 | if !(rel.ends_with(".html") || rel.ends_with(".md") || rel.ends_with(".txt")) { |
| 192 | continue; |
| 193 | } |
| 194 | let raw = fs::read_to_string(&path).unwrap_or_else(|_| panic!("read {rel}")); |
| 195 | let raw = if rel.ends_with(".html") { |
| 196 | match without_sourced_quotes(&raw, quotes) { |
| 197 | Ok(s) => s, |
| 198 | Err(e) => { |
| 199 | out.push(format!("{rel}: {e}")); |
| 200 | continue; |
| 201 | } |
| 202 | } |
| 203 | } else { |
| 204 | without_quote_strings(&raw, quotes) |
| 205 | }; |
| 206 | let rec = if LEDGER_PAGES.contains(&rel.as_str()) { record } else { "" }; |
| 207 | for v in violations(&rel, &visible_text(&rel, &raw), rec) { |
| 208 | out.push(format!("{rel}: ...{v}...")); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /// Every rendered page, markdown twin and llms file is in Drake's voice. |
| 214 | pub fn verify_singular_voice(dist: &Path) { |
| 215 | let record = squash(&fs::read_to_string(dist.join("data/now.tsv")).unwrap_or_default().replace('\t', " ")); |
| 216 | let mut out = Vec::new(); |
| 217 | walk(dist, dist, &record, "es(), &mut out); |
| 218 | assert!( |
| 219 | out.is_empty(), |
| 220 | "First person plural in site copy (write I, me, my; see AGENTS.md):\n{}", |
| 221 | out.join("\n") |
| 222 | ); |
| 223 | } |
| 224 | |
| 225 | /// Refresh claims the event-driven policy made false (~/work/sitehub/REFRESH.md): |
| 226 | /// the site is published only with an independently reviewed release, never on a |
| 227 | /// timer and never by a GitHub workflow. Lowercase, matched ASCII-case-blind. |
| 228 | pub const REFRESH_CLAIMS: &[&str] = &["refreshed hourly", "refreshes hourly", "updated: hourly", "at most hourly", "runs hourly", "every hour", "within the hour", "served by github pages", "sites are on github pages", "github pages serves the output", "deploys it on every push"]; |
| 229 | |
| 230 | /// Every refresh claim in `text`, with a little of what precedes it. |
| 231 | pub fn refresh_claims(text: &str) -> Vec<String> { |
| 232 | let lower = text.to_ascii_lowercase(); |
| 233 | let mut bad = Vec::new(); |
| 234 | for p in REFRESH_CLAIMS { |
| 235 | for (i, _) in lower.match_indices(p) { |
| 236 | let from = text[..i].char_indices().rev().nth(80).map_or(0, |(k, _)| k); |
| 237 | bad.push(format!("{p:?} near {:?}", &text[from..(i + p.len())])); |
| 238 | } |
| 239 | } |
| 240 | bad |
| 241 | } |
| 242 | |
| 243 | fn refresh_walk(dir: &Path, root: &Path, out: &mut Vec<String>) { |
| 244 | for entry in fs::read_dir(dir).expect("read dist dir") { |
| 245 | let path = entry.expect("dist entry").path(); |
| 246 | if path.is_dir() { |
| 247 | refresh_walk(&path, root, out); |
| 248 | continue; |
| 249 | } |
| 250 | let rel = path.strip_prefix(root).unwrap().to_string_lossy().replace('\\', "/"); |
| 251 | if !(rel.ends_with(".html") || rel.ends_with(".md") || rel.ends_with(".txt")) { |
| 252 | continue; |
| 253 | } |
| 254 | let raw = fs::read_to_string(&path).unwrap_or_else(|_| panic!("read {rel}")); |
| 255 | let bad = if rel == "llms-full.txt" { |
| 256 | // The /now/ section quotes ledger rows; the rest of the file is copy. |
| 257 | match crate::components::now::llms_now_section(&raw) { |
| 258 | Some(sec) => { |
| 259 | let start = sec.as_ptr() as usize - raw.as_ptr() as usize; |
| 260 | let mut b = refresh_claims(&raw[..start]); |
| 261 | b.extend(refresh_claims(&raw[start + sec.len()..])); |
| 262 | b |
| 263 | } |
| 264 | None => refresh_claims(&raw), |
| 265 | } |
| 266 | } else if LEDGER_PAGES.contains(&rel.as_str()) { |
| 267 | // Ledger rows keep their historical wording. |
| 268 | Vec::new() |
| 269 | } else { |
| 270 | refresh_claims(&raw) |
| 271 | }; |
| 272 | out.extend(bad.into_iter().map(|b| format!("{rel}: {b}"))); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | /// No rendered page, markdown twin or llms file claims an hourly or GitHub refresh. |
| 277 | pub fn verify_no_refresh_claims(dist: &Path) { |
| 278 | let mut out = Vec::new(); |
| 279 | refresh_walk(dist, dist, &mut out); |
| 280 | assert!(out.is_empty(), "Refresh claim the release policy made false (publish only with reviewed releases):\n{}", out.join("\n")); |
| 281 | println!(" [REFRESH] no page claims an hourly or GitHub refresh"); |
| 282 | } |
| 283 | |
| 284 | #[cfg(test)] |
| 285 | mod tests { |
| 286 | use super::*; |
| 287 | |
| 288 | #[test] |
| 289 | fn refresh_rule_refuses_planted_claims() { |
| 290 | for planted in ["Source lines, refreshed hourly from GitHub.", "Refreshes Hourly", "Updated: hourly", "whenever the ledger changes, at most hourly", "Collection runs hourly through GitHub Actions", "this site gathers from GitHub every hour", "It rebuilds within the hour of every change.", "built by a Rust generator and served by GitHub Pages", "sites are on GitHub Pages", "GitHub Pages serves the output", "builds and deploys it on every push to `main`"] { |
| 291 | assert_eq!(refresh_claims(planted).len(), 1, "{planted}"); |
| 292 | } |
| 293 | for fine in ["published with reviewed releases", "6 an hour per author", "deployed hourly from the Spark", "served from a Raspberry Pi at home, not GitHub Pages", "GitHub Pages typed `.om` as octet-stream"] { |
| 294 | assert!(refresh_claims(fine).is_empty(), "{fine}"); |
| 295 | } |
| 296 | let full = "# Site\n\nPublished with reviewed releases.\n\n---\n\n# Now\n\nSource: https://www.aienos.com/now/\n\n- L045cron every hour\n\n---\n\n# Data\n\nUpdated: hourly\n"; |
| 297 | let sec = crate::components::now::llms_now_section(full).unwrap(); |
| 298 | assert!(refresh_claims(sec).len() == 1 && refresh_claims(full).len() == 2, "the /now/ cut keeps ledger rows and still sees the copy after it"); |
| 299 | } |
| 300 | |
| 301 | #[test] |
| 302 | fn plural_words_fail_and_singular_passes() { |
| 303 | for bad in ["We build it.", "tell us where", "our own engine", "not ours", "we're open", "We\u{2019}ve run", "ourselves"] { |
| 304 | assert!(!violations("x.html", bad, "").is_empty(), "{bad}"); |
| 305 | } |
| 306 | for ok in ["I build it with my agents.", "tell me where", "my own engine", "US dollars", "user, trust, focus, pour"] { |
| 307 | assert!(violations("x.html", ok, "").is_empty(), "{ok}"); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | #[test] |
| 312 | fn allowlist_is_per_file_and_exact() { |
| 313 | let (file, phrase) = ALLOW[0]; |
| 314 | assert!(violations(file, phrase, "").is_empty()); |
| 315 | assert!(!violations("index.html", phrase, "").is_empty()); |
| 316 | } |
| 317 | |
| 318 | #[test] |
| 319 | fn ledger_records_links_and_units_are_not_copy() { |
| 320 | let rec = "L1 Drake: why cant we train Allen to do it"; |
| 321 | assert!(violations("now.md", "Drake: why cant we train Allen to do it", rec).is_empty()); |
| 322 | assert!(!violations("now.md", "Today we ship it.", rec).is_empty()); |
| 323 | assert!(violations("x.md", "[doc](https://x/how-we-did-it) poll 50 us", "").is_empty()); |
| 324 | } |
| 325 | |
| 326 | #[test] |
| 327 | fn markup_and_scripts_are_not_copy() { |
| 328 | let html = "<p class=\"our\">mine</p><script>var us=1</script><style>.we{}</style>"; |
| 329 | assert!(violations("x.html", &visible_text("x.html", html), "").is_empty()); |
| 330 | } |
| 331 | |
| 332 | /// Test-only record: synthetic text, not anyone's quotation. `data/quotes.json` holds only |
| 333 | /// quotes verified against a public source, so the exemption is exercised against this. |
| 334 | const FIXTURE: &str = r#"{"version": 1, "quotes": [ |
| 335 | {"id": "q01", "quote": "Fixture text, not a quotation: one more entry."}, |
| 336 | {"id": "q05", "quote": "Fixture text, not a quotation: we keep our receipts & it's on the record."} |
| 337 | ]}"#; |
| 338 | |
| 339 | fn fixture() -> Vec<(String, String)> { |
| 340 | parse_quotes(FIXTURE) |
| 341 | } |
| 342 | |
| 343 | fn check_html(html: &str) -> Result<Vec<String>, String> { |
| 344 | let q = fixture(); |
| 345 | without_sourced_quotes(html, &q).map(|s| violations("learn/index.html", &visible_text("learn/index.html", &s), "")) |
| 346 | } |
| 347 | |
| 348 | fn q05() -> String { |
| 349 | let text = fixture().into_iter().find(|(i, _)| i == "q05").expect("q05 exists").1; |
| 350 | assert!(!violations("x.md", &text, "").is_empty(), "the fixture quote must say we or our"); |
| 351 | text.replace('&', "&").replace('<', "<").replace('>', ">").replace('"', """).replace('\'', "'") |
| 352 | } |
| 353 | |
| 354 | #[test] |
| 355 | fn quote_records_load_with_unique_ids() { |
| 356 | quotes(); |
| 357 | assert_eq!(fixture().len(), 2); |
| 358 | } |
| 359 | |
| 360 | #[test] |
| 361 | #[should_panic(expected = "quote id q05 is used twice")] |
| 362 | fn a_repeated_quote_id_is_refused() { |
| 363 | parse_quotes(r#"{"quotes": [{"id": "q05", "quote": "a"}, {"id": "q05", "quote": "b"}]}"#); |
| 364 | } |
| 365 | |
| 366 | #[test] |
| 367 | fn an_exact_marked_quote_is_exempt_and_nothing_around_it() { |
| 368 | let q = q05(); |
| 369 | assert!(check_html(&format!("<blockquote class=\"quote\" data-quote-id=\"q05\"><p>{q}</p></blockquote><p>I build it.</p>")).unwrap().is_empty()); |
| 370 | assert!(check_html(&format!("<p data-quote-id=\"q05\">\n {q}\n</p>")).unwrap().is_empty(), "whitespace is squashed"); |
| 371 | // The page around a quote is still checked. |
| 372 | assert!(!check_html(&format!("<p data-quote-id=\"q05\">{q}</p><p>We ship it.</p>")).unwrap().is_empty()); |
| 373 | } |
| 374 | |
| 375 | #[test] |
| 376 | fn quote_negative_controls() { |
| 377 | let q = q05(); |
| 378 | // A marked element that is not the quote fails outright. |
| 379 | for bad in [ |
| 380 | format!("<p data-quote-id=\"q05\">{q} and we added this</p>"), |
| 381 | format!("<p data-quote-id=\"q05\">We wrote something else.</p>"), |
| 382 | format!("<p data-quote-id=\"q99\">{q}</p>"), |
| 383 | format!("<p data-quote-id=\"q01\">{q}</p>"), |
| 384 | format!("<p data-quote-id=\"q05\">{q}"), |
| 385 | ] { |
| 386 | assert!(check_html(&bad).is_err(), "must reject: {bad}"); |
| 387 | } |
| 388 | // Unmarked, lookalike-marked or speaker-marked quote text is copy and is checked. |
| 389 | for copy in [ |
| 390 | format!("<p>{q}</p>"), |
| 391 | format!("<p xdata-quote-id=\"q05\">{q}</p>"), |
| 392 | format!("<p data-speaker=\"drake\">{q}</p>"), |
| 393 | format!("<p>data-quote-id=\"q05\" {q}</p>"), |
| 394 | ] { |
| 395 | assert!(!check_html(©).unwrap().is_empty(), "must flag: {copy}"); |
| 396 | } |
| 397 | // Mirrors: the exact string is exempt; an altered one is not. |
| 398 | let raw = fixture().into_iter().find(|(i, _)| i == "q05").unwrap().1; |
| 399 | let qs = fixture(); |
| 400 | assert!(violations("learn.md", &without_quote_strings(&format!("> {raw}\n\nI build it."), &qs), "").is_empty()); |
| 401 | assert!(!violations("learn.md", &without_quote_strings(&format!("> {raw} and ours"), &qs), "").is_empty()); |
| 402 | assert!(!violations("learn.md", &without_quote_strings(&raw.replacen("our", "OUR", 1), &qs), "").is_empty()); |
| 403 | } |
| 404 | } |