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
|
||||
|
||||
blocks:
|
||||
- block:
|
||||
layer: 1
|
||||
- layer: 1
|
||||
texts:
|
||||
- text: |
|
||||
Matti Matinpk
|
||||
@ -25,8 +24,7 @@ blocks:
|
||||
oli veljensä Eerik Matinpojan
|
||||
jälkeen isäntänä Vävylässä
|
||||
v. 1749-1779
|
||||
- block:
|
||||
link: 1
|
||||
- link: 1
|
||||
layer: 2
|
||||
texts:
|
||||
- text: |
|
||||
@ -70,8 +68,7 @@ blocks:
|
||||
Juho Jaakonpk, Mauno Junonpk, Paavo Maunonpk,
|
||||
ja Olli Paavonpk Takala
|
||||
link: 3
|
||||
- block:
|
||||
link: 2
|
||||
- link: 2
|
||||
layer: 3
|
||||
texts:
|
||||
- text: |
|
||||
@ -104,8 +101,7 @@ blocks:
|
||||
Mikkola
|
||||
s.06.05.1808
|
||||
k.xx.xx.xxxx
|
||||
- block:
|
||||
link: 3
|
||||
- link: 3
|
||||
layer: 3
|
||||
texts:
|
||||
- text: |
|
||||
@ -132,8 +128,7 @@ blocks:
|
||||
pso
|
||||
Juho Eerikinpk
|
||||
Rantala
|
||||
- block:
|
||||
link: 4
|
||||
- link: 4
|
||||
layer: 4
|
||||
texts:
|
||||
- text: |
|
||||
@ -156,8 +151,7 @@ blocks:
|
||||
Mikkola
|
||||
s.16.04.1843 Elimäki
|
||||
k.xx.xx.xxxx
|
||||
- block:
|
||||
link: 5
|
||||
- link: 5
|
||||
layer: 4
|
||||
texts:
|
||||
- text: |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user