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

Adds alt/title attribute to preformatted text

This commit is contained in:
Christophe HENRY 2021-03-08 15:44:55 +01:00
parent 7f19c7e963
commit 18d5b7d518
2 changed files with 9 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: alt texts on pre and quote
* 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

View File

@ -140,8 +140,15 @@ foreach ($fileLines as $line) {
continue;
}
} elseif ("```" == $line3) {
if (preg_match("/^```\s*(.*)$/", $line, $matches)) {
$alt_text = trim(@$matches[1]);
if (!(empty($alt_text))) {
echo "<pre alt='$alt_text' title='$alt_text'>\n";
} else {
echo "<pre>\n";
}
}
$mode="pre";
echo "<pre>\n";
} elseif (">" == $line1) {
$mode = "quote";
preg_match("/^>\s*(.*)$/", $line, $quoteParts);
@ -228,6 +235,7 @@ echo <<<EOL
<title>$page_title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
EOL;
include("htmgem.css");
echo <<<EOL