diff --git a/css/htmgem.css b/css/htmgem.css index cb189a9..dbda462 100644 --- a/css/htmgem.css +++ b/css/htmgem.css @@ -114,7 +114,7 @@ pre { h3 { font-size: 3rem; } - p, pre, ul { + p, pre, ul, blockquote { font-size: 2.6rem; } } diff --git a/index.gmi b/index.gmi index 7367289..f140353 100644 --- a/index.gmi +++ b/index.gmi @@ -88,7 +88,7 @@ Lorsque l’option css est activé dans la configuration (voir //rewrite// plus ## Réécriture d’URL pour préciser le style à utiliser Modifier la configuration du serveur web fonctionne mais est assez lourd. On peut tester un style en particulier de la façon suivante : -> https://site.tld/htmgem/index.php?url=/url/page.gmi&style=<…> +> https:/​/site.tld/htmgem/index.php?url=/url/page.gmi&style=<…> Il est aussi possible de faire une réécriture d’URL qui intègre le style : > rewrite ^(.+\.gmi)$ /htmgem/?url=$1; diff --git a/index.php b/index.php index 6aef3f7..342857f 100644 --- a/index.php +++ b/index.php @@ -79,7 +79,7 @@ if ("source" == $style) { # Gets the page title: the first occurrence with # at the line start mb_ereg("#\s*([^\n]+)\n", $fileContents, $matches); $page_title = @$matches[1]; - $fileContents = htmlspecialchars($fileContents, ENT_HTML5|ENT_NOQUOTES, "UTF-8", false); + $fileContents = htmlspecialchars($fileContents, ENT_HTML5|ENT_QUOTES, "UTF-8", true); echo << diff --git a/lib-htmgem.php b/lib-htmgem.php index 2e872df..e6be3f8 100644 --- a/lib-htmgem.php +++ b/lib-htmgem.php @@ -244,7 +244,7 @@ class GemtextTranslate_html { if (empty($text)) { $text = " "; } else { - $text = htmlspecialchars($text, ENT_HTML5|ENT_NOQUOTES, "UTF-8", false); + $text = htmlspecialchars($text, ENT_HTML5|ENT_QUOTES, "UTF-8", true); $text = mb_ereg_replace("\ ([?!:;»€$])", self::NARROW_NO_BREAK_SPACE."\\1", $text); $text = mb_ereg_replace("([«])\ ", "\\1".self::NARROW_NO_BREAK_SPACE, $text); # Espace fine insécable @@ -295,6 +295,9 @@ class GemtextTranslate_html { $linkText = $link; self::htmlPrepare($linkText); } else { + // Don't double encode, just escapes quotes, "<" and ">". + // So "I'm>" becomes "I'>". The & remains untouched. + $link = htmlspecialchars($link, ENT_HTML5|ENT_QUOTES, "UTF-8", false); self::htmlPrepare($linkText); if ($textDecoration) self::addTextDecoration($linkText); }