1
0
mirror of https://tildegit.org/sbgodin/HtmGem.git synced 2023-08-25 13:53:12 +02:00

Adds emojis according to links type

This commit is contained in:
Christophe HENRY 2021-03-08 16:59:17 +01:00
parent 18d5b7d518
commit 545ac4963d
3 changed files with 35 additions and 2 deletions

1
TODO
View File

@ -1,7 +1,6 @@
* manage url encoding: The filename fetched on disk may differ from that was asked by URL.
* check /etc/passwd not accessible: Perform sanity checks against unauthorized access.
* manage 404: Display better errors.
* HTML: On links indicate whether it's on Gemini or Www or image.
* a way to get the source of a page, using urlrewriting
* options to activate the text decoration
* HTML caching: Nginx tries the html, if not found use this script to build it

View File

@ -63,6 +63,37 @@ a:visited {
color: #868;
}
a.local:before {
content: "🛩️ ";
font-weight: bold;
}
a.gemini:before {
content: "🚀 ";
}
a.gopher:before {
content: "📜 ";
}
a.https:before {
content: "🕸️ ";
font-weight: bolder;
}
a.http:before {
content: "🕸️ ";
font-weight: lighter;
}
a.mumble:before {
content: "🎤 ";
}
a.mailto:before {
content: "✉️ ";
}
pre {
background-color: #eee;
margin: 0 -1rem;

View File

@ -128,13 +128,16 @@ foreach ($fileLines as $line) {
if (preg_match("/^=>\s*([^\s]+)(?:\s+(.*))?$/", $line, $linkParts)) {
$url_link = $linkParts[1];
$url_label = @$linkParts[2];
preg_match("/^([^:]+):/", $url_link, $matches);
$url_protocol = @$matches[1];
if (empty($url_protocol)) $url_protocol = "local";
if (empty(trim($url_label))) {
$url_label = $url_link;
} else {
// the label is humain-made, apply formatting
htmlPrepare($url_label);
}
echo "<p><a href='".$url_link."'>".$url_label."</a></p>\n";
echo "<p><a class='$url_protocol' href='$url_link'>$url_label</a></p>\n";
} else {
$mode = "raw";
continue;