Skip to content

Commit aac156e

Browse files
committed
feat(templs): add securecontext
1 parent 42fd8a9 commit aac156e

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

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 secure_context;
1213
pub mod seecompattable;
1314
pub mod specification;
1415

@@ -44,6 +45,8 @@ pub fn invoke(
4445
"optional_inline" => badges::optional_any,
4546
"readonlyinline" => badges::readonly_any,
4647
"seecompattable" => seecompattable::see_compat_table_any,
48+
"securecontext_header" => secure_context::secure_context_header_any,
49+
"securecontext_inline" => secure_context::secure_context_inline_any,
4750

4851
// links
4952
"csp" => links::csp::csp_any,

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

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use rari_templ_func::rari_f;
2+
3+
use crate::error::DocError;
4+
5+
#[rari_f]
6+
pub fn secure_context_inline() -> Result<String, DocError> {
7+
let title = rari_l10n::l10n_json_data("Template", "secure_context_label", env.locale)?;
8+
let copy = rari_l10n::l10n_json_data("Template", "secure_context_inline_copy", env.locale)?;
9+
10+
Ok([
11+
r#"<span class="badge inline secure" title=""#,
12+
&html_escape::encode_double_quoted_attribute(copy),
13+
r#"">"#,
14+
title,
15+
"</span>",
16+
]
17+
.join(""))
18+
}
19+
20+
#[rari_f]
21+
pub fn secure_context_header() -> Result<String, DocError> {
22+
let title = rari_l10n::l10n_json_data("Template", "secure_context_label", env.locale)?;
23+
let copy = rari_l10n::l10n_json_data("Template", "secure_context_header_copy", env.locale)?;
24+
25+
Ok([
26+
r#"<div class="notecard secure"><strong>"#,
27+
&html_escape::encode_double_quoted_attribute(title),
28+
":</strong> ",
29+
copy,
30+
"</div>",
31+
]
32+
.join(""))
33+
}

0 commit comments

Comments
 (0)