Use new aliases for template functions

`page.rs.html` used to result in a function `templates::page`.
Since ructe 0.7.2, `templates::page_html` was used and now the old alias
has been removed.
This commit is contained in:
Valentin Brandl 2023-01-30 09:22:45 +01:00
parent 74a9f74455
commit 4ddaa84e5f
8 changed files with 18 additions and 18 deletions

View File

@ -43,11 +43,11 @@ impl ResponseError for Error {
let mut buf = Vec::new(); let mut buf = Vec::new();
match self { match self {
Error::BranchNotFound => { Error::BranchNotFound => {
templates::p404_no_master(&mut buf, VERSION_INFO, 0).unwrap(); templates::p404_no_master_html(&mut buf, VERSION_INFO, 0).unwrap();
HttpResponse::NotFound().content_type("text/html").body(buf) HttpResponse::NotFound().content_type("text/html").body(buf)
} }
_ => { _ => {
templates::p500(&mut buf, VERSION_INFO, 0).unwrap(); templates::p500_html(&mut buf, VERSION_INFO, 0).unwrap();
HttpResponse::InternalServerError() HttpResponse::InternalServerError()
.content_type("text/html") .content_type("text/html")
.body(buf) .body(buf)

View File

@ -408,7 +408,7 @@ async fn overview<T: Service>(
url: &url, url: &url,
branch, branch,
}; };
templates::overview( templates::overview_html(
&mut buf, &mut buf,
VERSION_INFO, VERSION_INFO,
rc_clone.load(Ordering::Relaxed), rc_clone.load(Ordering::Relaxed),
@ -433,7 +433,7 @@ async fn index(
repo_count: web::Data<AtomicUsize>, repo_count: web::Data<AtomicUsize>,
) -> Result<HttpResponse> { ) -> Result<HttpResponse> {
let mut buf = Vec::new(); let mut buf = Vec::new();
templates::index( templates::index_html(
&mut buf, &mut buf,
VERSION_INFO, VERSION_INFO,
repo_count.load(Ordering::Relaxed), repo_count.load(Ordering::Relaxed),
@ -459,7 +459,7 @@ async fn generate(
.filter(|s| !s.is_empty()) .filter(|s| !s.is_empty())
.unwrap_or("master"), .unwrap_or("master"),
}; };
templates::generate( templates::generate_html(
&mut buf, &mut buf,
VERSION_INFO, VERSION_INFO,
repo_count.load(Ordering::Relaxed), repo_count.load(Ordering::Relaxed),
@ -472,7 +472,7 @@ async fn generate(
fn p404(repo_count: web::Data<AtomicUsize>) -> Result<HttpResponse> { fn p404(repo_count: web::Data<AtomicUsize>) -> Result<HttpResponse> {
let mut buf = Vec::new(); let mut buf = Vec::new();
templates::p404(&mut buf, VERSION_INFO, repo_count.load(Ordering::Relaxed))?; templates::p404_html(&mut buf, VERSION_INFO, repo_count.load(Ordering::Relaxed))?;
Ok(HttpResponse::NotFound().content_type("text/html").body(buf)) Ok(HttpResponse::NotFound().content_type("text/html").body(buf))
} }

View File

@ -1,9 +1,9 @@
@use super::base; @use super::base_html;
@use crate::{statics::VersionInfo, template::RepoGeneratorInfo}; @use crate::{statics::VersionInfo, template::RepoGeneratorInfo};
@(version_info: VersionInfo, repo_count: usize, base_url: &str, repo_info: &RepoGeneratorInfo) @(version_info: VersionInfo, repo_count: usize, base_url: &str, repo_info: &RepoGeneratorInfo)
@:base("Hits-of-Code Badges", "Badge Generator", { @:base_html("Hits-of-Code Badges", "Badge Generator", {
<p> <p>
Here is the markdown for the badge for <a href="https://@repo_info.service.url()/@repo_info.user/@repo_info.repo">@repo_info.user/@repo_info.repo</a> Here is the markdown for the badge for <a href="https://@repo_info.service.url()/@repo_info.user/@repo_info.repo">@repo_info.user/@repo_info.repo</a>

View File

@ -1,9 +1,9 @@
@use super::base; @use super::base_html;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, base_url: &str) @(version_info: VersionInfo, repo_count: usize, base_url: &str)
@:base("Hits-of-Code Badges", "Hits-of-Code Badges", { @:base_html("Hits-of-Code Badges", "Hits-of-Code Badges", {
<p> <p>
This API offers badges for the Hits-of-Code metric for your repositories. This metric was proposed by This API offers badges for the Hits-of-Code metric for your repositories. This metric was proposed by

View File

@ -1,10 +1,10 @@
@use super::base; @use super::base_html;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@use crate::template::RepoInfo; @use crate::template::RepoInfo;
@(version_info: VersionInfo, repo_count: usize, repo_info: RepoInfo, label: String) @(version_info: VersionInfo, repo_count: usize, repo_info: RepoInfo, label: String)
@:base("Hits-of-Code Badges", "Overview", { @:base_html("Hits-of-Code Badges", "Overview", {
<p> <p>
The project <a href="@repo_info.url">@repo_info.url</a> has The project <a href="@repo_info.url">@repo_info.url</a> has

View File

@ -1,9 +1,9 @@
@use super::base; @use super::base_html;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize) @(version_info: VersionInfo, repo_count: usize)
@:base("Page not Found - Hits-of-Code Badges", "404 - Page not Found", { @:base_html("Page not Found - Hits-of-Code Badges", "404 - Page not Found", {
<p> <p>
<big>Sorry</big>. I couldn't find the page you are looking for. Please go <a href="/">back to the homepage</a>. <big>Sorry</big>. I couldn't find the page you are looking for. Please go <a href="/">back to the homepage</a>.
</p> </p>

View File

@ -1,9 +1,9 @@
@use super::base; @use super::base_html;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize) @(version_info: VersionInfo, repo_count: usize)
@:base("Branch not Found - Hits-of-Code Badges", "404 - Branch not Found", { @:base_html("Branch not Found - Hits-of-Code Badges", "404 - Branch not Found", {
<p> <p>
<big>Sorry</big>. I couldn't find the requested branch of your repositroy. Currently this service assumes the <big>Sorry</big>. I couldn't find the requested branch of your repositroy. Currently this service assumes the
extistence of a branch named <code>master</code>. If you'd like to request a badge for another branch, you can do so by extistence of a branch named <code>master</code>. If you'd like to request a badge for another branch, you can do so by

View File

@ -1,9 +1,9 @@
@use super::base; @use super::base_html;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize) @(version_info: VersionInfo, repo_count: usize)
@:base("Internal Server Error - Hits-of-Code Badges", "500 - Internal Server Error", { @:base_html("Internal Server Error - Hits-of-Code Badges", "500 - Internal Server Error", {
<p> <p>
<big>Oops</big>. Looks like a made a mistake. Please go <a href="/">back to the homepage</a> and try again. <big>Oops</big>. Looks like a made a mistake. Please go <a href="/">back to the homepage</a> and try again.
</p> </p>