updates
This commit is contained in:
12
classes.py
12
classes.py
@@ -72,7 +72,7 @@ class ContentItem:
|
|||||||
js_filepath = Path(f"{self.source_filename.parent}/{self.source_filename.stem}.js")
|
js_filepath = Path(f"{self.source_filename.parent}/{self.source_filename.stem}.js")
|
||||||
self.js_file = js_filepath if js_filepath.exists() else ""
|
self.js_file = js_filepath if js_filepath.exists() else ""
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(f"Parser error, {e}")
|
||||||
|
|
||||||
def create_content(self):
|
def create_content(self):
|
||||||
with open(self.source_filename, mode="w", encoding="utf-8") as f:
|
with open(self.source_filename, mode="w", encoding="utf-8") as f:
|
||||||
@@ -140,14 +140,14 @@ class Site:
|
|||||||
self.output_dir.mkdir()
|
self.output_dir.mkdir()
|
||||||
|
|
||||||
# Create public subdirs
|
# Create public subdirs
|
||||||
subdirs = [self.images_dir, self.css_dir, self.js_dir, self.content_dir, "categories"]
|
#subdirs = [self.images_dir, self.css_dir, self.js_dir, self.content_dir, "categories"]
|
||||||
|
subdirs = ["static", "categories"]
|
||||||
for subdir in subdirs:
|
for subdir in subdirs:
|
||||||
subdir = self.output_dir / subdir
|
subdir = self.output_dir / subdir
|
||||||
subdir.mkdir(parents=True, exist_ok=True)
|
subdir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Copy static files if exist
|
# Copy theme's static dir to 'public/static
|
||||||
if self.static_dir.exists():
|
shutil.copytree(f"{base_dir}/themes/{Config.THEME}/static", f"{self.output_dir}/static", dirs_exist_ok=True)
|
||||||
shutil.copytree(self.static_dir, self.output_dir / self.static_dir, dirs_exist_ok=True)
|
|
||||||
|
|
||||||
# Get content items
|
# Get content items
|
||||||
self.get_content_items()
|
self.get_content_items()
|
||||||
@@ -160,7 +160,7 @@ class Site:
|
|||||||
content_item.render_content(categories = self.categories)
|
content_item.render_content(categories = self.categories)
|
||||||
|
|
||||||
# Render the about file
|
# Render the about file
|
||||||
about_content = ContentItem(Path('static/about.md'))
|
about_content = ContentItem(Path(f'themes/{Config.THEME}/static/about.md'))
|
||||||
about_content.parse_content()
|
about_content.parse_content()
|
||||||
about_content.render_content(categories = self.categories)
|
about_content.render_content(categories = self.categories)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user