💾 Archived View for gemini.bunburya.eu › newsgroups › gemini › messages › ssjhge$k74$1@dont-email.me… captured on 2024-02-05 at 09:51:31. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
-=-=-=-=-=-=-
From: Luca Saiu <luca@ageinghacker.net>
Subject: Simple conversions from HTML to simple markups are disappointing
Date: Sun, 23 Jan 2022 13:25:29 +0100
Message-ID: <ssjhge$k74$1@dont-email.me>
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Disgusted by the web with its anti-features, its enormous gratuitous
complexity and its essentially proprietary nature (the effort of
re-implementing a significant component from scratch is unrealistic for
single developers), I have recently opened Gemini and Gopher services
on ageinghacker.net .
I plan to publish new information on the simpler systems as well, rather
than only on my web site.
About existing web pages I had thought about machine-converting HTML to
Gopher and Gemini markup, using lynx -dump along with some simple Unix
shell scripting. The existing HTML on my web site is hand-written and
very simple; I had at least the good taste of not using JavaScript.
After experimenting for one day or two I have to admit that the result
is disappointing. The conversion is unnatural and I find that at the
same time some important information is lost (<tt> and <pre>) while some
which is irrelevant is preserved (icons). Having out-of-line links does
not help readability when references are numerous.
You can find my experiment at
gopher://ageinghacker.net
and
gemini://ageinghacker.net
, and my crude script attached to this message.
Now, it is possible to obtain a better conversion by spending more
effort: in particular lynx (which of course was never designed for this
task) is inadequate in preserving markup information. It is possible to
parse HTML instead, and start from an AST. On the other hand some fault
lies in the HTML source document as well: The document could have used,
for example, CSS for icons instead of <img> elements when the content
was not significant enough to deserve translation. However some style
information only encoded in CSS would be significant for translation:
had I used CSS in the place of old-style <tt> elements, recognising
âcodeâ-type elements would have been an issue.
My html-to-gemini or html-to-gopher conversion would need a lot of the
complexity I want to avoid.
I have come to believe that the only really practical solution is
translating in the opposite direction: starting from a simple and clean
markup (I would say Gemini) and from that generating other simple
markups (Gopher) and the legacy system (HTML). This can and should
handle relative, intra-server links.
--
Luca Saiu -- http://ageinghacker.net
I support everyone's freedom of mocking any opinion or belief, no
matter how deeply held, with open disrespect and the same unrelented
enthusiasm of a toddler who has just learned the word "poo".
--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=html2simple
Content-Transfer-Encoding: base64
IyEvYmluL2Jhc2gKIyBXcml0dGVuIGJ5IEx1Y2EgU2FpdSAgPGh0dHA6Ly9hZ2VpbmdoYWNrZXIu
bmV0PiBpbiAyMDIyLgojIFRoZSBhdXRob3IgcmVsZWFzZXMgdGhpcyBjb2RlIGludG8gdGhlIHB1
YmxpYyBkb21haW4sIHVwIHRvIHRoZSBleHRlbnQgb2YKIyB0aGUgYXBwbGljYWJsZSBsYXcuCgpz
Y3JpcHRuYW1lPSQwCgp0YXJnZXRtYXJrdXA9J2dlbWluaScKIyB0YXJnZXRtYXJrdXA9J2dvcGhl
cicKCiNpbnZpc2libGVjaGFyYWN0ZXI9J+KBpCcgIyBVKzIwNjQg4oCcaW52aXNpYmxlIHBsdXPi
gJ0KaW52aXNpYmxlY2hhcmFjdGVyPSfigI0nICAjIFUrMjAwRCDigJx6ZXJvLXdpZHRoIGpvaW5l
cuKAnQojaW52aXNpYmxlY2hhcmFjdGVyPSfigaRGT09GT09GT08nCgpjbGVhbnVwICgpCnsKICAg
IGlmIHRlc3QgIiR7dGVtcG9yYXJ5ZGlyZWN0b3J5fSIgPSAnJzsgdGhlbgogICAgICAgIHRydWUg
IyBEbyBub3RoaW5nLgogICAgZWxpZiAhIHRlc3QgLWQgIiR7dGVtcG9yYXJ5ZGlyZWN0b3J5fSI7
IHRoZW4KICAgICAgICBtZXNzYWdlPSJub3QgYSBkaXJlY3Rvcnk6ICR7dGVtcG9yYXJ5ZGlyZWN0
b3J5fSIKICAgICAgICB0ZW1wb3JhcnlkaXJlY3Rvcnk9JycKICAgICAgICBmYXRhbCAiJG1lc3Nh
Z2UiCiAgICBlbHNlCiAgICAgICAgcm0gLXJmICIke3RlbXBvcmFyeWRpcmVjdG9yeX0iCiAgICBm
aQp9CgpzdWNjZXNzICgpCnsKICAgIGNsZWFudXAKIy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UgcmVhZCBudW1iZXIgdXJsOyBkbwogICAgICAgIG51bWJlcj0kKGVjaG8gJG51bWJl
ciB8IHNlZCAncy9cLiQvLycpCiAgICAgICAgY2FzZSAkdGFyZ2V0bWFya3VwIGluCiAgICAgICAg
ICAgIGdvcGhlcikKICAgICAgICAgICAgICAgIHRhcmdldHByZWZpeD0nJwogICAgICAgICAgICAg
ICAgdGFyZ2V0PSIkdXJsIgogICAgICAgICAgICAgICAgaWYgZWNobyAiJHVybCIgfCBncmVwIC1x
ICdeaHR0cHNcPzovLycgXAogICAgICAgICAgICAgICAgICAgJiYgISBlY2hvICIkdXJsIiB8IGdy
ZXAgLXEgJ15odHRwc1w/Oi8vYWdlXD9pbmdoYWNrZXJcLm5ldCc7IHRoZW4KICAgICAgICAgICAg
ICAgICAgICB0eXBlPSdoJwogICAgICAgICAgICAgICAgICAgIHRhcmdldHByZWZpeD0nVVJMOicK
ICAgICAgICAgICAgICAgIGVsaWYgZWNobyAiJHVybCIgfCBncmVwIC1xICdcLlwoaHRtbFw/XHx4
bWxcfHhodG1sXHxjc3NcfGpzXHwvXCkkJzsgdGhlbgogICAgICAgICAgICAgICAgICAgIHR5cGU9
JzEnCiAgICAgICAgICAgICAgICBlbGlmIGVjaG8gIiR1cmwiIHwgZ3JlcCAtcSAnXC5cKHRlXD94
dFwpJCc7IHRoZW4KICAgICAgICAgICAgICAgICAgICB0eXBlPScwJwogICAgICAgICAgICAgICAg
ZWxpZiBlY2hvICIkdXJsIiB8IGdyZXAgLXEgJ1wuXChqcGVcP2dcfGdpZlx8cG5nXCkkJzsgdGhl
bgogICAgICAgICAgICAgICAgICAgIHR5cGU9J0knCiAgICAgICAgICAgICAgICBlbGlmIGVjaG8g
IiR1cmwiIHwgZ3JlcCAtcSAnXC5cKHBzXHxwZGZcKSQnOyB0aGVuCiAgICAgICAgICAgICAgICAg
ICAgdHlwZT0nZCcKICAgICAgICAgICAgICAgIGVsaWYgZWNobyAiJHVybCIgfCBncmVwIC1xICdc
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