-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
executable file
·175 lines (152 loc) · 4.72 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#! /usr/bin/env python3
import base64
import zlib
import pymdownx.superfences
# PORT = 8080
# BIND = "192.168.1.158"
# SITEURL = f"http://{BIND}:{PORT}"
AUTHOR = "dragoncoder047"
SITENAME = "Armdroid 1000"
SITEURL = "https://dragoncoder047.github.io/armdroid"
LOGO = "/armdroid/armdroid.png"
LOGO_AREA_HTML = ('<a href="/armdroid">'
'<div class="flex-row">'
f'<img src="{LOGO}" width="145" height="115" />'
'<div id="sitename-text" class="flex-column">'
f'<h1>{SITENAME}</h1><!-- h2>SITESUBTITLE</h2 -->'
f'</div></div></a>')
ICON = "/armdroid/armdroid_sm.png"
ICON_MIMETYPE = "image/png"
THEME_CSS_FILE = "/armdroid/theme.css"
THEME_MAIN_CSS = "/static/css/main.css"
EXTRA_JS = ("/static/misc.js", "/armdroid/badlink_detector.js")
THEME_STATIC_DIR = "static/"
USE_FOLDER_AS_CATEGORY = False
GOOGLE_TAG = "G-XR0F89CCGK" # cSpell: ignore ccgk
PATH = "markdown/"
OUTPUT_PATH = "docs/"
TIMEZONE = "America/New_York"
DEFAULT_LANG = "en_US"
# maybe later...
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
SEO_REPORT = True
DISPLAY_PAGES_ON_MENU = True
DISPLAY_CATEGORIES_ON_MENU = False
AUTHOR_SAVE_AS = AUTHORS_SAVE_AS = ""
TAG_SAVE_AS = TAGS_SAVE_AS = ""
CATEGORY_SAVE_AS = CATEGORIES_SAVE_AS = ""
USE_CATEGORIES = False
ARTICLE_URL = "updates/{date:%Y}/{slug}"
ARTICLE_SAVE_AS = ARTICLE_URL + "/index.html"
ARCHIVES_URL = "updates/"
ARCHIVES_SAVE_AS = "updates/index.html"
PATH_METADATA = r"(?P<path_no_ext>.*)\.[^.]*"
PAGE_SAVE_AS = "{path_no_ext}/index.html"
PAGE_URL = "{path_no_ext}"
FILENAME_METADATA = ""
# Blogroll
LINKS = (
("Armdroid 1000 site", "https://armdroid1000.wordpress.com"),
("Dan Kohn's LabVolt 5100",
"http://www.dankohn.info/projects/armdroid.html"),
("Richard Morris' Armdroid 1", "https://armdroid1.blogspot.com/"),
("Alex Zivanovic's Armdroid 1",
"http://www.senster.com/alex_zivanovic/armdroid/index.htm"),
)
# Social
SOCIAL = (
(f"{AUTHOR} on GitHub", f"https://github.com/{AUTHOR}"),
(f"{AUTHOR} on YouTube", f"https://youtube.com/@{AUTHOR}"),
)
MENUITEMS = (
("Site root", "/"),
("Updates", f"/armdroid/{ARCHIVES_URL}"),
)
DEFAULT_PAGINATION = 10
DEFAULT_ORPHANS = 3
PAGINATION_PATTERNS = (
(1, "{url}", "{save_as}"),
(2, "{base_name}/page{number}", "{base_name}/page{number}/index.html"),
)
PAGE_PATHS = ["info/"]
ARTICLE_PATHS = ["updates/"]
STATIC_PATHS = [] # everything is attached
THEME = "./pelicantheme"
RELATIVE_URLS = False
READERS = {"html": None}
def kroki_fence(source, language, css_class, options, md, **kwargs):
data = base64.urlsafe_b64encode(zlib.compress(
source.encode("utf-8"), 9)).decode("ascii")
lang = options.get("type", options.get("name", "svgbob"))
attr = ""
if "width" in options and "height" in options:
attr = f' width="{options["width"]}" height="{options["height"]}"'
return f'<img src="https://kroki.io/{lang}/svg/{data}"{attr} />'
MARKDOWN = {
"extension_configs": {
"meta": {},
"pymdownx.extra": {},
"pymdownx.caret": {},
"pymdownx.details": {},
"pymdownx.highlight": {
"use_pygments": False, # I use Prism.js
},
"pymdownx.inlinehilite": {},
"pymdownx.superfences": {
"custom_fences": [
{
"name": "mermaid",
"class": "mermaid",
"format": pymdownx.superfences.fence_div_format
},
# covered by kroki, but needed for compatibility
# with github
{
"name": "kroki",
"class": "kroki",
"format": kroki_fence
}
]
},
"pymdownx.saneheaders": {},
"pymdownx.magiclink": {},
"pymdownx.smartsymbols": {},
"smarty": {},
"pymdownx.tabbed": {},
"pymdownx.tasklist": {},
"pymdownx.tilde": {},
"sane_lists": {},
"admonition": {},
"abbr": {},
"def_list": {},
"toc": {},
"footnotes": {},
"attr_list": {},
"markdown_figcap": {},
"python_markdown_comments:CommentsExtension": {},
},
"output_format": "html5",
}
PLUGINS = [
# "seo",
"pelican.plugins.share_post",
# "sitemap",
"pelican.plugins.related_posts",
"minchin.pelican.plugins.nojekyll",
"pelican.plugins.read_more",
"jinja2content",
"series",
]
if __name__ == "__main__":
import os
import shlex
os.system(f"""pelican {
shlex.quote(PATH)
} -o {
shlex.quote(OUTPUT_PATH)
} -s {
shlex.quote(__file__)}""")