Skip to content

Commit 794bc21

Browse files
committed
feat(templs): banners and http links
1 parent c75d3bf commit 794bc21

File tree

6 files changed

+22
-36
lines changed

6 files changed

+22
-36
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,19 @@ pub fn secure_context_header() -> Result<String, DocError> {
7272
]
7373
.join(""))
7474
}
75+
76+
#[rari_f]
77+
pub fn non_standard_header() -> Result<String, DocError> {
78+
let title =
79+
rari_l10n::l10n_json_data("Template", "non_standard_badge_abbreviation", env.locale)?;
80+
let copy = rari_l10n::l10n_json_data("Template", "non_standard_header_copy", env.locale)?;
81+
82+
Ok([
83+
r#"<div class="notecard nonstadard"><p><strong>"#,
84+
title,
85+
":</strong> ",
86+
copy,
87+
"</p></div>",
88+
]
89+
.join(""))
90+
}

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
use rari_templ_func::rari_f;
22

3-
use crate::docs::page::PageLike;
43
use crate::error::DocError;
54
use crate::templ::api::RariApi;
6-
use crate::templ::templs::links::link::link_internal;
75

86
#[rari_f]
97
pub fn csp(directive: String) -> Result<String, DocError> {
108
let url = format!(
119
"/{}/docs/Web/HTTP/Headers/Content-Security-Policy/{directive}",
1210
env.locale.as_url_str()
1311
);
14-
let page = RariApi::get_page(&url)?;
15-
link_internal(page.url(), &page, Some(&directive), true)
12+
RariApi::link(&url, None, Some(directive.as_ref()), true, None, false)
1613
}

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

-13
This file was deleted.

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

-16
This file was deleted.

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ pub mod csp;
22
pub mod cssxref;
33
pub mod domxref;
44
pub mod htmlxref;
5-
pub mod http_header;
5+
pub mod http;
66
pub mod jsxref;
7-
pub mod link;
87
pub mod rfc;
98
pub mod svgattr;
109
pub mod svgxref;

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,21 @@ pub fn invoke(
6262
"securecontext_header" => banners::secure_context_header_any,
6363
"availableinworkers" => banners::available_in_workers_any,
6464
"deprecated_header" => banners::deprecated_header_any,
65+
"non-standard_header" => banners::non_standard_header_any,
6566

6667
// links
6768
"csp" => links::csp::csp_any,
6869
"rfc" => links::rfc::rfc_any,
69-
"httpheader" => links::http_header::http_header_any,
7070
"cssxref" => links::cssxref::cssxref_any,
7171
"jsxref" => links::jsxref::jsxref_any,
7272
"domxref" => links::domxref::domxref_any,
7373
"htmlelement" => links::htmlxref::htmlxref_any,
7474
"svgelement" => links::svgxref::svgxref_any,
7575
"svgattr" => links::svgattr::svgattr_any,
7676
"webextapiref" => links::webextapixref::webextapixref_any,
77+
"httpstatus" => links::http::http_status_any,
78+
"httpheader" => links::http::http_header_any,
79+
"httpmethod" => links::http::http_method_any,
7780

7881
// sidebars
7982
"apiref" => apiref::apiref_any,

0 commit comments

Comments
 (0)