From 1f7ea6a3270bd6ec1d71c1436eee17cd6e73174e Mon Sep 17 00:00:00 2001 From: Govindas Date: Tue, 6 Sep 2022 15:05:08 +0300 Subject: [PATCH] Use :: instead of ; for navbar (less conflicts). And update readme. --- README.md | 24 ++++++++++-------------- example/navbar | 12 ++++++------ gsitegen/generate.py | 4 ++-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 48ad723..bea7297 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Generates simple webpages. # How to use -1. Create a file with `.page` extension in the same directory as `generate.py`, the file name will be title of the page, for example: About.page +1. Create a file with `.page` extension, the file name will be title of the page, for example: `About Us.page` 2. Use markdown in the created file, it will be auto-converted to HTML. You can also use raw HTML in the file, with `>` symbol, like this: ``` **Example** @@ -10,21 +10,17 @@ Generates simple webpages.

Hello world

**Back to just markdown** ``` -Line before HTML code must be a single character `>` and HTML code below must be indented by 2 spaces. You can also use Markdown inside HTML, for example: -``` -

**Hello world**

-``` -will display as bold. +Line before HTML code must be a single character `>` and HTML code below must be indented by 2 spaces. 3. (Optional) Create a file called `navbar` and/or `footer` to have a navigation bar/footer that is added to every generated page file. Example navbar file: (See example/resources/style.css for styling dropdown) ``` -Home;Home.page -About;About.page -External Site;https://example.com -Dropdown;#| - Site 1;https://example1.com - Site 2;https://example2.com - FAQ;FAQ.page +Home::Home.page +About::About.page +External Site::https://example.com +Dropdown::#| + Site 1::https://example1.com + Site 2::https://example2.com + FAQ::FAQ.page ``` It also supports HTML, but HTML code will not be formatted as navigation bar automatically. @@ -34,5 +30,5 @@ Note: folder name must be lowercase and spaces must be replaced with `-` charact 5. Run generate.py, it will generate output website files in `website-output` folder. # To-do list -- Re-think footer +- Re-think footer (it works, but I'm unsure if it is flexible enough) - Delete removed page files from website-output during next site generation (Last, to be done on release, so it doesn't disturb development) diff --git a/example/navbar b/example/navbar index 71baa1c..36614c6 100644 --- a/example/navbar +++ b/example/navbar @@ -1,6 +1,6 @@ -About;About.page -Home;Home.page -More;More.page| - About;About.page - Site 2;https://duckduckgo.com - Site 3;https://duckduckgo.com +About::About.page +Home::Home.page +More::More.page| + About::About.page + Site 2::https://duckduckgo.com + Site 3::https://duckduckgo.com diff --git a/gsitegen/generate.py b/gsitegen/generate.py index 089a9d8..6f4376e 100644 --- a/gsitegen/generate.py +++ b/gsitegen/generate.py @@ -30,8 +30,8 @@ def generateNavigationBar(lines, pagetitle): #parse navigation bar (custom format) if not rawhtml: - if ";" in line: - title, link = line.split(";", 1) + if "::" in line: + title, link = line.split("::", 1) if line.strip().endswith("|"): dropdown = True