mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Sun Dec 15 15:17:17 EET 2024
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
e8025e3ffe
commit
903623abae
4 changed files with 42 additions and 8 deletions
10
blog.json
10
blog.json
|
@ -131,8 +131,18 @@
|
||||||
"read-wpm": 150,
|
"read-wpm": 150,
|
||||||
"top-words": 64,
|
"top-words": 64,
|
||||||
"top-tags": 64,
|
"top-tags": 64,
|
||||||
|
"code-style": "coffee",
|
||||||
"legal": "<b>Legal disclaimer</b>: The content of this blog post is my personal opinion, experience, and thoughts as an individual sharing her perspective on this topic. I am not a professional or expert in this area, and the information provided in this blog post is for general informational, educational, entertainment, and recreational purposes only. Accuracy is strived for, but no warranty is given in respect to the reliability or completeness of such content, express or implied. Your acceptance of any reliance on any part of such content from the blog is entirely at your own risk. Under no circumstances shall I, and any of my representatives be held liable for damages arising from access and use of the blog post or linked sites and sources. Furthermore, there might be some links from this blog post to other websites; I have no control over those and do not endorse their content. You are responsible for your actions and subsequent results in using this material. This disclaimer is provided as per the legal basis underlying <a href=\"https://ari.lt/legal\">https://ari.lt/legal</a> and should be considered in further reference to privacy, data security, and liability. Your use of this blog post acknowledges your acceptance of the conditions, and exempts me from any liability that comes from any possible inaccuracy, incompleteness, unreliability, inconsistencies, (un)availability, or any other errors in the information provided herein.",
|
"legal": "<b>Legal disclaimer</b>: The content of this blog post is my personal opinion, experience, and thoughts as an individual sharing her perspective on this topic. I am not a professional or expert in this area, and the information provided in this blog post is for general informational, educational, entertainment, and recreational purposes only. Accuracy is strived for, but no warranty is given in respect to the reliability or completeness of such content, express or implied. Your acceptance of any reliance on any part of such content from the blog is entirely at your own risk. Under no circumstances shall I, and any of my representatives be held liable for damages arising from access and use of the blog post or linked sites and sources. Furthermore, there might be some links from this blog post to other websites; I have no control over those and do not endorse their content. You are responsible for your actions and subsequent results in using this material. This disclaimer is provided as per the legal basis underlying <a href=\"https://ari.lt/legal\">https://ari.lt/legal</a> and should be considered in further reference to privacy, data security, and liability. Your use of this blog post acknowledges your acceptance of the conditions, and exempts me from any liability that comes from any possible inaccuracy, incompleteness, unreliability, inconsistencies, (un)availability, or any other errors in the information provided herein.",
|
||||||
"posts": {
|
"posts": {
|
||||||
|
"fw": {
|
||||||
|
"title": "fw",
|
||||||
|
"description": "e",
|
||||||
|
"content": "```js\nhello world\n```\n\n```\nmeow\n```",
|
||||||
|
"keywords": [
|
||||||
|
"e"
|
||||||
|
],
|
||||||
|
"created": 1734259005.535073
|
||||||
|
},
|
||||||
"install-lineageos-181-xiaomi-redmi-go-tiare": {
|
"install-lineageos-181-xiaomi-redmi-go-tiare": {
|
||||||
"title": "How to install LineageOS 18.1 on Xiaomi Redmi GO (Tiare)",
|
"title": "How to install LineageOS 18.1 on Xiaomi Redmi GO (Tiare)",
|
||||||
"description": "In this blog post, I walk you through a process of installing LineageOS 18.1 with Magisk on Redmi GO (Tiare). I cover various things like recovery, installing, and rooting LineageOS, and later I teach you how to get more swap space for better performance.",
|
"description": "In this blog post, I walk you through a process of installing LineageOS 18.1 with Magisk on Redmi GO (Tiare). I cover various things like recovery, installing, and rooting LineageOS, and later I teach you how to get more swap space for better performance.",
|
||||||
|
|
|
@ -6,9 +6,18 @@
|
||||||
--ef: #bb6868;
|
--ef: #bb6868;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlighttable {
|
||||||
|
border-spacing: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
overflow-y: auto;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*[h] > a {
|
*[h] > a {
|
||||||
|
|
|
@ -3,3 +3,4 @@ mistune
|
||||||
typing
|
typing
|
||||||
readtime
|
readtime
|
||||||
unidecode
|
unidecode
|
||||||
|
pygments
|
||||||
|
|
|
@ -29,6 +29,9 @@ import mistune.plugins
|
||||||
import unidecode
|
import unidecode
|
||||||
import web_mini
|
import web_mini
|
||||||
from mistune.renderers.html import HTMLRenderer
|
from mistune.renderers.html import HTMLRenderer
|
||||||
|
from pygments import highlight
|
||||||
|
from pygments.formatters import HtmlFormatter, html
|
||||||
|
from pygments.lexers import get_lexer_by_name, guess_lexer
|
||||||
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
||||||
from readtime.result import Result as MarkdownResult # type: ignore
|
from readtime.result import Result as MarkdownResult # type: ignore
|
||||||
|
|
||||||
|
@ -157,6 +160,7 @@ DEFAULT_CONFIG: dict[str, typing.Any] = {
|
||||||
"read-wpm": 150,
|
"read-wpm": 150,
|
||||||
"top-words": 64,
|
"top-words": 64,
|
||||||
"top-tags": 64,
|
"top-tags": 64,
|
||||||
|
"code-style": "coffee",
|
||||||
"legal": '<b>Legal disclaimer</b>: The content of this blog post is my personal opinion, experience, and thoughts as an individual sharing her perspective on this topic. I am not a professional or expert in this area, and the information provided in this blog post is for general informational, educational, entertainment, and recreational purposes only. Accuracy is strived for, but no warranty is given in respect to the reliability or completeness of such content, express or implied. Your acceptance of any reliance on any part of such content from the blog is entirely at your own risk. Under no circumstances shall I, and any of my representatives be held liable for damages arising from access and use of the blog post or linked sites and sources. Furthermore, there might be some links from this blog post to other websites; I have no control over those and do not endorse their content. You are responsible for your actions and subsequent results in using this material. This disclaimer is provided as per the legal basis underlying <a href="https://ari.lt/legal">https://ari.lt/legal</a> and should be considered in further reference to privacy, data security, and liability. Your use of this blog post acknowledges your acceptance of the conditions, and exempts me from any liability that comes from any possible inaccuracy, incompleteness, unreliability, inconsistencies, (un)availability, or any other errors in the information provided herein.',
|
"legal": '<b>Legal disclaimer</b>: The content of this blog post is my personal opinion, experience, and thoughts as an individual sharing her perspective on this topic. I am not a professional or expert in this area, and the information provided in this blog post is for general informational, educational, entertainment, and recreational purposes only. Accuracy is strived for, but no warranty is given in respect to the reliability or completeness of such content, express or implied. Your acceptance of any reliance on any part of such content from the blog is entirely at your own risk. Under no circumstances shall I, and any of my representatives be held liable for damages arising from access and use of the blog post or linked sites and sources. Furthermore, there might be some links from this blog post to other websites; I have no control over those and do not endorse their content. You are responsible for your actions and subsequent results in using this material. This disclaimer is provided as per the legal basis underlying <a href="https://ari.lt/legal">https://ari.lt/legal</a> and should be considered in further reference to privacy, data security, and liability. Your use of this blog post acknowledges your acceptance of the conditions, and exempts me from any liability that comes from any possible inaccuracy, incompleteness, unreliability, inconsistencies, (un)availability, or any other errors in the information provided herein.',
|
||||||
"posts": {},
|
"posts": {},
|
||||||
}
|
}
|
||||||
|
@ -227,7 +231,7 @@ html{{background-color:var(--b);color:var(--f)}}{critical_css}
|
||||||
POST_TEMPLATE: typing.Final[str] = (
|
POST_TEMPLATE: typing.Final[str] = (
|
||||||
HTML_BEGIN
|
HTML_BEGIN
|
||||||
+ """
|
+ """
|
||||||
<style type="text/css">{post_critical_css}</style>
|
<style type="text/css">{post_critical_css}{code_css}</style>
|
||||||
<title>{blog_title} -> {post_title}</title>
|
<title>{blog_title} -> {post_title}</title>
|
||||||
<meta property="og:title" content="{blog_title} -> {post_title}" />
|
<meta property="og:title" content="{blog_title} -> {post_title}" />
|
||||||
<meta name="description" content="{post_title} by {author} at {post_creation_time} GMT -- {post_description}" />
|
<meta name="description" content="{post_title} by {author} at {post_creation_time} GMT -- {post_description}" />
|
||||||
|
@ -747,7 +751,7 @@ def parse_inline_media_embed(
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"type": "strong_error",
|
"type": "strong_error",
|
||||||
"raw": f"ERROR: Media '{html_escape(text)}' does not exist.",
|
"raw": f"ERROR: Media '{mistune.escape(text)}' does not exist.",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attrs": {"classes": "media"},
|
"attrs": {"classes": "media"},
|
||||||
|
@ -785,7 +789,7 @@ def parse_inline_media_embed(
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"type": "strong_error",
|
"type": "strong_error",
|
||||||
"raw": f"ERROR: Media '{html_escape(text)}' has an unsupported type.",
|
"raw": f"ERROR: Media '{mistune.escape(text)}' has an unsupported type.",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attrs": {"classes": "media"},
|
"attrs": {"classes": "media"},
|
||||||
|
@ -801,7 +805,7 @@ def parse_inline_media_embed(
|
||||||
{"type": "linebreak"},
|
{"type": "linebreak"},
|
||||||
{
|
{
|
||||||
"type": "emphasis",
|
"type": "emphasis",
|
||||||
"raw": f"{mdx['alt']} | \"{mdx['title']}\" by {mdx['credit']} ({mdx['license']}). Purpose: {html_escape(mdx['purpose'])}. Uploaded on {datetime.datetime.utcfromtimestamp(mdx['uploaded']).strftime('%a, %d %b %Y %H:%M:%S GMT')}. ",
|
"raw": f"{mdx['alt']} | \"{mdx['title']}\" by {mdx['credit']} ({mdx['license']}). Purpose: {mistune.escape(mdx['purpose'])}. Uploaded on {datetime.datetime.utcfromtimestamp(mdx['uploaded']).strftime('%a, %d %b %Y %H:%M:%S GMT')}. ",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "link",
|
"type": "link",
|
||||||
|
@ -835,13 +839,20 @@ class BlogRenderer(HTMLRenderer):
|
||||||
return f"<strong class=error>{text}</strong>"
|
return f"<strong class=error>{text}</strong>"
|
||||||
|
|
||||||
def block_div(self, text: str, classes: str):
|
def block_div(self, text: str, classes: str):
|
||||||
return f'<div class="{html_escape(classes)}">{text}</div>'
|
return f'<div class="{mistune.escape(classes)}">{text}</div>'
|
||||||
|
|
||||||
def image(self, text: str, alt: str, type: str, width: int, height: int) -> str:
|
def image(self, text: str, alt: str, type: str, width: int, height: int) -> str:
|
||||||
return f'<img title="{html_escape(alt)}" src="{text}" alt="{html_escape(alt)}" type="{type}" data-width="{width}" data-height="{height}" loading=lazy />'
|
return f'<img title="{mistune.escape(alt)}" src="{text}" alt="{mistune.escape(alt)}" type="{type}" data-width="{width}" data-height="{height}" loading=lazy />'
|
||||||
|
|
||||||
def audio(self, text: str, alt: str, type: str) -> str:
|
def audio(self, text: str, alt: str, type: str) -> str:
|
||||||
return f'<audio controls title="{html_escape(alt)}"> <source src="{text}" type="{type}" {alt} /> </audio>'
|
return f'<audio controls title="{mistune.escape(alt)}"> <source src="{text}" type="{type}" {alt} /> </audio>'
|
||||||
|
|
||||||
|
def block_code(self, code: str, info: typing.Optional[str] = None) -> str:
|
||||||
|
return highlight(
|
||||||
|
code,
|
||||||
|
get_lexer_by_name(info) if info else guess_lexer(code),
|
||||||
|
HtmlFormatter(linenos="table", linenostart=1),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def markdown(md: str, plugins: list[typing.Any]) -> str:
|
def markdown(md: str, plugins: list[typing.Any]) -> str:
|
||||||
|
@ -1151,6 +1162,8 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
w_regex: re.Pattern[str] = re.compile(r"\b[a-zA-Z']+\b")
|
w_regex: re.Pattern[str] = re.compile(r"\b[a-zA-Z']+\b")
|
||||||
url_regex: re.Pattern[str] = re.compile(r"https?://\S+|www\.\S+")
|
url_regex: re.Pattern[str] = re.compile(r"https?://\S+|www\.\S+")
|
||||||
|
|
||||||
|
code_css: str = web_mini.css.minify_css(HtmlFormatter(style=config["code-style"]).get_style_defs()) # type: ignore
|
||||||
|
|
||||||
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
||||||
ct: float = ctimer()
|
ct: float = ctimer()
|
||||||
|
|
||||||
|
@ -1222,6 +1235,7 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
email=config["email"],
|
email=config["email"],
|
||||||
legal=config["legal"],
|
legal=config["legal"],
|
||||||
image_meta=image_meta,
|
image_meta=image_meta,
|
||||||
|
code_css=code_css,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue