Skip to content

Commit

Permalink
feat(templs): svgattrs and seecompattable
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Jul 12, 2024
1 parent 03d5e78 commit 42fd8a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/rari-doc/src/templ/templs/links/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ pub mod http_header;
pub mod jsxref;
pub mod link;
pub mod rfc;
pub mod svgattr;
pub mod svgxref;
pub mod webextapixref;
15 changes: 15 additions & 0 deletions crates/rari-doc/src/templ/templs/links/svgattr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use rari_templ_func::rari_f;

use crate::error::DocError;
use crate::templ::api::RariApi;

#[rari_f]
pub fn svgattr(name: String) -> Result<String, DocError> {
let url = format!(
"/{}/docs/Web/SVG/Atrribute/{}",
env.locale.as_url_str(),
name,
);

RariApi::link(&url, None, Some(&name), true, None, false)
}
3 changes: 3 additions & 0 deletions crates/rari-doc/src/templ/templs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub mod links;
pub mod listsubpages;
pub mod livesample;
pub mod quick_links_with_subpages;
pub mod seecompattable;
pub mod specification;

use rari_types::globals::deny_warnings;
Expand Down Expand Up @@ -42,6 +43,7 @@ pub fn invoke(
"deprecated_inline" => badges::deprecated_any,
"optional_inline" => badges::optional_any,
"readonlyinline" => badges::readonly_any,
"seecompattable" => seecompattable::see_compat_table_any,

// links
"csp" => links::csp::csp_any,
Expand All @@ -52,6 +54,7 @@ pub fn invoke(
"domxref" => links::domxref::domxref_any,
"htmlelement" => links::htmlxref::htmlxref_any,
"svgelement" => links::svgxref::svgxref_any,
"svgattr" => links::svgattr::svgattr_any,
"webextapiref" => links::webextapixref::webextapixref_any,

// sidebars
Expand Down
19 changes: 19 additions & 0 deletions crates/rari-doc/src/templ/templs/seecompattable.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use rari_templ_func::rari_f;

use crate::error::DocError;

#[rari_f]
pub fn see_compat_table() -> Result<String, DocError> {
let title =
rari_l10n::l10n_json_data("Template", "experimental_badge_abbreviation", env.locale)?;
let copy = rari_l10n::l10n_json_data("Template", "see_compat_table_copy", env.locale)?;

Ok([
r#"<div class="notecard experimental"><strong>"#,
title,
":</strong> ",
copy,
"</div>",
]
.join(""))
}

0 comments on commit 42fd8a9

Please sign in to comment.