Add base files.

This commit is contained in:
2019-01-07 18:49:01 +01:00
parent e9c54ef696
commit 4a70d9af93
7 changed files with 67 additions and 1 deletions

View File

@@ -1 +1,31 @@
# PicoSite # PicoPage
A minimalistic Website generator.
PicoPage creates simple static websites from markdown files.
## Directory Structure
```
my_site
|- site.config (main website config)
|- navigation.config (definition of the nav bar)
|- footer.config (definition of the footer)
|- pages (holds all sites)
| |- page01.md
| |- page02.md
| |- ...
|- resources (resource files for the site)
| |- site.css
| |- site.js
| |- favicon.ico
|- static (images, documents, ...)
| |- image.png
| |- document.doc
| |- my_files
| |- file01.txt
| |- ...
|- publish (holds the compiled HTML files)
| |- index.html
| |- ...
```

1
picopage/const.py Normal file
View File

@@ -0,0 +1 @@
DIR_PAGES = 'pages'

32
picopage/main.py Normal file
View File

@@ -0,0 +1,32 @@
import argparse
import pathlib
import const
class PicoPage:
def __init__(self, base_path):
self.base_path = base_path
def read_pages(self):
pages_dir = self.base_path / const.DIR_PAGES
for file_name in pages_dir.glob('*.md'):
yield open(file_name).read()
def main(self):
print(list(self.read_pages()))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate static html pages.')
parser.add_argument(
'path',
type=pathlib.Path,
default=pathlib.Path('.'),
help='Base path of the website files.')
args = parser.parse_args()
pico = PicoPage(args.path)
pico.main()

View File

View File

View File

@@ -0,0 +1,3 @@
# This is a test page
there will be something meaningful here in the future

0
sample-site/site.config Normal file
View File