Add base files.
This commit is contained in:
32
README.md
32
README.md
@@ -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
1
picopage/const.py
Normal file
@@ -0,0 +1 @@
|
||||
DIR_PAGES = 'pages'
|
||||
32
picopage/main.py
Normal file
32
picopage/main.py
Normal 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()
|
||||
0
sample-site/footer.config
Normal file
0
sample-site/footer.config
Normal file
0
sample-site/navigation.config
Normal file
0
sample-site/navigation.config
Normal file
3
sample-site/pages/template.md
Normal file
3
sample-site/pages/template.md
Normal 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
0
sample-site/site.config
Normal file
Reference in New Issue
Block a user