Normalize comment banners to house style
Section-divider banners (`// ===== label =====` and box-drawing `// ─── label ───`)
reduced to `// --- label` markers; ceremonial leading capitals lowercased
(acronyms, snake_case names, and CamelCase kept). Comment/doc text only.
Follows the code-comment-style wiki note. Prose em-dashes in comments are a
separate follow-up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5 files changed,
+25 insertions,
-25 deletions
| 23 |
23 |
|
|
| 24 |
24 |
|
use serde::Deserialize;
|
| 25 |
25 |
|
|
| 26 |
|
- |
// ─── Public types ─────────────────────────────────────────────────────────
|
|
26 |
+ |
// --- public types
|
| 27 |
27 |
|
|
| 28 |
28 |
|
/// Top-level errors returned by [`Assumptions::load`] / [`substitute`].
|
| 29 |
29 |
|
#[derive(Debug)]
|
| 365 |
365 |
|
}
|
| 366 |
366 |
|
}
|
| 367 |
367 |
|
|
| 368 |
|
- |
// ─── Typed mirror of assumptions.toml ─────────────────────────────────────
|
|
368 |
+ |
// --- typed mirror of assumptions.toml
|
| 369 |
369 |
|
//
|
| 370 |
370 |
|
// Only the fields needed for validation and derived values. Unknown fields
|
| 371 |
371 |
|
// (e.g. `[expenses.lines]`, `[stripe.connect_express]`) are silently ignored
|
| 486 |
486 |
|
chargeback_rate_tier_subs: f64,
|
| 487 |
487 |
|
}
|
| 488 |
488 |
|
|
| 489 |
|
- |
// ─── Walking + derived ────────────────────────────────────────────────────
|
|
489 |
+ |
// --- walking + derived
|
| 490 |
490 |
|
|
| 491 |
491 |
|
/// Parse a size display string ("10MB", "500GB") to bytes. Binary units
|
| 492 |
492 |
|
/// (KB = 1024 B). Accepts a decimal number and a case-insensitive suffix
|
| 624 |
624 |
|
yr(t.tiers.standard.everything),
|
| 625 |
625 |
|
);
|
| 626 |
626 |
|
|
| 627 |
|
- |
// ── Marginal cost per creator/month, broken down by component ──
|
|
627 |
+ |
// --- marginal cost per creator/month, broken down by component
|
| 628 |
628 |
|
//
|
| 629 |
629 |
|
// What MNW pays per active creator on top of fixed costs F:
|
| 630 |
630 |
|
//
|
| 708 |
708 |
|
put("fill_time_500", fill_time(500.0));
|
| 709 |
709 |
|
}
|
| 710 |
710 |
|
|
| 711 |
|
- |
// ─── Tests ────────────────────────────────────────────────────────────────
|
|
711 |
+ |
// --- tests
|
| 712 |
712 |
|
|
| 713 |
713 |
|
#[cfg(test)]
|
| 714 |
714 |
|
mod tests {
|
| 299 |
299 |
|
mod tests {
|
| 300 |
300 |
|
use super::*;
|
| 301 |
301 |
|
|
| 302 |
|
- |
// ===== Alert directives =====
|
|
302 |
+ |
// --- alert directives
|
| 303 |
303 |
|
|
| 304 |
304 |
|
#[test]
|
| 305 |
305 |
|
fn note_alert() {
|
| 375 |
375 |
|
assert!(result.contains("Normal quote."));
|
| 376 |
376 |
|
}
|
| 377 |
377 |
|
|
| 378 |
|
- |
// ===== Custom alert types =====
|
|
378 |
+ |
// --- custom alert types
|
| 379 |
379 |
|
|
| 380 |
380 |
|
#[test]
|
| 381 |
381 |
|
fn custom_example_alert() {
|
| 403 |
403 |
|
assert!(result.contains("<p class=\"alert-title\">See-also</p>"));
|
| 404 |
404 |
|
}
|
| 405 |
405 |
|
|
| 406 |
|
- |
// ===== Code tabs =====
|
|
406 |
+ |
// --- code tabs
|
| 407 |
407 |
|
|
| 408 |
408 |
|
#[test]
|
| 409 |
409 |
|
fn tabs_two_languages() {
|
| 503 |
503 |
|
assert!(!result.contains("<blockquote>"));
|
| 504 |
504 |
|
}
|
| 505 |
505 |
|
|
| 506 |
|
- |
// ===== Language label mapping =====
|
|
506 |
+ |
// --- language label mapping
|
| 507 |
507 |
|
|
| 508 |
508 |
|
#[test]
|
| 509 |
509 |
|
fn language_labels() {
|
| 522 |
522 |
|
assert_eq!(code_language_label("go"), "Go");
|
| 523 |
523 |
|
}
|
| 524 |
524 |
|
|
| 525 |
|
- |
// ===== UI example directives =====
|
|
525 |
+ |
// --- UI example directives
|
| 526 |
526 |
|
|
| 527 |
527 |
|
#[test]
|
| 528 |
528 |
|
fn ui_example_basic() {
|
| 692 |
692 |
|
assert_eq!(strip_html_tags(html), "A nested deep tag");
|
| 693 |
693 |
|
}
|
| 694 |
694 |
|
|
| 695 |
|
- |
// ── DocLoader::load / get / index / search_index (tempdir fixtures) ──
|
|
695 |
+ |
// --- DocLoader::load / get / index / search_index (tempdir fixtures)
|
| 696 |
696 |
|
|
| 697 |
697 |
|
fn config_for(base: &Path) -> DocLoaderConfig {
|
| 698 |
698 |
|
// Sections listed in display order: "guide" first, then "support".
|
| 945 |
945 |
|
assert!(e.body_text.contains("inline code"));
|
| 946 |
946 |
|
}
|
| 947 |
947 |
|
|
| 948 |
|
- |
// ── link graph + broken-link detection ──
|
|
948 |
+ |
// --- link graph + broken-link detection
|
| 949 |
949 |
|
|
| 950 |
950 |
|
#[test]
|
| 951 |
951 |
|
fn collect_link_targets_dedups_internal_md_links_only() {
|
| 1079 |
1079 |
|
assert_eq!(loader.backlinks("ghost"), ["a".to_string()]);
|
| 1080 |
1080 |
|
}
|
| 1081 |
1081 |
|
|
| 1082 |
|
- |
// ── resolve_ui_examples ──
|
|
1082 |
+ |
// --- resolve_ui_examples
|
| 1083 |
1083 |
|
|
| 1084 |
1084 |
|
#[test]
|
| 1085 |
1085 |
|
fn resolve_ui_examples_inlines_file_contents_when_present() {
|
| 142 |
142 |
|
}
|
| 143 |
143 |
|
}
|
| 144 |
144 |
|
|
| 145 |
|
- |
// ─── LookupValue helpers used by filters ──────────────────────────────────
|
|
145 |
+ |
// --- LookupValue helpers used by filters
|
| 146 |
146 |
|
|
| 147 |
147 |
|
impl LookupValue {
|
| 148 |
148 |
|
/// Coerce to `f64` for numeric filters. `Int` is widened; `String` returns `None`.
|
| 155 |
155 |
|
}
|
| 156 |
156 |
|
}
|
| 157 |
157 |
|
|
| 158 |
|
- |
// ─── Built-in filters ─────────────────────────────────────────────────────
|
|
158 |
+ |
// --- Built-in filters
|
| 159 |
159 |
|
|
| 160 |
160 |
|
fn no_args(name: &str, args: &[FilterArg]) -> Result<(), FilterError> {
|
| 161 |
161 |
|
if args.is_empty() {
|
| 316 |
316 |
|
reg.insert("lower".into(), Box::new(Lower));
|
| 317 |
317 |
|
}
|
| 318 |
318 |
|
|
| 319 |
|
- |
// ─── Mini-parser for the inside of `{{ … }}` ──────────────────────────────
|
|
319 |
+ |
// --- Mini-parser for the inside of `{{ … }}`
|
| 320 |
320 |
|
|
| 321 |
321 |
|
/// Parsed expression: a path plus a list of filter calls to apply in order.
|
| 322 |
322 |
|
#[derive(Debug, PartialEq)]
|
| 517 |
517 |
|
Err(ParseError::InvalidArg(input.to_string()))
|
| 518 |
518 |
|
}
|
| 519 |
519 |
|
|
| 520 |
|
- |
// ─── Tests ────────────────────────────────────────────────────────────────
|
|
520 |
+ |
// --- tests
|
| 521 |
521 |
|
|
| 522 |
522 |
|
#[cfg(test)]
|
| 523 |
523 |
|
mod tests {
|
| 314 |
314 |
|
mod tests {
|
| 315 |
315 |
|
use super::*;
|
| 316 |
316 |
|
|
| 317 |
|
- |
// ===== has_dangerous_scheme =====
|
|
317 |
+ |
// --- has_dangerous_scheme
|
| 318 |
318 |
|
|
| 319 |
319 |
|
#[test]
|
| 320 |
320 |
|
fn safe_schemes() {
|
| 358 |
358 |
|
assert!(!has_dangerous_scheme("page#sec:1"));
|
| 359 |
359 |
|
}
|
| 360 |
360 |
|
|
| 361 |
|
- |
// ===== Permissive preset =====
|
|
361 |
+ |
// --- permissive preset
|
| 362 |
362 |
|
|
| 363 |
363 |
|
#[test]
|
| 364 |
364 |
|
fn permissive_basic_markdown() {
|
| 402 |
402 |
|
assert_eq!(Renderer::permissive().render(""), "");
|
| 403 |
403 |
|
}
|
| 404 |
404 |
|
|
| 405 |
|
- |
// ===== Standard preset =====
|
|
405 |
+ |
// --- standard preset
|
| 406 |
406 |
|
|
| 407 |
407 |
|
#[test]
|
| 408 |
408 |
|
fn standard_strips_images() {
|
| 419 |
419 |
|
assert!(html.contains("<table>"));
|
| 420 |
420 |
|
}
|
| 421 |
421 |
|
|
| 422 |
|
- |
// ===== Strict preset =====
|
|
422 |
+ |
// --- strict preset
|
| 423 |
423 |
|
|
| 424 |
424 |
|
#[test]
|
| 425 |
425 |
|
fn with_strip_raw_html_toggle_is_observable() {
|
| 582 |
582 |
|
assert_eq!(Renderer::strict().render(""), "");
|
| 583 |
583 |
|
}
|
| 584 |
584 |
|
|
| 585 |
|
- |
// ===== Sanitize-only preset =====
|
|
585 |
+ |
// --- Sanitize-only preset
|
| 586 |
586 |
|
|
| 587 |
587 |
|
#[test]
|
| 588 |
588 |
|
fn sanitize_only_cleans_html() {
|
| 592 |
592 |
|
assert!(!html.contains("<script>"));
|
| 593 |
593 |
|
}
|
| 594 |
594 |
|
|
| 595 |
|
- |
// ===== Builder methods =====
|
|
595 |
+ |
// --- builder methods
|
| 596 |
596 |
|
|
| 597 |
597 |
|
#[test]
|
| 598 |
598 |
|
fn builder_override() {
|
| 601 |
601 |
|
assert!(html.contains("<img"));
|
| 602 |
602 |
|
}
|
| 603 |
603 |
|
|
| 604 |
|
- |
// ===== render_with_meta =====
|
|
604 |
+ |
// --- render_with_meta
|
| 605 |
605 |
|
|
| 606 |
606 |
|
#[test]
|
| 607 |
607 |
|
fn render_with_meta_includes_counts() {
|
| 616 |
616 |
|
html.contains(rel_value)
|
| 617 |
617 |
|
}
|
| 618 |
618 |
|
|
| 619 |
|
- |
// ===== heading ids =====
|
|
619 |
+ |
// --- heading ids
|
| 620 |
620 |
|
|
| 621 |
621 |
|
#[test]
|
| 622 |
622 |
|
fn heading_ids_are_off_by_default() {
|