|
2 | 2 | import base64
|
3 | 3 | import zlib
|
4 | 4 |
|
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’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/" |
22 | 25 | USE_FOLDER_AS_CATEGORY = False
|
23 | 26 |
|
24 |
| -PATH = 'markdown/' |
25 |
| -OUTPUT_PATH = 'docs/' |
| 27 | +GOOGLE_TAG = "G-XR0F89CCGK" # cSpell: ignore ccgk |
26 | 28 |
|
27 |
| -TIMEZONE = 'America/New_York' |
| 29 | +PATH = "markdown/" |
| 30 | +OUTPUT_PATH = "docs/" |
28 | 31 |
|
29 |
| -DEFAULT_LANG = 'en_US' |
| 32 | +TIMEZONE = "America/New_York" |
| 33 | + |
| 34 | +DEFAULT_LANG = "en_US" |
30 | 35 |
|
31 | 36 | # maybe later...
|
32 | 37 | FEED_ALL_ATOM = None
|
|
38 | 43 | SEO_REPORT = True
|
39 | 44 |
|
40 | 45 | 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>.*)" |
43 | 49 |
|
44 | 50 | # Blogroll
|
45 | 51 | 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/"), |
48 | 54 | )
|
49 | 55 |
|
50 | 56 | # Social
|
51 | 57 | 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}"), |
54 | 60 | )
|
55 | 61 |
|
56 | 62 | 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’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"), |
65 | 72 | )),
|
66 |
| - ('uLisp Extensions', f'{SITEURL}/pages/ulisp_howto.html'), |
| 73 | + ("uLisp Extensions", f"{SITEURL}/pages/ulisp_howto.html"), |
67 | 74 | )
|
68 | 75 |
|
69 | 76 | DEFAULT_PAGINATION = 10
|
70 | 77 | DEFAULT_ORPHANS = 3
|
71 | 78 | 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}"), |
74 | 81 | )
|
75 | 82 |
|
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" |
78 | 85 |
|
79 |
| -THEME = './pelicantheme' |
| 86 | +THEME = "./pelicantheme" |
80 | 87 |
|
81 | 88 | RELATIVE_URLS = False
|
82 | 89 |
|
83 |
| -READERS = {'html': None} |
| 90 | +READERS = {"html": None} |
84 | 91 |
|
85 | 92 |
|
86 | 93 | 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>') |
88 | 97 |
|
89 | 98 |
|
90 | 99 | def kroki_fence(source, language, css_class, options, md, **kwargs):
|
91 | 100 | 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: |
96 | 105 | attr = f' width="{options["width"]}" height="{options["height"]}"'
|
97 | 106 | return f'<img src="https://kroki.io/{lang}/svg/{data}"{attr} />'
|
98 | 107 |
|
99 | 108 |
|
100 | 109 | def named_kroki(name):
|
101 | 110 | 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} |
104 | 114 |
|
105 | 115 |
|
106 | 116 | def circuit_fence(source, language, css_class, options, md, **kwargs):
|
107 | 117 | return '<span style="color: red; background: yellow;">TODO</span>'
|
108 | 118 |
|
109 | 119 |
|
110 | 120 | 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('&', '&').replace( |
113 |
| - '<', '<').replace('>', '>') |
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("&", "&").replace( |
| 125 | + "<", "<").replace(">", ">") |
| 126 | + classes = kwargs.get("classes", []) |
| 127 | + attrs = kwargs.get("attrs", {}) |
| 128 | + other_attrs = "".join(map(lambda x: f' {x[0]}=\"{x[1]}\"', attrs.items())) |
117 | 129 | classes.append("highlight")
|
118 | 130 | 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>" |
120 | 133 |
|
121 | 134 |
|
122 | 135 | 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 |
130 | 143 | },
|
131 |
| - 'pymdownx.inlinehilite': {}, |
| 144 | + "pymdownx.inlinehilite": {}, |
132 | 145 | "pymdownx.superfences": {
|
133 | 146 | "custom_fences": [
|
134 | 147 | # 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"), |
137 | 150 | {
|
138 |
| - 'name': 'lifeviewer', |
139 |
| - 'class': 'lifeviewer', |
140 |
| - 'format': lv_fence |
| 151 | + "name": "lifeviewer", |
| 152 | + "class": "lifeviewer", |
| 153 | + "format": lv_fence |
141 | 154 | },
|
142 | 155 | {
|
143 |
| - 'name': 'kroki', |
144 |
| - 'class': 'kroki', |
145 |
| - 'format': kroki_fence |
| 156 | + "name": "kroki", |
| 157 | + "class": "kroki", |
| 158 | + "format": kroki_fence |
146 | 159 | },
|
147 | 160 | {
|
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 |
151 | 164 | }
|
152 | 165 | ]
|
153 | 166 | },
|
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": {}, |
170 | 183 | },
|
171 |
| - 'output_format': 'html5', |
| 184 | + "output_format": "html5", |
172 | 185 | }
|
173 | 186 |
|
174 | 187 | 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", |
183 | 197 | ]
|
184 | 198 |
|
185 |
| -if __name__ == '__main__': |
| 199 | +if __name__ == "__main__": |
186 | 200 | 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