favicon #6
@ -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>"
|
||||||
));
|
));
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/part.rs
Normal file
33
src/part.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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);
|
||||||
|
println!("{replace}");
|
||||||
|
input = input.replace(&replace, value);
|
||||||
|
}
|
||||||
|
input
|
||||||
|
}
|
||||||
|
}
|
@ -1,65 +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="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>
|
|
||||||
<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>
|
||||||
|
@ -1,29 +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="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>
|
|
||||||
<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>
|
||||||
@ -32,37 +10,7 @@
|
|||||||
<h1><mark>{{title}}</mark></h1>
|
<h1><mark>{{title}}</mark></h1>
|
||||||
{{content}}
|
{{content}}
|
||||||
</main>
|
</main>
|
||||||
<footer style="padding-bottom: 5rem;">
|
{{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>
|
||||||
|
31
templates/parts/footer.html
Normal file
31
templates/parts/footer.html
Normal 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
16
templates/parts/head.html
Normal 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>
|
8
templates/parts/header.html
Normal file
8
templates/parts/header.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user