diff --git a/TODO b/TODO index 9f1a952..e2251c7 100644 --- a/TODO +++ b/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: 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 diff --git a/htmgem.php b/htmgem.php index cd4a612..d07f7bc 100644 --- a/htmgem.php +++ b/htmgem.php @@ -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 "
\n";
+                    } else {
+                        echo "
\n";
+                    }
+                }
                 $mode="pre";
-                echo "
\n";
             } elseif (">" == $line1) {
                 $mode = "quote";
                 preg_match("/^>\s*(.*)$/", $line, $quoteParts);
@@ -228,6 +235,7 @@ echo <<$page_title