Introduce database code and remove unused block key
All code should be done within the new code directory. Created db.py for reading the YAML file. Removed block key from blocks; always a None value.
This commit is contained in:
parent
78390c9098
commit
5c218c68c4
16
code/db.py
Normal file
16
code/db.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import json
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
DATA="../data/styrman-blocks.yml"
|
||||||
|
|
||||||
|
def load_yaml(filename):
|
||||||
|
with open(filename, 'r') as f:
|
||||||
|
return yaml.safe_load(f)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
data = load_yaml(DATA)
|
||||||
|
json_data = json.dumps(data, indent=2)
|
||||||
|
print(json_data)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@ -2,8 +2,7 @@
|
|||||||
# Text blocks
|
# Text blocks
|
||||||
|
|
||||||
blocks:
|
blocks:
|
||||||
- block:
|
- layer: 1
|
||||||
layer: 1
|
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
Matti Matinpk
|
Matti Matinpk
|
||||||
@ -25,8 +24,7 @@ blocks:
|
|||||||
oli veljensä Eerik Matinpojan
|
oli veljensä Eerik Matinpojan
|
||||||
jälkeen isäntänä Vävylässä
|
jälkeen isäntänä Vävylässä
|
||||||
v. 1749-1779
|
v. 1749-1779
|
||||||
- block:
|
- link: 1
|
||||||
link: 1
|
|
||||||
layer: 2
|
layer: 2
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
@ -70,8 +68,7 @@ blocks:
|
|||||||
Juho Jaakonpk, Mauno Junonpk, Paavo Maunonpk,
|
Juho Jaakonpk, Mauno Junonpk, Paavo Maunonpk,
|
||||||
ja Olli Paavonpk Takala
|
ja Olli Paavonpk Takala
|
||||||
link: 3
|
link: 3
|
||||||
- block:
|
- link: 2
|
||||||
link: 2
|
|
||||||
layer: 3
|
layer: 3
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
@ -104,8 +101,7 @@ blocks:
|
|||||||
Mikkola
|
Mikkola
|
||||||
s.06.05.1808
|
s.06.05.1808
|
||||||
k.xx.xx.xxxx
|
k.xx.xx.xxxx
|
||||||
- block:
|
- link: 3
|
||||||
link: 3
|
|
||||||
layer: 3
|
layer: 3
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
@ -132,8 +128,7 @@ blocks:
|
|||||||
pso
|
pso
|
||||||
Juho Eerikinpk
|
Juho Eerikinpk
|
||||||
Rantala
|
Rantala
|
||||||
- block:
|
- link: 4
|
||||||
link: 4
|
|
||||||
layer: 4
|
layer: 4
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
@ -156,8 +151,7 @@ blocks:
|
|||||||
Mikkola
|
Mikkola
|
||||||
s.16.04.1843 Elimäki
|
s.16.04.1843 Elimäki
|
||||||
k.xx.xx.xxxx
|
k.xx.xx.xxxx
|
||||||
- block:
|
- link: 5
|
||||||
link: 5
|
|
||||||
layer: 4
|
layer: 4
|
||||||
texts:
|
texts:
|
||||||
- text: |
|
- text: |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user