Start moving config stuff to separate config file.

This commit is contained in:
Markus Birth 2021-07-27 12:44:19 +02:00
parent 1fec7c8aa1
commit f5b71ce6e8
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
5 changed files with 135 additions and 11 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
grav/
jekyll/
/config.yaml

View File

@ -1,15 +1,11 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
python-frontmatter = "*"
pytz = "*"
pyyaml = "*"
[dev-packages]

70
Pipfile.lock generated Normal file
View File

@ -0,0 +1,70 @@
{
"_meta": {
"hash": {
"sha256": "80e20d60ab55b386ef8a6294cfd3e9712ae0ea8aeb23582f66e8534f61361e74"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"python-frontmatter": {
"hashes": [
"sha256:766ae75f1b301ffc5fe3494339147e0fd80bc3deff3d7590a93991978b579b08",
"sha256:e98152e977225ddafea6f01f40b4b0f1de175766322004c826ca99842d19a7cd"
],
"index": "pypi",
"version": "==1.0.0"
},
"pytz": {
"hashes": [
"sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da",
"sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"
],
"index": "pypi",
"version": "==2021.1"
},
"pyyaml": {
"hashes": [
"sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf",
"sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696",
"sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393",
"sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77",
"sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922",
"sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5",
"sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8",
"sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10",
"sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc",
"sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018",
"sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e",
"sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253",
"sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347",
"sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183",
"sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541",
"sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb",
"sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185",
"sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc",
"sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db",
"sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa",
"sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46",
"sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122",
"sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b",
"sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63",
"sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df",
"sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc",
"sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247",
"sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6",
"sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"
],
"index": "pypi",
"version": "==5.4.1"
}
},
"develop": {}
}

49
config.yaml.example Normal file
View File

@ -0,0 +1,49 @@
general:
jekyll_dir: jekyll
grav_dir: grav/user/pages
# Timezone for stamps without one
timezone: Europe/Berlin
# Special mapping from Jekyll top-level directories to
# GRAV top-level dirs. E.g. to add sorting.
jekyll2grav_directories:
know-how: 03.know-how
misc: 04.misc
reviews: 05.reviews
software: 06.software
grav_defaults:
# GRAV document type for Jekyll posts
item_type: item
# Default language if not specified in Jekyll document
language: en
# Default frontmatter data for ALL converted items
frontmatter:
visible: true
# Default categories/tags for ALL converted items
categories: [wiki]
tags: []
# As Jekyll only knows tags, specify which tags are to be
# considered GRAV categories. Tags not mentioned here will
# be kept as tags
grav_categories:
- know-how
- development
- review
- hacking
- hardware
- software
- miscellaneous
# Create a map of old URL > new URL to e.g. migrate Disqus comments
url_map:
enabled: true
jekyll_base_url: https://wiki.mbirth.de/
grav_base_url: https://wiki.mbirth.de/
# If "Include default language" is enabled in GRAV's System settings,
# we need to generate URLs with it, too.
grav_include_default_language: true
# Separator between old and new URLs. Disqus uses ", " (CSV)
list_separator: ", "

View File

@ -6,11 +6,17 @@ import os
import frontmatter
import pytz
import re
import yaml
SRCDIR="jekyll"
GRAVDIR="grav/user/pages"
with open("config.yaml", "rt") as f:
config = yaml.load(f)
GRAV_TYPE="item"
print(repr(config))
SRCDIR=config["general"]["jekyll_dir"]
GRAVDIR=config["general"]["grav_dir"]
GRAV_TYPE = config["grav_defaults"]["item_type"]
# Translates Jekyll top level folders to GRAV (sorted)
FIRST_LEVEL = {
@ -23,7 +29,7 @@ FIRST_LEVEL = {
DATEFORMAT_IN="%Y-%m-%d %H:%M:%S %z"
DATEFORMAT_OUT="%Y-%m-%d %H:%M:%S"
LOCAL_TIMEZONE=pytz.timezone("Europe/Berlin")
LOCAL_TIMEZONE=pytz.timezone(config["general"]["timezone"])
# Jekyll-tags that are considered to be categories, not tags
CATEGORIES=["know-how", "development", "review", "hacking", "hardware", "software", "miscellaneous"]
@ -46,8 +52,8 @@ def convert_file(filepath):
post["taxonomy"] = {
"category": ["wiki"],
"tag": []
"category": config["grav_defaults"]["categories"],
"tag": config["grav_defaults"]["tags"],
}
for t in post["tags"]: