update @ Wed Dec 18 02:43:42 EET 2024
Signed-off-by: Ari Archer <ari@ari.lt>
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 153 KiB |
After Width: | Height: | Size: 220 KiB |
After Width: | Height: | Size: 375 KiB |
After Width: | Height: | Size: 271 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 256 KiB |
After Width: | Height: | Size: 214 KiB |
104
media/media.json
|
@ -24,5 +24,109 @@
|
||||||
"ext": "png",
|
"ext": "png",
|
||||||
"mime": "image/png",
|
"mime": "image/png",
|
||||||
"uploaded": 1734473202.686761
|
"uploaded": 1734473202.686761
|
||||||
|
},
|
||||||
|
"2f279788d90f6ddae8d49c49674ac899f078bb94243b1b0aabf711e17fc3f482": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 1290,
|
||||||
|
"height": 870,
|
||||||
|
"alt": "A screenshot of a badly written blog post where most of the content is striked through and full of updates",
|
||||||
|
"purpose": "To illustrate the old \"Rust bad\" blog post from the legacy Ari-web blog.",
|
||||||
|
"title": "Screenshot of \"Rust bad\"",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"credit": "Ari Archer",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734473932.694922
|
||||||
|
},
|
||||||
|
"43fef629105fdc1cd04e6f400abed839d988c23f67223a8d3fe1674fe02e42e1": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 2730,
|
||||||
|
"height": 1650,
|
||||||
|
"alt": "A multiplexed terminal window. The left pane shows a Cargo project setup of a simple game where it is installing 19 crates because we require the `rand` crate. The right pane shows the output binary, despide being advertised as static, depending on other standard dynamic libraries, as well as Cargo's large cache sizes",
|
||||||
|
"purpose": "To show the dependency hell and complexity of Rust as well as its size.",
|
||||||
|
"title": "The Rustlang experience",
|
||||||
|
"license": "CC0-1.0",
|
||||||
|
"credit": "Ari Archer",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474105.967359
|
||||||
|
},
|
||||||
|
"a22e9a8beb3154523ba368302bedede134df659950925a9968b49cc265cefb7a": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 750,
|
||||||
|
"height": 1200,
|
||||||
|
"alt": "The image illustrates the compilation times and binary sizes of a simple random number guessing game written in C and C++ through a terminal window. Two commands were run: the first one shows the compile time and binary size of the C version, and the C++ version is below showing the same information. The C++ one is slower to compile, but the size remains 14 KB",
|
||||||
|
"purpose": "To juxtaposition Rust's apprach to a simple game with the simple approach C and C++ take.",
|
||||||
|
"title": "C and C++ compilation times and binary sizes of a simple game",
|
||||||
|
"license": "CC0-1.0",
|
||||||
|
"credit": "Ari Archer",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474254.159669
|
||||||
|
},
|
||||||
|
"783a5e8cb6fcc3626a0ebfb08d2c35defa5e4fbfa48f17ebcb3596bffad01cd3": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 400,
|
||||||
|
"height": 400,
|
||||||
|
"alt": "A quote by Terry A. Davis: \"An idiot admires complexity, a genius admires simplicity\"",
|
||||||
|
"purpose": "To highlight the idea that intelligent individuals tend to appreciate straightforward solutions rather than convoluted ones, while less knowledgeable people may find complexity impressive simply because they do not understand it.",
|
||||||
|
"title": "Terry A. Davis quote",
|
||||||
|
"license": "CC-BY-SA-4.0",
|
||||||
|
"credit": "Ari Archer (image), Terry A. Davis (quote)",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474455.015919
|
||||||
|
},
|
||||||
|
"7039b8fd6868afe631aa97acb95222f21a64e1ddee38779142d9f098141bb4c4": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 640,
|
||||||
|
"height": 563,
|
||||||
|
"alt": "A meme. At the top, black on white, the text reads \"Three generations of languages that will replace C\". Below the text, there's 3 men of differing ages around a couch. The oldest man has a text box above him with the PASCAL logo, middle-aged man - Java, and the youngest one of 3 - Rust logo",
|
||||||
|
"purpose": "For irony purposes, to illustrate how people keep trying to \"replace C\" but never really do.",
|
||||||
|
"title": "3 generations of languages that \"replaced C\" (they didn't)",
|
||||||
|
"license": "Unknown",
|
||||||
|
"credit": "Author unknown",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474610.104147
|
||||||
|
},
|
||||||
|
"14a5361b38cd74a9b6d8cd5e2fa63d9ea4a6a813d7780ffb6454a4871ecec996": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 1320,
|
||||||
|
"height": 1020,
|
||||||
|
"alt": "A screenshot of a Rust example that intentionally causes a Rust panic by creating an error in the borrow checker at runtime. The compiler has a couple of warnings regarding unused variables, and after compiling the binary and running it, rust throws a borrow checker error",
|
||||||
|
"purpose": "To show the runtime costs of Rust and its compiler not saying anything about a clear error in borrowing.",
|
||||||
|
"title": "Rust runtime costs",
|
||||||
|
"license": "CC0-1.0",
|
||||||
|
"credit": "Ari Archer",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474772.543329
|
||||||
|
},
|
||||||
|
"0916be4b05235a7551cffd393b9f92925aaa6695e21c1db6b4ffa0f9a59e76d0": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 960,
|
||||||
|
"height": 204,
|
||||||
|
"alt": "The search page on crates.io querying for \"random number\". The returned page states that there are 2077 total results for \"random number\" libraries",
|
||||||
|
"purpose": "To illustrate the overwhelming choice in the Rust ecosystem that even simple things like random number generators have over 2000 choices of libraries.",
|
||||||
|
"title": "Rust's choice of random number generators",
|
||||||
|
"license": "CC0-1.0",
|
||||||
|
"credit": "Ari Archer",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734474892.128002
|
||||||
|
},
|
||||||
|
"86b362afea5c76f61ed65da4762b91fda1a99d302f814b48fbf79a8b1f6bcc94": {
|
||||||
|
"type": "image",
|
||||||
|
"width": 640,
|
||||||
|
"height": 482,
|
||||||
|
"alt": "The Simpsons meme format where Homer closes the garage door on Flanders as he tries to talk to Homer. From top left the first pannel reads \"Have you heard about Rust?\" as the door begins closing. Second pannel reads \"Did you know that you can write safe code with it\" as the door is half-closed, then in the 3rd pannel - \"Without memory leaks and with high performance?\". The door finally closes and Homer looks at peace",
|
||||||
|
"purpose": "To illustrate how hype leads to negative perception of the Rust community in a meme format.",
|
||||||
|
"title": "Have you heard about Rust?",
|
||||||
|
"license": "Unknown",
|
||||||
|
"credit": "Author unknown",
|
||||||
|
"ext": "png",
|
||||||
|
"mime": "image/png",
|
||||||
|
"uploaded": 1734475065.128174
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ 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 mistune.util import safe_entity
|
||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.formatters import HtmlFormatter, html
|
from pygments.formatters import HtmlFormatter, html
|
||||||
from pygments.lexers import get_lexer_by_name, guess_lexer
|
from pygments.lexers import get_lexer_by_name, guess_lexer
|
||||||
|
@ -832,7 +833,7 @@ def parse_inline_media_embed(
|
||||||
{
|
{
|
||||||
"type": "link",
|
"type": "link",
|
||||||
"children": [{"type": "text", "raw": f"(raw media here)"}],
|
"children": [{"type": "text", "raw": f"(raw media here)"}],
|
||||||
"attrs": {"url": source},
|
"attrs": {"url": source, "blank": True},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"attrs": {"classes": "media"},
|
"attrs": {"classes": "media"},
|
||||||
|
@ -857,6 +858,23 @@ class BlogRenderer(HTMLRenderer):
|
||||||
|
|
||||||
return f'<h{level} id="{slug}" h><a href="#{slug}">#</a> {text}</h{level}>'
|
return f'<h{level} id="{slug}" h><a href="#{slug}">#</a> {text}</h{level}>'
|
||||||
|
|
||||||
|
def link(
|
||||||
|
self,
|
||||||
|
text: str,
|
||||||
|
url: str,
|
||||||
|
title: typing.Optional[str] = None,
|
||||||
|
blank: bool = False,
|
||||||
|
) -> str:
|
||||||
|
s: str = '<a href="' + self.safe_url(url) + '"'
|
||||||
|
|
||||||
|
if title:
|
||||||
|
s += ' title="' + safe_entity(title) + '"'
|
||||||
|
|
||||||
|
if blank:
|
||||||
|
s += ' target="_blank"'
|
||||||
|
|
||||||
|
return s + ">" + text + "</a>"
|
||||||
|
|
||||||
def strong_error(self, text: str) -> str:
|
def strong_error(self, text: str) -> str:
|
||||||
return f"<strong class=error>{text}</strong>"
|
return f"<strong class=error>{text}</strong>"
|
||||||
|
|
||||||
|
@ -1945,7 +1963,7 @@ def purgemedia(config: dict[str, typing.Any]) -> int:
|
||||||
used = True
|
used = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if f"<@{mdx}>" in post["content"]:
|
if f"<@:{mdx}>" in post["content"]:
|
||||||
used = True
|
used = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|