Пересобранный и видоизмененный conky для ОСГОС
This commit is contained in:
commit
3a48cf8c86
738 changed files with 217718 additions and 0 deletions
41
doc/render.py
Executable file
41
doc/render.py
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import yaml
|
||||
import datetime
|
||||
|
||||
base_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
with open(os.path.join(base_path, "config_settings.yaml")) as file:
|
||||
config_settings = yaml.safe_load(file)
|
||||
|
||||
with open(os.path.join(base_path, "variables.yaml")) as file:
|
||||
variables = yaml.safe_load(file)
|
||||
|
||||
with open(os.path.join(base_path, "lua.yaml")) as file:
|
||||
lua = yaml.safe_load(file)
|
||||
|
||||
data = {
|
||||
"config_settings": config_settings,
|
||||
"variables": variables,
|
||||
"lua": lua,
|
||||
"date": datetime.date.today().isoformat(),
|
||||
"copyright_year": datetime.date.today().year,
|
||||
}
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
||||
|
||||
|
||||
def reverse_format(param_list, format_string):
|
||||
return format_string.format(param_list)
|
||||
|
||||
|
||||
env = Environment(
|
||||
loader=FileSystemLoader("."),
|
||||
autoescape=select_autoescape(),
|
||||
)
|
||||
env.filters["reverse_format"] = reverse_format
|
||||
|
||||
template = env.get_template(sys.argv[1])
|
||||
print(template.render(data))
|
||||
Loading…
Add table
Add a link
Reference in a new issue