diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2020-04-21 17:50:05 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2020-04-21 17:50:05 +0200 |
| commit | 5c0cc8e2f4fd632445079abc7af1b65ca0d3a8e0 (patch) | |
| tree | 09c9629b24d848f648cbd6d00090c659035ef778 /src/theme.py | |
| parent | 5c07eda3fa0e48c7b8337f8b57b8390da86ee6d7 (diff) | |
Create package
Diffstat (limited to 'src/theme.py')
| -rw-r--r-- | src/theme.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/theme.py b/src/theme.py deleted file mode 100644 index 9859451..0000000 --- a/src/theme.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -from resource import Resource -from shutil import copytree, ignore_patterns -from jinja2 import Template -import os - -class Theme: - - def __init__(self, path, resource_data): - res=Resource(path+"/resources.json") - self.theme_path=path.strip('/') - self.data=res.json - self.data.update(resource_data) - # Read theme - try: - with open(path+"/index.html",'r') as f: - self.template=Template(f.read()) - except IOError: - print("Unable to found "+resource) - exit(1) - - - def deploy(self, path): - copytree(self.theme_path, path, dirs_exist_ok=True,ignore=ignore_patterns("*.json","index.html")) - themes_dir=os.path.split(self.theme_path)[0] - theme_dir=os.path.split(self.theme_path)[1] - with open(path+"/index.html", "w") as index: - index.write(self.template.render(self.data)) |
