oxie 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oxie-0.3.1/LICENSE +201 -0
- oxie-0.3.1/PKG-INFO +228 -0
- oxie-0.3.1/README.md +200 -0
- oxie-0.3.1/oxie/__init__.py +28 -0
- oxie-0.3.1/oxie/__main__.py +7 -0
- oxie-0.3.1/oxie/cli.py +83 -0
- oxie-0.3.1/oxie/config.py +93 -0
- oxie-0.3.1/oxie/content.py +122 -0
- oxie-0.3.1/oxie/photos.py +100 -0
- oxie-0.3.1/oxie/scaffold.py +236 -0
- oxie-0.3.1/oxie/site.py +408 -0
- oxie-0.3.1/oxie/templates/default/base.html +46 -0
- oxie-0.3.1/oxie/templates/default/blog_template.html +48 -0
- oxie-0.3.1/oxie/templates/default/category_template.html +35 -0
- oxie-0.3.1/oxie/templates/default/index.html +58 -0
- oxie-0.3.1/oxie/templates/default/styles.css +20 -0
- oxie-0.3.1/oxie/templates/default/template.html +48 -0
- oxie-0.3.1/oxie/updates.py +198 -0
- oxie-0.3.1/oxie.egg-info/PKG-INFO +228 -0
- oxie-0.3.1/oxie.egg-info/SOURCES.txt +26 -0
- oxie-0.3.1/oxie.egg-info/dependency_links.txt +1 -0
- oxie-0.3.1/oxie.egg-info/entry_points.txt +2 -0
- oxie-0.3.1/oxie.egg-info/requires.txt +9 -0
- oxie-0.3.1/oxie.egg-info/top_level.txt +1 -0
- oxie-0.3.1/pyproject.toml +46 -0
- oxie-0.3.1/setup.cfg +4 -0
- oxie-0.3.1/tests/test_oxie.py +260 -0
- oxie-0.3.1/tests/test_scaffold.py +179 -0
oxie-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024-2026 Puyu Wang
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
oxie-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oxie
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: A small static site/blog generator: Markdown + Jinja2 + Tailwind
|
|
5
|
+
Author: Puyu Wang
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/PaulWang1905/oxie
|
|
8
|
+
Project-URL: Issues, https://github.com/PaulWang1905/oxie/issues
|
|
9
|
+
Keywords: static-site-generator,blog,markdown,jinja2
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
|
|
15
|
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: Jinja2>=3.1
|
|
20
|
+
Requires-Dist: Markdown>=3.6
|
|
21
|
+
Requires-Dist: pymdown-extensions>=10.0
|
|
22
|
+
Requires-Dist: python-frontmatter>=1.1
|
|
23
|
+
Requires-Dist: Pygments>=2.17
|
|
24
|
+
Requires-Dist: pillow>=10.0
|
|
25
|
+
Provides-Extra: sheets
|
|
26
|
+
Requires-Dist: pandas>=2.0; extra == "sheets"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# oxie
|
|
30
|
+
|
|
31
|
+
**oxie** is a small static site/blog generator written in Python. It converts
|
|
32
|
+
Markdown into a styled, SEO-friendly static website using Jinja2 templates and
|
|
33
|
+
**Tailwind CSS v4**.
|
|
34
|
+
|
|
35
|
+
One package, many sites: each site supplies its own content, templates and
|
|
36
|
+
`SiteConfig`, and oxie does the rest. `oxie init` gives you all three,
|
|
37
|
+
pre-wired and building.
|
|
38
|
+
|
|
39
|
+
## Requirements
|
|
40
|
+
|
|
41
|
+
- Python 3.10+ (3.8 nominally supported but untested)
|
|
42
|
+
- Node.js and npm — Tailwind CSS is a required part of the build
|
|
43
|
+
|
|
44
|
+
## Quick start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install oxie
|
|
48
|
+
|
|
49
|
+
oxie init myblog --title "My Blog" --author "Your Name"
|
|
50
|
+
cd myblog
|
|
51
|
+
npm install # Tailwind CSS v4
|
|
52
|
+
python build.py # writes docs/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Open `docs/index.html`, and you have a working blog: home page, a sample post,
|
|
56
|
+
an about page, a blog index and a category page, with compiled Tailwind
|
|
57
|
+
styling and syntax highlighting.
|
|
58
|
+
|
|
59
|
+
`oxie init` never overwrites an existing file unless you pass `--force`, so it
|
|
60
|
+
is safe to run in a directory that already has content.
|
|
61
|
+
|
|
62
|
+
## What init creates
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
source/ # content — edit this
|
|
66
|
+
index.md # home page
|
|
67
|
+
post/*.md # blog posts
|
|
68
|
+
page/*.md # standalone pages
|
|
69
|
+
image/ # images, copied to docs/image
|
|
70
|
+
static/ # raw files, copied to the site root
|
|
71
|
+
src/ # Jinja2 templates + meta_data.json + styles.css
|
|
72
|
+
base.html # shared layout the others extend
|
|
73
|
+
index.html template.html blog_template.html category_template.html
|
|
74
|
+
docs/ # generated output (GitHub Pages friendly)
|
|
75
|
+
build.py # your site's config
|
|
76
|
+
package.json # Tailwind v4 via @tailwindcss/cli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`build.py` is the whole per-site program:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from oxie import Site, SiteConfig
|
|
83
|
+
|
|
84
|
+
config = SiteConfig(
|
|
85
|
+
collect_dirs={"source/image": "docs/image", "source/static": "docs"},
|
|
86
|
+
pygments_style="github-dark",
|
|
87
|
+
css_build_command=("npm", "run", "build:css"),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
Site(config).build()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Styling
|
|
95
|
+
|
|
96
|
+
Tailwind v4 is configured **CSS-first** — there is no `tailwind.config.js` and
|
|
97
|
+
no `postcss.config.js`. Everything lives in `src/styles.css`:
|
|
98
|
+
|
|
99
|
+
```css
|
|
100
|
+
@import "tailwindcss";
|
|
101
|
+
@plugin "@tailwindcss/typography";
|
|
102
|
+
|
|
103
|
+
@source "../src/**/*.html";
|
|
104
|
+
@source "../docs/**/*.html";
|
|
105
|
+
@source "../source/**/*.md";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Because the Jinja templates in `src/` are scanned as well as the generated
|
|
109
|
+
HTML in `docs/`, classes are never purged just because CSS was built before
|
|
110
|
+
HTML. Rendered Markdown is wrapped in the typography plugin's `prose` classes,
|
|
111
|
+
and the bundled templates support light and dark via `dark:` variants.
|
|
112
|
+
|
|
113
|
+
The templates copied into `src/` are yours — edit them freely. If you delete
|
|
114
|
+
one, oxie falls back to its bundled copy, so a site always renders; set
|
|
115
|
+
`use_bundled_templates=False` to make a missing template an error instead.
|
|
116
|
+
|
|
117
|
+
## What a build does
|
|
118
|
+
|
|
119
|
+
`Site.build()` runs, in order:
|
|
120
|
+
|
|
121
|
+
1. `clean_old_files()` — removes generated HTML, the stylesheet and the image
|
|
122
|
+
directory from the output folder.
|
|
123
|
+
2. `generate_html()` — Markdown → HTML for every post and page, then
|
|
124
|
+
`posts_metadata.jsonld` (Schema.org `BlogPosting` data), the per-category
|
|
125
|
+
pages, the blog index, and the home page.
|
|
126
|
+
3. `render_simple_pages()` — any extra one-off template pages.
|
|
127
|
+
4. `render_photography_page()` — optional; parses a `photos.md` album file.
|
|
128
|
+
5. `collect_static_files()` — copies images and static files to the output.
|
|
129
|
+
6. `generate_thumbnails()` — optional; gallery thumbnails via Pillow.
|
|
130
|
+
7. `build_css()` — optional; runs your CSS command (e.g. `npm run build:css`).
|
|
131
|
+
8. `build_pygments_css()` — optional; syntax-highlighting stylesheet.
|
|
132
|
+
|
|
133
|
+
**Ordering note:** HTML is generated *before* CSS, so Tailwind sees the
|
|
134
|
+
finished HTML. The bundled `styles.css` also scans `src/` and `source/`, so
|
|
135
|
+
this ordering is belt-and-braces rather than load-bearing.
|
|
136
|
+
|
|
137
|
+
## Configuration
|
|
138
|
+
|
|
139
|
+
Every path and feature lives on `SiteConfig`:
|
|
140
|
+
|
|
141
|
+
| Field | Default | Purpose |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| `source_dir` | `source` | Markdown content root |
|
|
144
|
+
| `template_dir` | `src` | Jinja2 templates |
|
|
145
|
+
| `output_dir` | `docs` | Generated site |
|
|
146
|
+
| `meta_data_file` | `src/meta_data.json` | Site metadata (title, link, image, phrases…) |
|
|
147
|
+
| `use_bundled_templates` | `True` | Fall back to oxie's templates for anything the site omits |
|
|
148
|
+
| `markdown_extensions` / `..._configs` | pymdownx set | Markdown pipeline |
|
|
149
|
+
| `collect_dirs` | `source/image`→`docs/image`, `source/static`→`docs/page` | Static asset copying |
|
|
150
|
+
| `index_excluded_titles` | Terms of Service, Privacy Policy | Pages hidden from the index listing |
|
|
151
|
+
| `simple_pages` | `{}` | template name → output name, rendered once |
|
|
152
|
+
| `photography` / `photos_md` | `False` | Photo album page |
|
|
153
|
+
| `thumbnails` / `thumbnail_dir` / `thumbnail_width` | `False` / … / `600` | Gallery thumbnails |
|
|
154
|
+
| `css_build_command` | `("npm", "run", "build:css")` | Set to `None` to skip |
|
|
155
|
+
| `pygments_style` | `None` | e.g. `"github-dark"` |
|
|
156
|
+
|
|
157
|
+
## Content format
|
|
158
|
+
|
|
159
|
+
Posts and pages use YAML frontmatter with capitalised keys:
|
|
160
|
+
|
|
161
|
+
```markdown
|
|
162
|
+
---
|
|
163
|
+
Title: Silver Age
|
|
164
|
+
Summary: A short story about a deduplication officer.
|
|
165
|
+
Authors: Puyu Wang
|
|
166
|
+
Date: 2026-07-17
|
|
167
|
+
Category: Story
|
|
168
|
+
Tags: [Story]
|
|
169
|
+
Last_modified: 2026-07-18 # optional, defaults to Date
|
|
170
|
+
Image: image/cover.jpg # optional, defaults to meta_data["image"]
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
Your markdown here.
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`index.md` uses the Markdown `meta` extension style instead (`Key: value`
|
|
177
|
+
lines at the top of the file, no `---` fences).
|
|
178
|
+
|
|
179
|
+
Templates the generator expects in `template_dir`: `template.html` (posts and
|
|
180
|
+
pages), `index.html`, `blog_template.html`, `category_template.html`, plus any
|
|
181
|
+
you list in `simple_pages` and `photography_template.html` if enabled. `oxie
|
|
182
|
+
init` writes the first four (and a shared `base.html` they extend); the
|
|
183
|
+
generator falls back to its bundled copies for any you remove.
|
|
184
|
+
|
|
185
|
+
Context passed to each template differs — `meta_data` reaches `template.html`
|
|
186
|
+
and `index.html` but **not** `blog_template.html` or `category_template.html`,
|
|
187
|
+
which receive `title`, `phrases` and their posts. The comment at the top of
|
|
188
|
+
each bundled template lists exactly what it gets.
|
|
189
|
+
|
|
190
|
+
### Recent updates from a Google Sheet (optional)
|
|
191
|
+
|
|
192
|
+
If `meta_data.json` contains `update_spreedsheet_id`, oxie reads that public
|
|
193
|
+
spreadsheet's CSV export (columns `Date` and `Content`) and passes the five
|
|
194
|
+
most recent entries to the index template as `updates`. Omit the key and the
|
|
195
|
+
list is simply empty — no network access is attempted.
|
|
196
|
+
|
|
197
|
+
This feature requires the optional Sheets dependencies:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
pip install 'oxie[sheets]'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
uv venv && uv pip install -e '.[sheets]' --python .venv/bin/python
|
|
207
|
+
.venv/bin/python -m unittest discover -s tests -v
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The test suite runs fully offline.
|
|
211
|
+
|
|
212
|
+
## Status and known issues
|
|
213
|
+
|
|
214
|
+
Version 0.3.1, extracted from the generator behind
|
|
215
|
+
[puyuwang.org](https://puyuwang.org). Two behaviours are carried over from
|
|
216
|
+
that codebase and preserved deliberately:
|
|
217
|
+
|
|
218
|
+
- Category order on the blog index comes from iterating a Python `set`, so the
|
|
219
|
+
file's contents can differ between runs. Set `PYTHONHASHSEED=0` when
|
|
220
|
+
comparing builds.
|
|
221
|
+
- `IndexPage.parse()` overwrites `meta_data["title"]` with the title from
|
|
222
|
+
`index.md`, and indexes into the description string, which yields its first
|
|
223
|
+
character rather than the whole description.
|
|
224
|
+
|
|
225
|
+
## Licence
|
|
226
|
+
|
|
227
|
+
Apache License 2.0 — see the
|
|
228
|
+
[LICENSE](https://github.com/PaulWang1905/oxie/blob/main/LICENSE).
|
oxie-0.3.1/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# oxie
|
|
2
|
+
|
|
3
|
+
**oxie** is a small static site/blog generator written in Python. It converts
|
|
4
|
+
Markdown into a styled, SEO-friendly static website using Jinja2 templates and
|
|
5
|
+
**Tailwind CSS v4**.
|
|
6
|
+
|
|
7
|
+
One package, many sites: each site supplies its own content, templates and
|
|
8
|
+
`SiteConfig`, and oxie does the rest. `oxie init` gives you all three,
|
|
9
|
+
pre-wired and building.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Python 3.10+ (3.8 nominally supported but untested)
|
|
14
|
+
- Node.js and npm — Tailwind CSS is a required part of the build
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install oxie
|
|
20
|
+
|
|
21
|
+
oxie init myblog --title "My Blog" --author "Your Name"
|
|
22
|
+
cd myblog
|
|
23
|
+
npm install # Tailwind CSS v4
|
|
24
|
+
python build.py # writes docs/
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open `docs/index.html`, and you have a working blog: home page, a sample post,
|
|
28
|
+
an about page, a blog index and a category page, with compiled Tailwind
|
|
29
|
+
styling and syntax highlighting.
|
|
30
|
+
|
|
31
|
+
`oxie init` never overwrites an existing file unless you pass `--force`, so it
|
|
32
|
+
is safe to run in a directory that already has content.
|
|
33
|
+
|
|
34
|
+
## What init creates
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
source/ # content — edit this
|
|
38
|
+
index.md # home page
|
|
39
|
+
post/*.md # blog posts
|
|
40
|
+
page/*.md # standalone pages
|
|
41
|
+
image/ # images, copied to docs/image
|
|
42
|
+
static/ # raw files, copied to the site root
|
|
43
|
+
src/ # Jinja2 templates + meta_data.json + styles.css
|
|
44
|
+
base.html # shared layout the others extend
|
|
45
|
+
index.html template.html blog_template.html category_template.html
|
|
46
|
+
docs/ # generated output (GitHub Pages friendly)
|
|
47
|
+
build.py # your site's config
|
|
48
|
+
package.json # Tailwind v4 via @tailwindcss/cli
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`build.py` is the whole per-site program:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from oxie import Site, SiteConfig
|
|
55
|
+
|
|
56
|
+
config = SiteConfig(
|
|
57
|
+
collect_dirs={"source/image": "docs/image", "source/static": "docs"},
|
|
58
|
+
pygments_style="github-dark",
|
|
59
|
+
css_build_command=("npm", "run", "build:css"),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
Site(config).build()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Styling
|
|
67
|
+
|
|
68
|
+
Tailwind v4 is configured **CSS-first** — there is no `tailwind.config.js` and
|
|
69
|
+
no `postcss.config.js`. Everything lives in `src/styles.css`:
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
@import "tailwindcss";
|
|
73
|
+
@plugin "@tailwindcss/typography";
|
|
74
|
+
|
|
75
|
+
@source "../src/**/*.html";
|
|
76
|
+
@source "../docs/**/*.html";
|
|
77
|
+
@source "../source/**/*.md";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Because the Jinja templates in `src/` are scanned as well as the generated
|
|
81
|
+
HTML in `docs/`, classes are never purged just because CSS was built before
|
|
82
|
+
HTML. Rendered Markdown is wrapped in the typography plugin's `prose` classes,
|
|
83
|
+
and the bundled templates support light and dark via `dark:` variants.
|
|
84
|
+
|
|
85
|
+
The templates copied into `src/` are yours — edit them freely. If you delete
|
|
86
|
+
one, oxie falls back to its bundled copy, so a site always renders; set
|
|
87
|
+
`use_bundled_templates=False` to make a missing template an error instead.
|
|
88
|
+
|
|
89
|
+
## What a build does
|
|
90
|
+
|
|
91
|
+
`Site.build()` runs, in order:
|
|
92
|
+
|
|
93
|
+
1. `clean_old_files()` — removes generated HTML, the stylesheet and the image
|
|
94
|
+
directory from the output folder.
|
|
95
|
+
2. `generate_html()` — Markdown → HTML for every post and page, then
|
|
96
|
+
`posts_metadata.jsonld` (Schema.org `BlogPosting` data), the per-category
|
|
97
|
+
pages, the blog index, and the home page.
|
|
98
|
+
3. `render_simple_pages()` — any extra one-off template pages.
|
|
99
|
+
4. `render_photography_page()` — optional; parses a `photos.md` album file.
|
|
100
|
+
5. `collect_static_files()` — copies images and static files to the output.
|
|
101
|
+
6. `generate_thumbnails()` — optional; gallery thumbnails via Pillow.
|
|
102
|
+
7. `build_css()` — optional; runs your CSS command (e.g. `npm run build:css`).
|
|
103
|
+
8. `build_pygments_css()` — optional; syntax-highlighting stylesheet.
|
|
104
|
+
|
|
105
|
+
**Ordering note:** HTML is generated *before* CSS, so Tailwind sees the
|
|
106
|
+
finished HTML. The bundled `styles.css` also scans `src/` and `source/`, so
|
|
107
|
+
this ordering is belt-and-braces rather than load-bearing.
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
Every path and feature lives on `SiteConfig`:
|
|
112
|
+
|
|
113
|
+
| Field | Default | Purpose |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `source_dir` | `source` | Markdown content root |
|
|
116
|
+
| `template_dir` | `src` | Jinja2 templates |
|
|
117
|
+
| `output_dir` | `docs` | Generated site |
|
|
118
|
+
| `meta_data_file` | `src/meta_data.json` | Site metadata (title, link, image, phrases…) |
|
|
119
|
+
| `use_bundled_templates` | `True` | Fall back to oxie's templates for anything the site omits |
|
|
120
|
+
| `markdown_extensions` / `..._configs` | pymdownx set | Markdown pipeline |
|
|
121
|
+
| `collect_dirs` | `source/image`→`docs/image`, `source/static`→`docs/page` | Static asset copying |
|
|
122
|
+
| `index_excluded_titles` | Terms of Service, Privacy Policy | Pages hidden from the index listing |
|
|
123
|
+
| `simple_pages` | `{}` | template name → output name, rendered once |
|
|
124
|
+
| `photography` / `photos_md` | `False` | Photo album page |
|
|
125
|
+
| `thumbnails` / `thumbnail_dir` / `thumbnail_width` | `False` / … / `600` | Gallery thumbnails |
|
|
126
|
+
| `css_build_command` | `("npm", "run", "build:css")` | Set to `None` to skip |
|
|
127
|
+
| `pygments_style` | `None` | e.g. `"github-dark"` |
|
|
128
|
+
|
|
129
|
+
## Content format
|
|
130
|
+
|
|
131
|
+
Posts and pages use YAML frontmatter with capitalised keys:
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
---
|
|
135
|
+
Title: Silver Age
|
|
136
|
+
Summary: A short story about a deduplication officer.
|
|
137
|
+
Authors: Puyu Wang
|
|
138
|
+
Date: 2026-07-17
|
|
139
|
+
Category: Story
|
|
140
|
+
Tags: [Story]
|
|
141
|
+
Last_modified: 2026-07-18 # optional, defaults to Date
|
|
142
|
+
Image: image/cover.jpg # optional, defaults to meta_data["image"]
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
Your markdown here.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`index.md` uses the Markdown `meta` extension style instead (`Key: value`
|
|
149
|
+
lines at the top of the file, no `---` fences).
|
|
150
|
+
|
|
151
|
+
Templates the generator expects in `template_dir`: `template.html` (posts and
|
|
152
|
+
pages), `index.html`, `blog_template.html`, `category_template.html`, plus any
|
|
153
|
+
you list in `simple_pages` and `photography_template.html` if enabled. `oxie
|
|
154
|
+
init` writes the first four (and a shared `base.html` they extend); the
|
|
155
|
+
generator falls back to its bundled copies for any you remove.
|
|
156
|
+
|
|
157
|
+
Context passed to each template differs — `meta_data` reaches `template.html`
|
|
158
|
+
and `index.html` but **not** `blog_template.html` or `category_template.html`,
|
|
159
|
+
which receive `title`, `phrases` and their posts. The comment at the top of
|
|
160
|
+
each bundled template lists exactly what it gets.
|
|
161
|
+
|
|
162
|
+
### Recent updates from a Google Sheet (optional)
|
|
163
|
+
|
|
164
|
+
If `meta_data.json` contains `update_spreedsheet_id`, oxie reads that public
|
|
165
|
+
spreadsheet's CSV export (columns `Date` and `Content`) and passes the five
|
|
166
|
+
most recent entries to the index template as `updates`. Omit the key and the
|
|
167
|
+
list is simply empty — no network access is attempted.
|
|
168
|
+
|
|
169
|
+
This feature requires the optional Sheets dependencies:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
pip install 'oxie[sheets]'
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
uv venv && uv pip install -e '.[sheets]' --python .venv/bin/python
|
|
179
|
+
.venv/bin/python -m unittest discover -s tests -v
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The test suite runs fully offline.
|
|
183
|
+
|
|
184
|
+
## Status and known issues
|
|
185
|
+
|
|
186
|
+
Version 0.3.1, extracted from the generator behind
|
|
187
|
+
[puyuwang.org](https://puyuwang.org). Two behaviours are carried over from
|
|
188
|
+
that codebase and preserved deliberately:
|
|
189
|
+
|
|
190
|
+
- Category order on the blog index comes from iterating a Python `set`, so the
|
|
191
|
+
file's contents can differ between runs. Set `PYTHONHASHSEED=0` when
|
|
192
|
+
comparing builds.
|
|
193
|
+
- `IndexPage.parse()` overwrites `meta_data["title"]` with the title from
|
|
194
|
+
`index.md`, and indexes into the description string, which yields its first
|
|
195
|
+
character rather than the whole description.
|
|
196
|
+
|
|
197
|
+
## Licence
|
|
198
|
+
|
|
199
|
+
Apache License 2.0 — see the
|
|
200
|
+
[LICENSE](https://github.com/PaulWang1905/oxie/blob/main/LICENSE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'''
|
|
2
|
+
oxie — a small static site/blog generator.
|
|
3
|
+
|
|
4
|
+
Converts Markdown content into a styled, SEO-friendly static website
|
|
5
|
+
using Jinja2 templates. A site is described by a SiteConfig (paths and
|
|
6
|
+
optional features) and built by a Site:
|
|
7
|
+
|
|
8
|
+
from oxie import Site, SiteConfig
|
|
9
|
+
|
|
10
|
+
Site(SiteConfig()).build()
|
|
11
|
+
|
|
12
|
+
To start a new site from scratch, use the command line instead:
|
|
13
|
+
|
|
14
|
+
oxie init myblog --title "My Blog"
|
|
15
|
+
'''
|
|
16
|
+
from .config import SiteConfig
|
|
17
|
+
from .content import Post, Category
|
|
18
|
+
from .scaffold import init_site
|
|
19
|
+
from .site import Site, BlogIndex, IndexPage, generate_posts_jsonld
|
|
20
|
+
from .updates import Update, UpdateReader
|
|
21
|
+
|
|
22
|
+
__version__ = "0.3.1"
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"Site", "SiteConfig", "Post", "Category", "BlogIndex", "IndexPage",
|
|
26
|
+
"generate_posts_jsonld", "init_site", "Update", "UpdateReader",
|
|
27
|
+
"__version__",
|
|
28
|
+
]
|