基于简单降价的低带宽静态站点生成器
Statisk的Python项目详细描述
皮斯塔茨克
KotlinStatisk项目的Python端口,设计为在低功耗设备(raspberrypizero)上运行。将降价文件转换为简单的Html格式,并为极低带宽的网页减少图像大小。在
安装
通过PIP安装:
pip install Statisk
然后运行:
stsk /path/to/blog/
如果在运行stsk
时遇到类似以下错误:
ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory
执行以下操作以修复:sudo apt-get install libopenjp2-7-dev
设置
_template.html
应该放在网站的根目录中,简单的例子:
<!DOCTYPE html><html><head><!-- Optional --><title>{{ title }}</title></head><body> {{ content }} <footer><!-- Optional --> {{ page_size }} </footer></body></html>
博客结构
降价帖子必须在根目录posts/
内的年/月/日(YYYY/MM/DD
)结构中:
样式参数
降价公告可以设置参数来覆盖图像的处理方式,并设置页面背景,这是使用降价文件顶部的隐藏注释完成的,例如:
<!--- -algorithm 5by3Bayer -threshold 100 -background #efefef -image_foreground #002233 -image_background #dedede -->
Argument | Behaviour |
---|---|
^{ | Sets dither algorithm (see below), eg. ^{ |
^{ | Set threshold of dither algorithms in range 0 to 255, eg. ^{ |
^{ | Set the foreground colour of dithered images, eg. ^{ |
^{ | Set the background colour of dithered images, eg. ^{ |
^{ | Override the page background colour, eg. ^{ |
抖动
可用抖动算法(来自DitherKt):
{2by2Bayer
,3by3Bayer
,4by4Bayer
,5by3Bayer
,5by3Bayer
,8by8Bayer
,FloydSteinberg
,FalseFloydSteinberg
,NewspaperHalftone
,JarvisJudiceNinke
,Sierra
,^{TwoRowSierra
,^{Random
还有一个greyscale
过滤器(-algorithm greyscale
),阈值被忽略。在
- 项目
标签: