Skip to content

Commit 61a3b3c

Browse files
new theme under construction + analytics
1 parent 53646b0 commit 61a3b3c

33 files changed

+377
-1976
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
"DEFUN",
55
"howto",
66
"INCATCH",
7+
"inlinehilite",
8+
"kroki",
79
"longjmp",
10+
"nojekyll",
11+
"prismjs",
812
"progn",
913
"PSTAR",
1014
"PSTR",
15+
"pymdownx",
16+
"rsquo",
1117
"setjmp",
1218
"STRINGFN",
19+
"svgbob",
1320
"tstflag",
1421
"ulisp"
1522
]

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build clean deps
1+
.PHONY: build clean deps testserve
22

33
build: clean
44
./build.py
@@ -9,3 +9,7 @@ clean:
99

1010
deps:
1111
sudo python3 -m pip install -r requirements.txt
12+
13+
testserve:
14+
python3 -m http.server 8888 -b localhost -d docs &
15+
open http://localhost:8888

build.py

Lines changed: 116 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,36 @@
22
import base64
33
import zlib
44

5-
PORT = 8080
6-
BIND = '192.168.1.158'
7-
SITEURL = f'http://{BIND}:{PORT}'
8-
9-
AUTHOR = 'dragoncoder047'
10-
SITENAME = 'dragoncoder047’s site'
11-
SITESUBTITLE = 'projects, ideas, and everything else'
12-
SITEURL = 'https://dragoncoder047.github.io'
13-
LOGO = '/images/patrick.svg'
14-
LOGO_AREA_HTML = f'<a href="/" class="flex-row"><div class="flex-row"><img src="{
15-
LOGO}" width="141" alt="Patrick the purple dragon" height="85" /><div id="sitename-text"><h1>{SITENAME}</h1><h2>{SITESUBTITLE}</h2></div></div></a>'
16-
ICON = '/images/patrick_head_silhouette.svg'
17-
ICON_MIMETYPE = 'image/svg+xml'
18-
THEME_CSS_FILE = '/static/css/theme.css'
19-
THEME_MAIN_CSS = '/static/css/main.css'
20-
EXTRA_JS = '/static/misc.js'
21-
THEME_STATIC_DIR = 'static/'
5+
# PORT = 8080
6+
# BIND = "192.168.1.158"
7+
# SITEURL = f"http://{BIND}:{PORT}"
8+
9+
AUTHOR = "dragoncoder047"
10+
SITENAME = "dragoncoder047&rsquo;s site"
11+
SITESUBTITLE = "projects, ideas, and everything else"
12+
SITEURL = "https://dragoncoder047.github.io"
13+
LOGO = "/images/foo.svg"
14+
LOGO_AREA_HTML = ('<a href="/" class="flex-row"><div class="flex-row">'
15+
f'<img src="{LOGO}" alt="under construction..."/>'
16+
'<div id="sitename-text">'
17+
f'<h1>{SITENAME}</h1><h2>{SITESUBTITLE}</h2>'
18+
'</div></div></a>')
19+
ICON = "/images/foo.svg"
20+
ICON_MIMETYPE = "image/svg+xml"
21+
THEME_CSS_FILE = "/static/css/theme.css"
22+
THEME_MAIN_CSS = "/static/css/main.css"
23+
EXTRA_JS = "/static/misc.js"
24+
THEME_STATIC_DIR = "static/"
2225
USE_FOLDER_AS_CATEGORY = False
2326

24-
PATH = 'markdown/'
25-
OUTPUT_PATH = 'docs/'
27+
GOOGLE_TAG = "G-XR0F89CCGK" # cSpell: ignore ccgk
2628

27-
TIMEZONE = 'America/New_York'
29+
PATH = "markdown/"
30+
OUTPUT_PATH = "docs/"
2831

29-
DEFAULT_LANG = 'en_US'
32+
TIMEZONE = "America/New_York"
33+
34+
DEFAULT_LANG = "en_US"
3035

3136
# maybe later...
3237
FEED_ALL_ATOM = None
@@ -38,150 +43,159 @@
3843
SEO_REPORT = True
3944

4045
DISPLAY_PAGES_ON_MENU = DISPLAY_CATEGORIES_ON_MENU = False
41-
AUTHOR_SAVE_AS = AUTHORS_SAVE_AS = TAG_SAVE_AS = TAGS_SAVE_AS = CATEGORY_SAVE_AS = CATEGORIES_SAVE_AS = ARCHIVES_SAVE_AS = ''
42-
FILENAME_METADATA = r'(?P<slug>.*)'
46+
AUTHOR_SAVE_AS = AUTHORS_SAVE_AS = TAG_SAVE_AS = TAGS_SAVE_AS = ""
47+
CATEGORY_SAVE_AS = CATEGORIES_SAVE_AS = ARCHIVES_SAVE_AS = ""
48+
FILENAME_METADATA = r"(?P<slug>.*)"
4349

4450
# Blogroll
4551
LINKS = (
46-
('Conwaylife', 'https://www.conwaylife.com/'),
47-
('Python', 'https://www.python.org/'),
52+
("Conwaylife", "https://www.conwaylife.com/"),
53+
("Python", "https://www.python.org/"),
4854
)
4955

