This commit is contained in:
commit
5dcc5a6e8d
2
.cargo/config
Normal file
2
.cargo/config
Normal file
@ -0,0 +1,2 @@
|
||||
[net]
|
||||
git-fetch-with-cli = true
|
13
.gitea/workflows/action.yml
Normal file
13
.gitea/workflows/action.yml
Normal file
@ -0,0 +1,13 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:20240215
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Tests
|
||||
run: cargo test --verbose
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
1060
Cargo.lock
generated
Normal file
1060
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "a"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
risp = {git="ssh://git@git.hofer.link:2222/philipp/risp.git", version="0.1"}
|
85
data/abgb.toml
Normal file
85
data/abgb.toml
Normal file
@ -0,0 +1,85 @@
|
||||
[law]
|
||||
id = 10001622
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "Theil"
|
||||
is_root = true
|
||||
match_function = "containsCaseSensitive"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "Abtheilung"
|
||||
is_root = false
|
||||
match_function = "contains"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "Hauptstück"
|
||||
is_root = false
|
||||
match_function = "contains"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "Abschnitt"
|
||||
is_root = false
|
||||
match_function = "contains"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "letter"
|
||||
is_root = false
|
||||
match_function = "starts_with_letter"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "roman numbering"
|
||||
is_root = false
|
||||
match_function = "starts_with_roman_number"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "numbering"
|
||||
is_root = false
|
||||
match_function = "starts_with_number"
|
||||
|
||||
[[law.classifiers]]
|
||||
name = "dash"
|
||||
is_root = false
|
||||
match_function = "starts_with_dash"
|
||||
|
||||
[parser]
|
||||
remove_strings = [
|
||||
"<tab />",
|
||||
"<b>", "</b>",
|
||||
"<i>", "</i>",
|
||||
"<n>", "</n>",
|
||||
"""<ueberschrift typ="g1" ct="text" halign="c">Zweyter Theil.</ueberschrift>""", # weird thing after § 858
|
||||
]
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = "Einleitung." # Should be at the same level as the other "Theil"e
|
||||
replace_with = "Nullter Theil. Einleitung"
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = "<gdash />"
|
||||
replace_with = "-"
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="g1" ct="text" halign="c">Medizinische Behandlung</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g1" ct="text" halign="c">- Medizinische Behandlung</ueberschrift>"""
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="g1min" ct="text" halign="c">Von den dinglichen Rechten.</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g2" ct="text" halign="c">Von den dinglichen Rechten.</ueberschrift>"""
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="para" ct="text" halign="c">Erfordernisse zur Ersitzung:</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g1" ct="text" halign="c">I. Erfordernisse zur Ersitzung:</ueberschrift>"""
|
||||
|
||||
# RIS uses multiple headers to get more attention...
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="g1" ct="text" halign="c">Zweyter Theil</ueberschrift><ueberschrift typ="g1" ct="text" halign="c">des</ueberschrift><ueberschrift typ="g1" ct="text" halign="c">bürgerlichen Gesetzbuches.</ueberschrift><ueberschrift typ="g1" ct="text" halign="c">Von dem Sachenrechte.</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g1" ct="text" halign="c">Zweyter Theil des bürgerlichen Gesetzbuches: Von dem Sachenrechte.</ueberschrift>"""
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="g1" ct="text" halign="c">Erste Abtheilung</ueberschrift><ueberschrift typ="g2" ct="text" halign="c">des Sachenrechtes.</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g1" ct="text" halign="c">Erste Abtheilung des Sachenrechtes.</ueberschrift>"""
|
||||
|
||||
[[parser.replace_rules]]
|
||||
find = """<ueberschrift typ="g1" ct="text" halign="c">Dritter Theil</ueberschrift><ueberschrift typ="g1min" ct="text" halign="c">des</ueberschrift><ueberschrift typ="g1min" ct="text" halign="c">bürgerlichen Gesetzbuches.</ueberschrift><ueberschrift typ="g1" ct="text" halign="c">Von den gemeinschaftlichen Bestimmungen der Personen- und Sachenrechte.</ueberschrift>"""
|
||||
replace_with = """<ueberschrift typ="g1" ct="text" halign="c">Dritter Theil des bürgerlichen Gesetzbuches.</ueberschrift><ueberschrift typ="g2" ct="text" halign="c">Von den gemeinschaftlichen Bestimmungen der Personen- und Sachenrechte.</ueberschrift>"""
|
||||
|
27
src/main.rs
Normal file
27
src/main.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use risp::law::{Heading, HeadingContent, Law};
|
||||
|
||||
fn print_header(header: Heading, level: usize) {
|
||||
let mut header_title = header.name.clone();
|
||||
if let Some(desc) = header.desc {
|
||||
header_title.push_str(&format!(" ({desc})"))
|
||||
}
|
||||
|
||||
println!("{} {header_title}", " ".repeat(level));
|
||||
|
||||
match header.content {
|
||||
HeadingContent::Paragraph(p) => {}
|
||||
HeadingContent::Heading(subheaders) => {
|
||||
for subheader in subheaders {
|
||||
print_header(subheader, level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let law = Law::from_config("data/abgb.toml").unwrap();
|
||||
|
||||
for h in law.header {
|
||||
print_header(h, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user