Commit 513c781e authored by Marien Fressinaud's avatar Marien Fressinaud

Rename content folder into articles

parent d1587e9e
......@@ -62,15 +62,15 @@ $ mkdir theme
$ echo '<html><body>{{ ARTICLE_CONTENT }}</body></html' > theme/article.html
```
Then, you can create a Markdown file under a `./content` folder:
Then, you can create a Markdown file under a `./articles` folder:
```console
$ mkdir content
$ echo '# My first article' > content/my-article.md
$ mkdir articles
$ echo '# My first article' > articles/my-article.md
$ boop.py
$ tree
.
├── content
├── articles
│   └── my-article.md
├── site
│   ├── index.html
......@@ -137,7 +137,7 @@ copied under the `./site` folder:
```console
$ tree
.
├── content
├── articles
│   └── my-article.md
├── site
│   ├── index.html
......@@ -150,7 +150,7 @@ $ tree
└── index.html
```
Other files under `./content` are also copied to the `./site` folder.
Other files under `./articles` are also copied to the `./site` folder.
## Tests
......
......@@ -86,18 +86,18 @@ def main():
if os.path.isdir(static_dirpath):
distutils.dir_util.copy_tree(static_dirpath, output_path)
# Check that content directory exists on the filesystem
content_path = os.path.join(os.curdir, "content")
if not os.path.isdir(content_path):
# Check that articles directory exists on the filesystem
articles_path = os.path.join(os.curdir, "articles")
if not os.path.isdir(articles_path):
# If not, just stop here
return
md = markdown.Markdown(extensions=["meta", "fenced_code", "attr_list"])
# And copy the files from ./content to ./site
for filepath in dir_tree(content_path):
# And copy the files from ./articles to ./site
for filepath in dir_tree(articles_path):
base, ext = os.path.splitext(filepath)
content_filepath = os.path.join(content_path, filepath)
content_filepath = os.path.join(articles_path, filepath)
output_filepath = os.path.join(output_path, filepath)
if ext == ".md":
output_filepath = os.path.join(output_path, f"{base}.html")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment