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:
parent
18d5b7d518
commit
545ac4963d
1
TODO
1
TODO
@ -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
|
||||
|
31
htmgem.css
31
htmgem.css
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user