summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-06-04 22:57:59 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-06-04 22:57:59 -0600
commit1648e4f8b41e0c0417485e0375a1675cd7ab7746 (patch)
treea0c68e29e2e7a7a39a4e46fd6cecf8fbf69d0b14
parent135c6380ad381762c89276bed4b8736e235529ff (diff)
add ability to copy basic template filesv0.5.0
-rw-r--r--ChangeLog1
-rw-r--r--README.md2
-rw-r--r--pyssgrc2
-rw-r--r--src/pyssg/builder.py1
-rw-r--r--src/pyssg/plt/__init__.py0
-rw-r--r--src/pyssg/pyssg.py17
6 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f6e6eb0..e54bf87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
CHANGES
=======
+* move plt dir to be included in data
* refactor and add support for jinija
* just include changelog
diff --git a/README.md b/README.md
index 80bbe65..f337961 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ Strongly recommended to edit the `rss.xml` template.
Build the site with:
```sh
-pyssg -s src_dir -d dst_dir -u https://base.url -b
+pyssg -s src_dir -d dst_dir -t plt_dir -u https://base.url -b
```
That creates all `*.html` for the site and can be easily moved to the server. Here, the `-u` flag is technically optional in the sense that you'll not receive a warning/error, but it's used to prepend links with this URL (not strictly required everywhere), so don't ignore it; also don't include the trailing `/`.
diff --git a/pyssgrc b/pyssgrc
index 96e77f4..0a92b46 100644
--- a/pyssgrc
+++ b/pyssgrc
@@ -1,6 +1,6 @@
SRC_PATH=e_src
DST_PATH=e_dst
-PLT_PATH=src/pyssg/plt
+PLT_PATH=e_plt
BASE_URL=https://blog.luevano.xyz
BASE_STATIC_URL=https://static.luevano.xyz
TITLE=Luévano's Blog
diff --git a/src/pyssg/builder.py b/src/pyssg/builder.py
index 3a4474e..b6bd371 100644
--- a/src/pyssg/builder.py
+++ b/src/pyssg/builder.py
@@ -1,7 +1,6 @@
import os
import shutil
from operator import itemgetter
-from copy import deepcopy
from jinja2 import Environment, Template
from markdown import Markdown
from importlib.metadata import version
diff --git a/src/pyssg/plt/__init__.py b/src/pyssg/plt/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/pyssg/plt/__init__.py
diff --git a/src/pyssg/pyssg.py b/src/pyssg/pyssg.py
index 933f7d3..76361f5 100644
--- a/src/pyssg/pyssg.py
+++ b/src/pyssg/pyssg.py
@@ -1,10 +1,11 @@
import os
+import shutil
from argparse import ArgumentParser, Namespace
from typing import Union
from jinja2 import Environment, FileSystemLoader
from markdown import Markdown
from importlib.metadata import version
-from importlib.resources import contents
+from importlib.resources import path
from datetime import datetime, timezone
from .configuration import Configuration
@@ -117,8 +118,18 @@ def main() -> None:
except FileExistsError:
pass
- for f in contents('pyssg'):
- print(f)
+ # copy basic template files
+ files: list[str] = ('index.html',
+ 'page.html',
+ 'tag.html',
+ 'rss.xml',
+ 'sitemap.xml')
+ for f in files:
+ plt_file: str = os.path.join(config.plt, f)
+ with path('pyssg.plt', f) as p:
+ if not os.path.exists(plt_file):
+ shutil.copy(p, plt_file)
+
return
if opts['build']: