[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Percent encode file name in internal href
From: |
Patrice Dumas |
Subject: |
branch master updated: Percent encode file name in internal href |
Date: |
Fri, 06 Sep 2024 16:44:34 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 7f36334dc6 Percent encode file name in internal href
7f36334dc6 is described below
commit 7f36334dc6b8c133cbe9fdc44f7d1eb6160e8e87
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Sep 6 22:44:34 2024 +0200
Percent encode file name in internal href
* tp/Texinfo/Convert/HTML.pm (_internal_command_href),
tp/Texinfo/XS/convert/convert_html.c (html_internal_command_href):
call url_protect_file_text on target_filename to percent encode.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Convert/HTML.pm | 2 +-
tp/Texinfo/XS/convert/convert_html.c | 7 ++++++-
tp/tests/encoded/res_parser/non_ascii_command_line/Chapteur.html | 4 ++--
tp/tests/encoded/res_parser/non_ascii_command_line/index.html | 4 ++--
.../os\303\251_utf8_epub_package/EPUB/xhtml/Chapteur.xhtml" | 6 +++---
.../os\303\251_utf8_epub_package/EPUB/xhtml/nav_toc.xhtml" | 2 +-
7 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fa74ed6c80..09cb38513c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-09-06 Patrice Dumas <pertusus@free.fr>
+
+ Percent encode file name in internal href
+
+ * tp/Texinfo/Convert/HTML.pm (_internal_command_href),
+ tp/Texinfo/XS/convert/convert_html.c (html_internal_command_href):
+ call url_protect_file_text on target_filename to percent encode.
+
2024-09-06 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_default_format_button_icon_img)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 75a536b4ac..863b75d7f7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1085,7 +1085,7 @@ sub _internal_command_href($$;$$)
if (defined($target_filename)) {
if (!defined($source_filename)
or $source_filename ne $target_filename) {
- $href .= $target_filename;
+ $href .= $self->url_protect_file_text($target_filename);
# omit target if the command is an element command, there is only
# one element in file and there is a file in the href
my $command_root_element_command
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 12d92f647e..a2cb6f3419 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -3566,7 +3566,12 @@ html_internal_command_href (CONVERTER *self, const
ELEMENT *command,
{
const ELEMENT *command_root_element
= html_command_root_element_command (self, command);
- text_append (&href, target_filename->filename);
+ char *protected_filename
+ = url_protect_file_text (self, target_filename->filename);
+
+ text_append (&href, protected_filename);
+ free (protected_filename);
+
/* omit target if the command is an element command, there is only
one element in file and there is a file in the href */
if (filename_from && command_root_element)
diff --git a/tp/tests/encoded/res_parser/non_ascii_command_line/Chapteur.html
b/tp/tests/encoded/res_parser/non_ascii_command_line/Chapteur.html
index d1f1df141f..329a0f0e6d 100644
--- a/tp/tests/encoded/res_parser/non_ascii_command_line/Chapteur.html
+++ b/tp/tests/encoded/res_parser/non_ascii_command_line/Chapteur.html
@@ -13,7 +13,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
-<link href="osé_utf8_abt.html#SEC_About" rel="help" title="About This
Document">
+<link href="os%c3%a9_utf8_abt.html#SEC_About" rel="help" title="About This
Document">
<link href="index.html" rel="up" title="Top">
<link href="index.html" rel="prev" title="Top">
<style type="text/css">
@@ -47,7 +47,7 @@ ul.mark-néni {list-style-type: "vàça"}
<div class="chapter-level-extent" id="Chapt_00eaur">
<div class="nav-panel">
<p>
-Previous: <a href="index.html" accesskey="p" rel="prev">Tôp</a>, Up: <a
href="index.html" accesskey="u" rel="up">Tôp</a> [<a
href="osé_utf8_abt.html#SEC_About" title="About (help)" rel="help"> ? </a>]</p>
+Previous: <a href="index.html" accesskey="p" rel="prev">Tôp</a>, Up: <a
href="index.html" accesskey="u" rel="up">Tôp</a> [<a
href="os%c3%a9_utf8_abt.html#SEC_About" title="About (help)" rel="help"> ?
</a>]</p>
</div>
<hr>
<h2 class="chapter" id="Chapteur"><span>1 Chapteùr<a class="copiable-link"
href="#Chapteur"> ¶</a></span></h2>
diff --git a/tp/tests/encoded/res_parser/non_ascii_command_line/index.html
b/tp/tests/encoded/res_parser/non_ascii_command_line/index.html
index 979efdf224..e416f0b76a 100644
--- a/tp/tests/encoded/res_parser/non_ascii_command_line/index.html
+++ b/tp/tests/encoded/res_parser/non_ascii_command_line/index.html
@@ -13,7 +13,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="#Top" rel="start" title="Top">
-<link href="osé_utf8_abt.html#SEC_About" rel="help" title="About This
Document">
+<link href="os%c3%a9_utf8_abt.html#SEC_About" rel="help" title="About This
Document">
<link href="Chapteur.html" rel="next" title="Chaptêur">
<style type="text/css">
<!--
@@ -47,7 +47,7 @@ ul.mark-néni {list-style-type: "vàça"}
<div class="top-level-extent" id="Top">
<div class="nav-panel">
<p>
-Next: <a href="Chapteur.html" accesskey="n" rel="next">Chapteùr</a> [<a
href="osé_utf8_abt.html#SEC_About" title="About (help)" rel="help"> ? </a>]</p>
+Next: <a href="Chapteur.html" accesskey="n" rel="next">Chapteùr</a> [<a
href="os%c3%a9_utf8_abt.html#SEC_About" title="About (help)" rel="help"> ?
</a>]</p>
</div>
<hr>
<h1 class="top" id="Top-1"><span>Tôp<a class="copiable-link" href="#Top-1">
¶</a></span></h1>
diff --git
"a/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/Chapteur.xhtml"
"b/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/Chapteur.xhtml"
index 6cd919b171..9f88f0f870 100644
---
"a/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/Chapteur.xhtml"
+++
"b/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/Chapteur.xhtml"
@@ -13,9 +13,9 @@
<meta name="Generator" content="texi2any"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
-<link href="osé_utf8.xhtml" rel="start" title="Tôp"/>
-<link href="osé_utf8.xhtml" rel="up" title="Tôp"/>
-<link href="osé_utf8.xhtml" rel="prev" title="Tôp"/>
+<link href="os%c3%a9_utf8.xhtml" rel="start" title="Tôp"/>
+<link href="os%c3%a9_utf8.xhtml" rel="up" title="Tôp"/>
+<link href="os%c3%a9_utf8.xhtml" rel="prev" title="Tôp"/>
</head>
diff --git
"a/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/nav_toc.xhtml"
"b/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/nav_toc.xhtml"
index c1da73b5a2..24c5c9f8ee 100644
---
"a/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/nav_toc.xhtml"
+++
"b/tp/tests/encoded/res_parser/non_ascii_test_epub/os\303\251_utf8_epub_package/EPUB/xhtml/nav_toc.xhtml"
@@ -9,7 +9,7 @@
<h1>Table of contents</h1>
<ol>
- <li><a href="osé_utf8.xhtml">Tôp</a></li>
+ <li><a href="os%c3%a9_utf8.xhtml">Tôp</a></li>
<li><a href="Chapteur.xhtml">1 Chapteùr</a></li>
</ol>
</nav>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Percent encode file name in internal href,
Patrice Dumas <=