Skip to content

Commit

Permalink
fix(templ): support argument for cssyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Jan 1, 2025
1 parent 08f88e8 commit 330acdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions crates/rari-cli/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ async fn get_json_handler(req: Request) -> Result<Json<BuiltPage>, AppError> {
tracing::info!("{url}");
if let BuiltPage::Doc(json_doc) = &mut json {
let m = IN_MEMORY.get_events();
if let Some((_, req_issues)) = m.remove(page.full_path().to_string_lossy().as_ref()) {
json_doc.doc.flaws = Some(to_display_issues(req_issues, &page));
}
let (_, req_issues) = m
.remove(page.full_path().to_string_lossy().as_ref())
.unwrap_or_default();
json_doc.doc.flaws = Some(to_display_issues(req_issues, &page));
}
Ok(Json(json))
}
Expand Down
5 changes: 3 additions & 2 deletions crates/rari-doc/src/templ/templs/csssyntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ static TOOLTIPS: LazyLock<HashMap<LinkedToken, String>> = LazyLock::new(|| {
});

#[rari_f]
pub fn csssyntax() -> Result<String, DocError> {
pub fn csssyntax(name: Option<String>) -> Result<String, DocError> {
let page_type = env.page_type;
let mut slug_rev_iter = env.slug.rsplitn(3, '/');
let name = slug_rev_iter.next().unwrap();
let slug_name = slug_rev_iter.next().unwrap();
let name = name.as_deref().unwrap_or(slug_name);
let typ = match page_type {
rari_types::fm_types::PageType::CssAtRule => CssType::AtRule(name),
rari_types::fm_types::PageType::CssAtRuleDescriptor => {
Expand Down

0 comments on commit 330acdc

Please sign in to comment.