diff --git a/README.md b/README.md index ca350dd..961a023 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ -# PicoSite \ No newline at end of file +# 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 +| |- ... +``` \ No newline at end of file diff --git a/picopage/const.py b/picopage/const.py new file mode 100644 index 0000000..ee24f00 --- /dev/null +++ b/picopage/const.py @@ -0,0 +1 @@ +DIR_PAGES = 'pages' diff --git a/picopage/main.py b/picopage/main.py new file mode 100644 index 0000000..8b298eb --- /dev/null +++ b/picopage/main.py @@ -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() diff --git a/sample-site/footer.config b/sample-site/footer.config new file mode 100644 index 0000000..e69de29 diff --git a/sample-site/navigation.config b/sample-site/navigation.config new file mode 100644 index 0000000..e69de29 diff --git a/sample-site/pages/template.md b/sample-site/pages/template.md new file mode 100644 index 0000000..0d1b3ee --- /dev/null +++ b/sample-site/pages/template.md @@ -0,0 +1,3 @@ +# This is a test page + +there will be something meaningful here in the future \ No newline at end of file diff --git a/sample-site/site.config b/sample-site/site.config new file mode 100644 index 0000000..e69de29