Merge pull request 'favicon' (#6) from favicon into main
All checks were successful
CI/CD Pipeline / deploy-main (push) Successful in 1m10s

Reviewed-on: #6
This commit is contained in:
philipp 2024-02-20 13:04:07 +01:00
commit 6f8adc73c9
22 changed files with 159 additions and 96 deletions

View File

@ -2,6 +2,8 @@ use std::fs;
use risp::law::{Content, Heading, HeadingContent, Law, Section}; use risp::law::{Content, Heading, HeadingContent, Law, Section};
use crate::part::Parts;
fn print_content(content: Content) -> String { fn print_content(content: Content) -> String {
let mut ret = String::new(); let mut ret = String::new();
@ -114,6 +116,8 @@ pub(crate) fn create_law_files() -> String {
.replace("{{content}}", &content) .replace("{{content}}", &content)
.replace("{{title}}", &lawname); .replace("{{title}}", &lawname);
let site = Parts::new().perform(site);
li_of_files.push_str(&format!( li_of_files.push_str(&format!(
"<li><a href='./{law_name}' title='{law_name}' class='contrast'>{lawname}</a></li>" "<li><a href='./{law_name}' title='{law_name}' class='contrast'>{lawname}</a></li>"
)); ));

View File

@ -1,6 +1,9 @@
use std::{fs, path::Path}; use std::{fs, path::Path};
use part::Parts;
mod law; mod law;
mod part;
fn main() { fn main() {
fs::create_dir_all("./output").unwrap(); fs::create_dir_all("./output").unwrap();
@ -15,6 +18,7 @@ fn main() {
fn create_index(content: &str) { fn create_index(content: &str) {
let mut index = fs::read_to_string("templates/index.html").unwrap(); let mut index = fs::read_to_string("templates/index.html").unwrap();
index = index.replace("{{content}}", content); index = index.replace("{{content}}", content);
let index = Parts::new().perform(index);
fs::write("output/index.html", &index).expect("Unable to write file"); fs::write("output/index.html", &index).expect("Unable to write file");
} }

32
src/part.rs Normal file
View File

@ -0,0 +1,32 @@
use std::{collections::HashMap, fs, path::Path};
pub(crate) struct Parts {
parts: HashMap<String, String>,
}
impl Parts {
pub(crate) fn new() -> Self {
let mut parts = HashMap::new();
let parts_path = Path::new("templates/parts");
for part in fs::read_dir(parts_path).expect("No templates/parts folder") {
let part = part.unwrap();
let filename = format!("{}", part.file_name().into_string().unwrap());
let filename = filename.replace(".html", "");
let path = format!("{}", part.path().display());
let template = fs::read_to_string(path).unwrap();
parts.insert(filename, template);
}
Self { parts }
}
pub(crate) fn perform(&self, input: String) -> String {
let mut input = input;
for (key, value) in &self.parts {
let replace = format!("{{{{{}}}}}", key);
input = input.replace(&replace, value);
}
input
}
}

View File

@ -1,58 +1,13 @@
<html lang="de" data-theme="dark"> <html lang="de" data-theme="dark">
<head> {{head}}
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RIS Parser</title>
<meta name="description" content="RIS Parser für Bundesgesetze in Österreich" />
<link rel="stylesheet" href="pico.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body> <body>
<header> {{header}}
<div class="container">
<a href="/" class="contrast" title="Link zur Startseite">
<strong>RIS</strong>
<span>parser</span>
</a>
</div>
</header>
<main class="container"> <main class="container">
<ol> <ol>
{{content}} {{content}}
</ol> </ol>
</main> </main>
<footer> {{footer}}
<div class="container">
<nav>
<ul>
<li>
<!--TODO: Impressum / Datenschutz hinzufügen wenn aktiv aria-current="page" -->
<a class="contrast" href="/datenschutz">Datenschutz</a>
</li>
<li>
<a class="contrast" href="/impressum">Impressum</a>
</li>
</ul>
</nav>
<button id="theme-toggle-js" type="button" data-theme="light" class="btn btn-primary">
<span class="inline dark-hidden">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"
/>
</svg>
</span>
<span class="hidden dark-inline">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"
/>
</svg>
</span>
</button>
</div>
</footer>
<script src="app.js"></script> <script src="app.js"></script>
</body> </body>
</html> </html>

View File

@ -1,22 +1,7 @@
<html lang="de" data-theme="dark"> <html lang="de" data-theme="dark">
<head> {{head}}
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RIS Parser</title>
<meta name="description" content="RIS Parser für Bundesgesetze in Österreich" />
<link rel="stylesheet" href="pico.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body> <body>
<header> {{header}}
<div class="container">
<a href="/" class="contrast" title="Link zur Startseite">
<strong>RIS</strong>
<span>parser</span>
</a>
</div>
</header>
<main class="container"> <main class="container">
<div class="btn-container"> <div class="btn-container">
<button class="btn-open open-js">Alles öffnen</button> <button class="btn-open open-js">Alles öffnen</button>
@ -25,37 +10,7 @@
<h1><mark>{{title}}</mark></h1> <h1><mark>{{title}}</mark></h1>
{{content}} {{content}}
</main> </main>
<footer> {{footer}}
<div class="container">
<nav>
<ul>
<li>
<!--TODO: Impressum / Datenschutz hinzufügen wenn aktiv aria-current="page" -->
<a class="contrast" href="/datenschutz">Datenschutz</a>
</li>
<li>
<a class="contrast" href="/impressum">Impressum</a>
</li>
</ul>
</nav>
<button id="theme-toggle-js" type="button" data-theme="light" class="btn btn-primary">
<span class="inline dark-hidden">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"
/>
</svg>
</span>
<span class="hidden dark-inline">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"
/>
</svg>
</span>
</button>
</div>
</footer>
<script src="app.js"></script> <script src="app.js"></script>
<script src="toggle.js"></script> <script src="toggle.js"></script>
</body> </body>

View File

@ -0,0 +1,31 @@
<footer>
<div class="container">
<nav>
<ul>
<li>
<!--TODO: Impressum / Datenschutz hinzufügen wenn aktiv aria-current="page" -->
<a class="contrast" href="/datenschutz">Datenschutz</a>
</li>
<li>
<a class="contrast" href="/impressum">Impressum</a>
</li>
</ul>
</nav>
<button id="theme-toggle-js" type="button" data-theme="light" class="btn btn-primary">
<span class="inline dark-hidden">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"
/>
</svg>
</span>
<span class="hidden dark-inline">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"
/>
</svg>
</span>
</button>
</div>
</footer>

16
templates/parts/head.html Normal file
View File

@ -0,0 +1,16 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RIS Parser</title>
<meta name="description" content="RIS Parser für Bundesgesetze in Österreich" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="pico.min.css" />
<link rel="stylesheet" href="style.css" />
</head>

View File

@ -0,0 +1,8 @@
<header>
<div class="container">
<a href="/" class="contrast" title="Link zur Startseite">
<strong>RIS</strong>
<span>parser</span>
</a>
</div>
</header>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,30 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M3269 6996 c-2 -2 -41 -6 -87 -10 -256 -19 -711 -121 -897 -201 -16
-7 -57 -23 -90 -35 -33 -13 -102 -43 -154 -67 -51 -23 -95 -43 -97 -43 -2 0
-44 -22 -94 -50 -49 -27 -104 -58 -122 -68 -44 -24 -266 -169 -300 -196 -14
-11 -41 -32 -59 -46 -86 -65 -244 -203 -335 -294 -167 -167 -218 -228 -432
-516 -91 -122 -261 -442 -338 -634 -25 -61 -49 -119 -54 -128 -6 -10 -10 -25
-10 -33 0 -8 -4 -23 -9 -33 -21 -38 -110 -360 -125 -452 -3 -19 -8 -46 -11
-60 -11 -55 -35 -230 -42 -310 -15 -164 -8 -625 12 -728 1 -9 6 -42 9 -73 4
-31 9 -67 11 -80 3 -13 7 -37 9 -54 11 -75 62 -283 103 -415 169 -547 461
-1030 867 -1435 336 -334 713 -587 1139 -762 103 -42 382 -138 431 -147 12 -3
53 -12 91 -21 84 -20 88 -21 190 -40 101 -18 164 -27 300 -42 91 -10 539 -10
630 0 130 14 240 28 255 32 8 2 31 7 50 10 19 3 58 10 85 15 28 6 60 12 72 15
80 15 406 113 468 140 17 8 71 30 120 50 247 100 560 283 775 452 155 121 361
314 480 448 195 220 380 494 513 760 50 100 136 295 142 320 1 5 5 17 8 25 57
139 140 450 171 645 33 205 41 317 41 575 0 198 -7 353 -19 415 -2 11 -7 43
-10 70 -6 48 -21 138 -30 180 -59 275 -108 441 -200 663 -220 538 -573 1010
-1039 1390 -313 255 -715 473 -1107 600 -160 52 -361 102 -470 118 -19 3 -60
9 -90 15 -30 5 -82 12 -115 15 -33 3 -71 8 -85 11 -28 5 -546 14 -551 9z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}