This commit is contained in:
octospacc 2022-08-30 00:17:05 +02:00
parent 8e8c66009e
commit b841deafc6
3 changed files with 92 additions and 19 deletions

33
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Build and Deploy with staticoso
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
page_build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y python3.10 curl git
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.10
sudo pip3 install lxml
git clone --depth 1 https://gitlab.com/octtspacc/staticoso
python3.10 ./staticoso/Source/Build.py
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public

View File

@ -1,14 +1,14 @@
image: alpine:latest image: alpine:latest
before_script: before_script: |
- apk update apk update
- apk add python3 git apk add python3 git
pages: pages:
stage: deploy stage: deploy
script: script: |
- git clone --depth 1 https://gitlab.com/octtspacc/staticoso git clone --depth 1 https://gitlab.com/octtspacc/staticoso
- python3 ./staticoso/Source/Build.py python3 ./staticoso/Source/Build.py
artifacts: artifacts:
paths: paths:
- public - public

View File

@ -43,7 +43,7 @@ A **full** staticoso site folder looks like this:
Keep in mind that the only required files (and, consequently, appropriate folders) for a minimum successful build are at least: one HTML base template, and one page or post. Other elements are optional. Keep in mind that the only required files (and, consequently, appropriate folders) for a minimum successful build are at least: one HTML base template, and one page or post. Other elements are optional.
A reasonably **minimal** staticoso site folder tree can look like this: A reasonably **minimal** staticoso site folder tree can look like this:
``` <pre><code>
. .
├── Assets ├── Assets
│   ├── Default.css │   ├── Default.css
@ -54,17 +54,35 @@ A reasonably **minimal** staticoso site folder tree can look like this:
│   └── index.md │   └── index.md
└── Posts └── Posts
└── 2022-05-16-That-Day.md └── 2022-05-16-That-Day.md
``` </code></pre>
## Internal Markup Tags ## Preprocessor Flags
staticoso uses a simple internal markup language that's the essence of its template system. Preprocessor flags can be included in single-line comments.
They must be prepended by a `%` (percent sign) character, and values are assigned with the [standard Python INI syntax](https://docs.python.org/3/library/configparser.html#supported-ini-file-structure).
Tags are enclosed in square brackets (with colons as token separators), and declared with the form `[staticoso:Name:Values]`. _Note: **Markdown** doesn't officially support comments. staticoso thus uses its own syntax: a line starting with `//` (2 slashes) indicates a comment._
For some tags, there are no values to be specified, so the last part can be omitted. Starting the declaration with `staticoso` is always required.
You can use the following tags in your templates or pages, to let everything work as you want. Some are obviously needed for compiling minimum viable pages, like the one for displaying content. For example:
`// % Flag = Value`
Supported values:
- `Template`
- `Style`
- `Type`
- `Index`
- `Feed`
- `Title`
- `HTMLTitle`
- `Description`
- `Image`
- `Macros`
- `Categories`
- `CreatedOn`
- `EditedOn`
- `Order`
TODO: Finish writing this TODO: Finish writing this
@ -84,23 +102,32 @@ _Note: Some flags are currently CLI-only, while others are file-only. This will
### Site ### Site
- `Name` (`--SiteName`): The name of your site. - `Name` (`--SiteName`): The name of your site.
- `BlogName` (`--BlogName`): The name of the blog section of your site. Can be omitted, and the site name will be used instead.
- `Tagline` (`--SiteTagline`): The tagline or motto of your site.
### Minify
- `Minify` (`--Minify`): Whether or not to minify the output HTML. Defaults to `False`.
- `KeepComments` (`--MinifyKeepComments`): Optionally keeping comments in minified HTML, instead of removing them. Defaults to `False`.
### Categories
- `Automatic` (`--CategoriesAutomatic`): Whether or not to automatically create pages in the `Categories/` directory of your site. Defaults to `False`.
- `Uncategorized` (`--CategoriesUncategorized`): Enabling a custom name for the automatically managed "Uncategorized" category. Defaults to `Uncategorized`.
--- ---
TODO: Correctly categorize all the below flags TODO: Correctly categorize all the below flags
- `BlogName`: The name of the blog section of your site.
- `SiteTagline`: The tagline or motto of your site.
- `SiteRoot`: The root path of your site on your server. Useful if you keep many sites on the same domain/address. Defaults to `/`. - `SiteRoot`: The root path of your site on your server. Useful if you keep many sites on the same domain/address. Defaults to `/`.
- `SiteDomain`: Domain of your website, for use for feeds and sitemaps. - `SiteDomain`: Domain of your website, for use for feeds and sitemaps.
- `SiteLang`: The language of your site. Will be used for choosing certain strings. Defaults to `en`. - `SiteLang`: The language of your site. Will be used for choosing certain strings. Defaults to `en`.
- `SiteTemplate`: Name of the template file to use for the site. Defaults to `Default.html`. - `SiteTemplate`: Name of the template file to use for the site. Defaults to `Default.html`.
- `Minify`: Whether or not to minify the output HTML. Defaults to `False`.
- `NoScripts`: Whether or not to strip out `<script>` tags from the output HTML. Defaults to `False`. - `NoScripts`: Whether or not to strip out `<script>` tags from the output HTML. Defaults to `False`.
- `Sorting`: Set sorting styles for pages and posts lists. - `Sorting`: Set sorting styles for pages and posts lists.
- `GemtextOut`: Whether or not to output a Gemtext conversion of the site. Requires [html2gmi](https://github.com/LukeEmmet/html2gmi) to be present in system `$PATH`. Defaults to `False`. - `GemtextOutput`: Whether or not to output a Gemtext conversion of the site. Requires [html2gmi](https://github.com/LukeEmmet/html2gmi) to be present in system `$PATH`. Defaults to `False`.
- `GemtextHeader`: A string to optionally include at the top of every Gemtext file. - `GemtextHeader`: A string to optionally include at the top of every Gemtext file.
- `SitemapOut`: Whether or not to create sitemap files. Defaults to `True`. - `SitemapOutput`: Whether or not to create sitemap files. Defaults to `True`.
- `FeedEntries`: Max number of pages to include in feed files. A value of `0` disables feed generation, while `-1` equals no limit. Defaults to `10`. - `FeedEntries`: Max number of pages to include in feed files. A value of `0` disables feed generation, while `-1` equals no limit. Defaults to `10`.
- `DynamicParts`: Assign any desired HTML files (from the ones stored in the `DynamicParts/` directory) to the relative section in your base HTML. - `DynamicParts`: Assign any desired HTML files (from the ones stored in the `DynamicParts/` directory) to the relative section in your base HTML.
- `MarkdownExts`: Specify a custom list of extensions to use when parsing Markdown. - `MarkdownExts`: Specify a custom list of extensions to use when parsing Markdown.
@ -108,5 +135,18 @@ TODO: Correctly categorize all the below flags
- `MastodonToken`: Application token of a Mastodon account to use for notifying of new posts and creating comment links. Leave blank to disable Mastodon. - `MastodonToken`: Application token of a Mastodon account to use for notifying of new posts and creating comment links. Leave blank to disable Mastodon.
- `FeedCategoryFilter`: List of post categories to include in the site main feed. Defaults to only `['Blog']`. - `FeedCategoryFilter`: List of post categories to include in the site main feed. Defaults to only `['Blog']`.
- `ActivityPubHoursLimit`: Maximum time limit (in hours) for sharing any newly-created post via ActivityPub; posts older than that amount won't get shared. Defaults to `168` (1 week). - `ActivityPubHoursLimit`: Maximum time limit (in hours) for sharing any newly-created post via ActivityPub; posts older than that amount won't get shared. Defaults to `168` (1 week).
- `AutoCategories`: Whether or not to automatically create pages in the `Categories/` directory of your site. Defaults to `False`.
- `OutputDir`: Specifies a custom output path for the compiled website's files. Defaults to `./public/`. - `OutputDir`: Specifies a custom output path for the compiled website's files. Defaults to `./public/`.
## Internal Markup Tags
_Note: You only really need to care about this section if you're developing themes. If you are building your site with an already prepared theme, then you can do without this information._
staticoso uses a simple internal markup language that's the essence of its template system.
Tags are enclosed in square brackets (with colons as token separators), and declared with the form `[staticoso:Name:Values]`.
For some tags, there are no values to be specified, so the last part can be omitted. Starting the declaration with `staticoso` is always required.
You can use the following tags in your templates or pages, to let everything work as you want. Some are obviously needed for compiling minimum viable pages, like the one for displaying content.
TODO: Finish writing this