5056
# Social
5157
SOCIAL = (
52-
(f'{AUTHOR} on GitHub', f'https://github.com/{AUTHOR}'),
53-
(f'{AUTHOR} on YouTube', f'https://youtube.com/@{AUTHOR}'),
58+
(f"{AUTHOR} on GitHub", f"https://github.com/{AUTHOR}"),
59+
(f"{AUTHOR} on YouTube", f"https://youtube.com/@{AUTHOR}"),
5460
)
5561

5662
MENUITEMS = (
57-
# ('Archives', f'/archives.html'),
58-
('Blog', '/blog'),
59-
('Projects', '#', (
60-
('Thuepaste', f'https://{AUTHOR}.github.io/thuepaste'),
61-
('Armdroid', f'https://{AUTHOR}.github.io/armdroid'),
62-
('Langton\'s Ant Music', f'https://{AUTHOR}.github.io/langton-music'),
63-
('Schemascii', f'https://{AUTHOR}.github.io/schemascii'),
64-
('Parasite', f'https://{AUTHOR}.github.io/parasite'),
63+
# ("Archives", f"/archives.html"),
64+
("Blog", "/blog"),
65+
("Projects", "#", (
66+
("Thuepaste", f"https://{AUTHOR}.github.io/thuepaste"),
67+
("Armdroid", f"https://{AUTHOR}.github.io/armdroid"),
68+
("Langton&rsquo;s Ant Music",
69+
f"https://{AUTHOR}.github.io/langton-music"),
70+
("Schemascii", f"https://{AUTHOR}.github.io/schemascii"),
71+
("Parasite", f"https://{AUTHOR}.github.io/parasite"),
6572
)),
66-
('uLisp Extensions', f'{SITEURL}/pages/ulisp_howto.html'),
73+
("uLisp Extensions", f"{SITEURL}/pages/ulisp_howto.html"),
6774
)
6875

6976
DEFAULT_PAGINATION = 10
7077
DEFAULT_ORPHANS = 3
7178
PAGINATION_PATTERNS = (
72-
(1, '{name}{extension}', '{name}{extension}'),
73-
(2, '{name}_{number}{extension}', '{name}_{number}{extension}'),
79+
(1, "{name}{extension}", "{name}{extension}"),
80+
(2, "{name}_{number}{extension}", "{name}_{number}{extension}"),
7481
)
7582

76-
PATH_METADATA = r'(?P<path_no_ext>.*)\.[^.]*'
77-
ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = '{path_no_ext}.html'
83+
PATH_METADATA = r"(?P<path_no_ext>.*)\.[^.]*"
84+
ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = "{path_no_ext}.html"
7885

79-
THEME = './pelicantheme'
86+
THEME = "./pelicantheme"
8087

8188
RELATIVE_URLS = False
8289

83-
READERS = {'html': None}
90+
READERS = {"html": None}
8491

8592

8693
def lv_fence(source, language, css_class, options, md, **kwargs):
87-
return f'<div class="lifeviewer"><textarea>{source}</textarea><canvas height="{options.get("height", 400)}" width="{options.get("width", 600)}"></canvas></div>'
94+
return (f'<div class="lifeviewer"><textarea>{source}</textarea>'
95+
f'<canvas height="{options.get("height", 400)}" '
96+
f'width="{options.get("width", 600)}"></canvas></div>')
8897

8998

9099
def kroki_fence(source, language, css_class, options, md, **kwargs):
91100
data = base64.urlsafe_b64encode(zlib.compress(
92-
source.encode('utf-8'), 9)).decode('ascii')
93-
lang = options.get('type', options.get('name', 'svgbob'))
94-
attr = ''
95-
if 'width' in options and 'height' in options:
101+
source.encode("utf-8"), 9)).decode("ascii")
102+
lang = options.get("type", options.get("name", "svgbob"))
103+
attr = ""
104+
if "width" in options and "height" in options:
96105
attr = f' width="{options["width"]}" height="{options["height"]}"'
97106
return f'<img src="https://kroki.io/{lang}/svg/{data}"{attr} />'
98107

99108

100109
def named_kroki(name):
101110
def named_fence(source, language, css_class, options, md, **kwargs):
102-
return kroki_fence(source, language, css_class, options | {'type': name}, md, **kwargs)
103-
return {'name': name, 'class': name, 'format': named_fence}
111+
return kroki_fence(source, language, css_class,
112+
options | {"type": name}, md, **kwargs)
113+
return {"name": name, "class": name, "format": named_fence}
104114

105115

106116
def circuit_fence(source, language, css_class, options, md, **kwargs):
107117
return '<span style="color: red; background: yellow;">TODO</span>'
108118

109119

