Make full base URL configurable

This commit is contained in:
Valentin Brandl 2020-11-24 19:06:42 +01:00
parent 391fa39470
commit 8e78d13443
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
@use super::base; @use super::base;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str, url: &str, service: &str, path: &str) @(version_info: VersionInfo, repo_count: usize, base_url: &str, url: &str, service: &str, path: &str)
@:base("Hits-of-Code Badges", "Badge Generator", { @:base("Hits-of-Code Badges", "Badge Generator", {
@ -10,7 +10,7 @@ Here is the markdown for the badge for <a href="https://@url/@path">@url/@path</
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/@service/@path)](https://@domain/view/@service/@path) [![Hits-of-Code](@base_url/@service/@path)](@base_url/view/@service/@path)
</pre> </pre>
<p> <p>
@ -18,6 +18,6 @@ It will be rendered like this
</p> </p>
<pre> <pre>
<a href="https://@domain/view/@service/@path"><img src="https://@domain/@service/@path" alt="example badge" /></a> <a href="@base_url/view/@service/@path"><img src="@base_url/@service/@path" alt="example badge" /></a>
</pre> </pre>
}, version_info, repo_count) }, version_info, repo_count)

View File

@ -1,7 +1,7 @@
@use super::base; @use super::base;
@use crate::statics::VersionInfo; @use crate::statics::VersionInfo;
@(version_info: VersionInfo, repo_count: usize, domain: &str) @(version_info: VersionInfo, repo_count: usize, base_url: &str)
@:base("Hits-of-Code Badges", "Hits-of-Code Badges", { @:base("Hits-of-Code Badges", "Hits-of-Code Badges", {
@ -24,7 +24,7 @@ used for GitHub, GitLab and Bitbucket repositories. Just put the following code
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](https://@domain/view/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;) [![Hits-of-Code](@base_url/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)](@base_url/view/&lt;service&gt;/&lt;user&gt;/&lt;repo&gt;)
</pre> </pre>
<p> <p>
@ -33,7 +33,7 @@ following Markdown
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@domain/github/vbrandl/hoc)](https://@domain/view/github/vbrandl/hoc) [![Hits-of-Code](@base_url/github/vbrandl/hoc)](@base_url/view/github/vbrandl/hoc)
</pre> </pre>
<p> <p>
@ -41,7 +41,7 @@ would render this badge:
</p> </p>
<pre> <pre>
<a href="https://@domain/view/github/vbrandl/hoc"><img src="https://@domain/github/vbrandl/hoc" <a href="@base_url/view/github/vbrandl/hoc"><img src="@base_url/github/vbrandl/hoc"
alt="example badge" /></a> alt="example badge" /></a>
</pre> </pre>
@ -55,7 +55,7 @@ in your repository or you want a badge for another branch of your repository, ju
You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object You can also request the HoC as JSON by appending <code>/json</code> to the request path. This will return a JSON object
with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and with three fields: <code>count</code> (the HoC value), <code>commits</code> (the number of commits) and
<code>head</code> (the commit ref of HEAD). Requesting <a <code>head</code> (the commit ref of HEAD). Requesting <a
href="https://@domain/github/vbrandl/hoc/json">https://@domain/github/vbrandl/hoc/json</a> might return something along href="@base_url/github/vbrandl/hoc/json">@base_url/github/vbrandl/hoc/json</a> might return something along
the lines of the lines of
</p> </p>

View File

@ -19,7 +19,7 @@ To include the badge in your readme, use the following markdown:
</p> </p>
<pre> <pre>
[![Hits-of-Code](https://@repo_info.domain/@repo_info.path?branch=@repo_info.branch)](https://@repo_info.domain/view/@repo_info.path?branch=@repo_info.branch) [![Hits-of-Code](@repo_info.base_url/@repo_info.path?branch=@repo_info.branch)](@repo_info.base_url/view/@repo_info.path?branch=@repo_info.branch)
</pre> </pre>