Prevents attributes, HTML escape applied on links

When the link come without label:
=> gemini://thesite.gmi

The A markup would be:
<a href="gemini://thesite.gmi">gemini:<i>thesite.gmi</a></i>
This commit is contained in:
Christophe HENRY 2021-03-04 14:13:58 +01:00
parent 28ddc04ba2
commit 1900f3c03b
1 changed files with 8 additions and 6 deletions

View File

@ -116,12 +116,14 @@ foreach ($fileLines as $line) {
preg_match("/^=>\s*([^\s]+)\s*(.*)$/", $line, $linkParts);
$url_link = $linkParts[1];
$url_label = $linkParts[2];
if (empty($url_label)) $url_label = $url_link;
htmlEscape($url_link);
keepSpaces($url_link);
htmlEscape($url_label);
keepSpaces($url_label);
if ($mode_textAttributes) addTextAttributes($url_label);
if (empty($url_label)) {
$url_label = $url_link;
} else {
// the label is humain-made, apply formatting
htmlEscape($url_label);
keepSpaces($url_label);
if ($mode_textAttributes) addTextAttributes($url_label);
}
print("<p><a href='".$url_link."'>".$url_label."</a></p>\n");
} elseif ('"""' == $line3) {
$mode_textAttributes = !$mode_textAttributes;