110120
def default_fence(source, language, css_class, options, md, **kwargs):
111-
"this is needed because the default superfences block puts the language class on the code element and breaks prismjs"
112-
source = source.replace('&', '&amp;').replace(
113-
'<', '&lt;').replace('>', '&gt;')
114-
classes = kwargs.get('classes', [])
115-
attrs = kwargs.get('attrs', {})
116-
other_attrs = ''.join(map(lambda x: f' {x[0]}=\"{x[1]}\"', attrs.items()))
121+
"""this is needed because the default superfences block puts the
122+
language class on the code element and breaks prismjs
123+
"""
124+
source = source.replace("&", "&amp;").replace(
125+
"<", "&lt;").replace(">", "&gt;")
126+
classes = kwargs.get("classes", [])
127+
attrs = kwargs.get("attrs", {})
128+
other_attrs = "".join(map(lambda x: f' {x[0]}=\"{x[1]}\"', attrs.items()))
117129
classes.append("highlight")
118130
classes.append("language-" + language)
119-
return f"<pre class=\"{' '.join(classes)}\"{other_attrs}><code>{source}</code></pre>"
131+
return f"<pre class=\"{" ".join(classes)}\"{other_attrs}><code>{
132+
source}</code></pre>"
120133

121134

122135
MARKDOWN = {
123-
'extension_configs': {
124-
'meta': {},
125-
'pymdownx.extra': {},
126-
'pymdownx.caret': {},
127-
'pymdownx.details': {},
128-
'pymdownx.highlight': {
129-
'use_pygments': False, # I use Prism.js
136+
"extension_configs": {
137+
"meta": {},
138+
"pymdownx.extra": {},
139+
"pymdownx.caret": {},
140+
"pymdownx.details": {},
141+
"pymdownx.highlight": {
142+
"use_pygments": False, # I use Prism.js
130143
},
131-
'pymdownx.inlinehilite': {},
144+
"pymdownx.inlinehilite": {},
132145
"pymdownx.superfences": {
133146
"custom_fences": [
134147
# covered by kroki, but needed for compatibility with github
135-
named_kroki('mermaid'),
136-
named_kroki('svgbob'),
148+
named_kroki("mermaid"),
149+
named_kroki("svgbob"),
137150
{
138-
'name': 'lifeviewer',
139-
'class': 'lifeviewer',
140-
'format': lv_fence
151+
"name": "lifeviewer",
152+
"class": "lifeviewer",
153+
"format": lv_fence
141154
},
142155
{
143-
'name': 'kroki',
144-
'class': 'kroki',
145-
'format': kroki_fence
156+
"name": "kroki",
157+
"class": "kroki",
158+
"format": kroki_fence
146159
},
147160
{
148-
'name': '*',
149-
'format': default_fence,
150-
'class': 'foo' # need something here or it doesn't work
161+
"name": "*",
162+
"format": default_fence,
163+
"class": "foo" # need something here or it doesn't work
151164
}
152165
]
153166
},
154-
'pymdownx.saneheaders': {},
155-
'pymdownx.magiclink': {},
156-
'pymdownx.smartsymbols': {},
157-
'smarty': {},
158-
'pymdownx.tabbed': {},
159-
'pymdownx.tasklist': {},
160-
'pymdownx.tilde': {},
161-
'sane_lists': {},
162-
'admonition': {},
163-
'abbr': {},
164-
'def_list': {},
165-
'toc': {},
166-
'footnotes': {},
167-
'attr_list': {},
168-
'markdown_figcap': {},
169-
'python_markdown_comments:CommentsExtension': {},
167+
"pymdownx.saneheaders": {},
168+
"pymdownx.magiclink": {},
169+
"pymdownx.smartsymbols": {},
170+
"smarty": {},
171+
"pymdownx.tabbed": {},
172+
"pymdownx.tasklist": {},
173+
"pymdownx.tilde": {},
174+
"sane_lists": {},
175+
"admonition": {},
176+
"abbr": {},
177+
"def_list": {},
178+
"toc": {},
179+
"footnotes": {},
180+
"attr_list": {},
181+
"markdown_figcap": {},
182+
"python_markdown_comments:CommentsExtension": {},
170183
},
171-
'output_format': 'html5',
184+
"output_format": "html5",
172185
}
173186

174187
PLUGINS = [
175-
# 'seo',
176-
'pelican.plugins.share_post', # XXX 7/29/23 BS4 issues MarkupResemblesLocatorWarning
177-
# 'sitemap',
178-
'pelican.plugins.related_posts',
179-
'minchin.pelican.plugins.nojekyll',
180-
'pelican.plugins.read_more',
181-
'jinja2content',
182-
'series',
188+
# "seo",
189+
# XXX 7/29/23 BS4 issues MarkupResemblesLocatorWarning
190+
"pelican.plugins.share_post",
191+
# "sitemap",
192+
"pelican.plugins.related_posts",
193+
"minchin.pelican.plugins.nojekyll",
194+
"pelican.plugins.read_more",
195+
"jinja2content",
196+
"series",
183197
]
184198

185-
if __name__ == '__main__':
199+
if __name__ == "__main__":
186200
import os
187-
os.system(f'pelican {PATH} -o {OUTPUT_PATH} -s {__file__}')
201+
os.system(f"pelican {PATH} -o {OUTPUT_PATH} -s {__file__}")

0 commit comments

Comments
 (0)