Add templates
This commit is contained in:
parent
07bcc3519e
commit
3990ea0a12
13
build.rs
Normal file
13
build.rs
Normal file
@ -0,0 +1,13 @@
|
||||
extern crate ructe;
|
||||
extern crate vergen;
|
||||
|
||||
use ructe::Ructe;
|
||||
use vergen::{generate_cargo_keys, ConstantsFlags};
|
||||
|
||||
fn main() {
|
||||
let flags = ConstantsFlags::SHA_SHORT;
|
||||
generate_cargo_keys(flags).expect("Unable to generate the cargo keys!");
|
||||
Ructe::from_env()
|
||||
.expect("ructe")
|
||||
.compile_templates("templates");
|
||||
}
|
49
templates/base.rs.html
Normal file
49
templates/base.rs.html
Normal file
@ -0,0 +1,49 @@
|
||||
@(title: &str, header: &str, content: Content, commit: &str, version: &str)
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="keywords" content="Hits-of-Code, GitHub, Badge" />
|
||||
<meta name="description" content="Hits-of-Code Badges for Git repositories" />
|
||||
<link rel="stylesheet" href="tacit-css.min.css" />
|
||||
<title>@title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<section>
|
||||
<header>
|
||||
<h1>@header</h1>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
@:content()
|
||||
</article>
|
||||
|
||||
<footer>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<small>Created by <a href="https://www.vbrandl.net">Valentin Brandl</a>.</small>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<small>HoC v@version - <a href="https://github.com/vbrandl/hoc/commit/@commit">@commit</a></small>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><small><a href="https://github.com/vbrandl/hoc">GitHub</a></small></li>
|
||||
<li><small><a href="https://opensource.org/licenses/MIT">MIT License</a></small></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
63
templates/index.rs.html
Normal file
63
templates/index.rs.html
Normal file
@ -0,0 +1,63 @@
|
||||
@use super::base;
|
||||
|
||||
@(commit: &str, version: &str)
|
||||
|
||||
@:base("Hits-of-Code Badges", "Hits-of-Code Badges", {
|
||||
|
||||
<p>
|
||||
This API offers badges for the Hits-of-Code metric for your repositories. This metric was proposed by
|
||||
<a href="https://www.yegor256.com/">Yegor Bugayenko</a> as an
|
||||
<a href="https://www.yegor256.com/2014/11/14/hits-of-code.html">alternative to Lines-of-Code</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Instead of counting the number of existing lines in a codebase, the number of modified lines is counted. That way, the
|
||||
metric can only grow and never shrink. While this metric still cannot give any information about the code quality, it
|
||||
gives an overview about the amount of work put into a codebase.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There is a <a href="https://github.com/yegor256/hoc/">command-line tool</a> to calculate the HoC of a repository, but
|
||||
some people might want a nice badge to put in their README, that's why I implemented this API. Currently the API can be
|
||||
used for GitHub, GitLab and Bitbucket repositories. Just put the following code in your README:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[![Hits-of-Code](https://hitsofcode.com/<service>/<user>/<repo>)](https://hitsofcode.com/view/<service>/<user>/<repo>)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
where <code><service></code> is one of <code>github</code>, <code>gitlab</code> or <code>bitbucket</code>. So the
|
||||
following Markdown
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
[![Hits-of-Code](https://hitsofcode.com/github/vbrandl/hoc)](https://hitsofcode.com/view/github/vbrandl/hoc)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
would render this badge:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<a href="https://hitsofcode.com/view/github/vbrandl/hoc"><img src="https://hitsofcode.com/github/vbrandl/hoc"
|
||||
alt="example badge" /></a>
|
||||
</pre>
|
||||
|
||||
<h2>Source Code</h2>
|
||||
|
||||
<p>
|
||||
The whole service is licensed under the <a href="https://opensource.org/licenses/MIT">MIT license</a> and the source
|
||||
code <a href="https://github.com/vbrandl/hoc">can be found on GitHub</a>. Feature proposals or pull requests are
|
||||
welcome.
|
||||
</p>
|
||||
|
||||
<h2>Contact</h2>
|
||||
|
||||
<p>
|
||||
You can reach me via mail: <a href="mailto:mail+hoc@@vbrandl.net">mail+hoc@@vbrandl.net</a> preferably using
|
||||
my <a href="https://mirror.oldsql.cc/key.asc">GPG key</a>
|
||||
(<a href="http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x1FFE431282F4B8CC0A7579167FB009175885FC76">from a
|
||||
keyserver</a>), or by using any other UID from my key.
|
||||
</p>
|
||||
}, commit, version)
|
13
templates/p404.rs.html
Normal file
13
templates/p404.rs.html
Normal file
@ -0,0 +1,13 @@
|
||||
@use super::base;
|
||||
|
||||
@(commit: &str, version: &str)
|
||||
|
||||
@:base("Page not Found - Hits-of-Code Badges", "404 - Page not Found", {
|
||||
<p>
|
||||
<big>Sorry</big>. I couldn't find the page you are looking for. Please go <a href="/">back to the homepage</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you think, this is a mistake on my side, please <a href="mailto:mail+hoc@@vbrandl.net">drop me a mail</a>.
|
||||
</p>
|
||||
}, commit, version)
|
13
templates/p500.rs.html
Normal file
13
templates/p500.rs.html
Normal file
@ -0,0 +1,13 @@
|
||||
@use super::base;
|
||||
|
||||
@(commit: &str, version: &str)
|
||||
|
||||
@:base("Internal Server Error - Hits-of-Code Badges", "500 - Internal Server Error", {
|
||||
<p>
|
||||
<big>Oops</big>. Looks like a made a mistake. Please go <a href="/">back to the homepage</a> and try again.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you think, this is a bug, please <a href="mailto:mail+hoc@@vbrandl.net">drop me a mail</a>.
|
||||
</p>
|
||||
}, commit, version)
|
Loading…
Reference in New Issue
Block a user