Skip to content

Commit 42fd8a9

Browse files
committed
feat(templs): svgattrs and seecompattable
1 parent 03d5e78 commit 42fd8a9

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

Diff for: crates/rari-doc/src/templ/templs/links/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ pub mod http_header;
66
pub mod jsxref;
77
pub mod link;
88
pub mod rfc;
9+
pub mod svgattr;
910
pub mod svgxref;
1011
pub mod webextapixref;

Diff for: crates/rari-doc/src/templ/templs/links/svgattr.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use rari_templ_func::rari_f;
2+
3+
use crate::error::DocError;
4+
use crate::templ::api::RariApi;
5+
6+
#[rari_f]
7+
pub fn svgattr(name: String) -> Result<String, DocError> {
8+
let url = format!(
9+
"/{}/docs/Web/SVG/Atrribute/{}",
10+
env.locale.as_url_str(),
11+
name,
12+
);
13+
14+
RariApi::link(&url, None, Some(&name), true, None, false)
15+
}

Diff for: crates/rari-doc/src/templ/templs/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub mod links;
99
pub mod listsubpages;
1010
pub mod livesample;
1111
pub mod quick_links_with_subpages;
12+
pub mod seecompattable;
1213
pub mod specification;
1314

1415
use rari_types::globals::deny_warnings;
@@ -42,6 +43,7 @@ pub fn invoke(
4243
"deprecated_inline" => badges::deprecated_any,
4344
"optional_inline" => badges::optional_any,
4445
"readonlyinline" => badges::readonly_any,
46+
"seecompattable" => seecompattable::see_compat_table_any,
4547

4648
// links
4749
"csp" => links::csp::csp_any,
@@ -52,6 +54,7 @@ pub fn invoke(
5254
"domxref" => links::domxref::domxref_any,
5355
"htmlelement" => links::htmlxref::htmlxref_any,
5456
"svgelement" => links::svgxref::svgxref_any,
57+
"svgattr" => links::svgattr::svgattr_any,
5558
"webextapiref" => links::webextapixref::webextapixref_any,
5659

5760
// sidebars

Diff for: crates/rari-doc/src/templ/templs/seecompattable.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use rari_templ_func::rari_f;
2+
3+
use crate::error::DocError;
4+
5+
#[rari_f]
6+
pub fn see_compat_table() -> Result<String, DocError> {
7+
let title =
8+
rari_l10n::l10n_json_data("Template", "experimental_badge_abbreviation", env.locale)?;
9+
let copy = rari_l10n::l10n_json_data("Template", "see_compat_table_copy", env.locale)?;
10+
11+
Ok([
12+
r#"<div class="notecard experimental"><strong>"#,
13+
title,
14+
":</strong> ",
15+
copy,
16+
"</div>",
17+
]
18+
.join(""))
19+
}

0 commit comments

Comments
 (0)