From 698ae870e789aa9423a091e43f957ac677bae4f6 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 1 Oct 2024 16:45:35 +0200 Subject: [PATCH] Rescue `math.binom` docs (#5087) --- docs/src/lib.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/src/lib.rs b/docs/src/lib.rs index b28111e4e..5670fa6ff 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -9,6 +9,8 @@ pub use self::contribs::*; pub use self::html::*; pub use self::model::*; +use std::collections::HashSet; + use ecow::{eco_format, EcoString}; use once_cell::sync::Lazy; use serde::Deserialize; @@ -245,6 +247,18 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel { shorthands = Some(ShorthandsModel { markup, math }); } + let mut skip = HashSet::new(); + if category == MATH { + // Already documented in the text category. + skip.insert("text"); + skip = GROUPS + .iter() + .filter(|g| g.category == category.name()) + .flat_map(|g| &g.filter) + .map(|s| s.as_str()) + .collect(); + } + // Add values and types. let scope = module.scope(); for (name, value, _) in scope.iter() { @@ -252,16 +266,8 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel { continue; } - if category == MATH { - // Skip grouped functions. - if GROUPS.iter().flat_map(|group| &group.filter).any(|f| f == name) { - continue; - } - - // Already documented in the text category. - if name == "text" { - continue; - } + if skip.contains(name.as_str()) { + continue; } match value {