[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Encode file names when needed
From: |
Patrice Dumas |
Subject: |
branch master updated: Encode file names when needed |
Date: |
Sun, 27 Feb 2022 13:52:37 -0500 |
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 08429b1937 Encode file names when needed
08429b1937 is described below
commit 08429b19373fe9148d3697347be23c1cd419aeaf
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 27 19:52:25 2022 +0100
Encode file names when needed
* tp/DebugTexinfo/DebugTree.pm (output),
tp/Texinfo/Convert/Converter.pm (output),
tp/Texinfo/Convert/DocBook.pm (output),
tp/Texinfo/Convert/HTML.pm (output),
tp/Texinfo/Convert/IXIN.pm (output_ixin),
tp/Texinfo/Convert/Info.pm (output, _register_closed_info_file),
tp/Texinfo/Convert/LaTeX.pm (output),
tp/Texinfo/Convert/TexinfoXML.pm (output),
tp/init/chm.pm, tp/init/epub3.pm, tp/init/highlight_syntax.pm,
tp/init/latex2html.pm, tp/init/tex4ht.pm, tp/texi2any.pl:
encode file names and command calls when needed.
In texi2any.pl, decode INTERNAL_LINKS and MACRO_EXPAND for
error message.
* tp/Texinfo/Convert/Converter.pm (output_no_split): remove.
* tp/DebugTexinfo/DebugTree.pm: general improvements.
---
ChangeLog | 22 ++++++++
tp/DebugTexinfo/DebugTree.pm | 59 ++++++++++++++-------
tp/TODO | 112 ++++++++++++++++++++++++++++++---------
tp/Texinfo/Convert/Converter.pm | 81 +++++++++-------------------
tp/Texinfo/Convert/DocBook.pm | 13 +++--
tp/Texinfo/Convert/HTML.pm | 4 +-
tp/Texinfo/Convert/IXIN.pm | 56 +++++++++++---------
tp/Texinfo/Convert/Info.pm | 30 +++++++----
tp/Texinfo/Convert/LaTeX.pm | 13 +++--
tp/Texinfo/Convert/TexinfoXML.pm | 13 +++--
tp/init/chm.pm | 45 +++++++++-------
tp/init/epub3.pm | 68 +++++++++++++-----------
tp/init/highlight_syntax.pm | 42 +++++++++------
tp/init/latex2html.pm | 105 ++++++++++++++++++++++++------------
tp/init/tex4ht.pm | 54 +++++++++++++------
tp/texi2any.pl | 54 +++++++++++++------
16 files changed, 498 insertions(+), 273 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index de2f4f5c52..6c85382a60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2022-02-27 Patrice Dumas <pertusus@free.fr>
+
+ Encode file names when needed
+
+ * tp/DebugTexinfo/DebugTree.pm (output),
+ tp/Texinfo/Convert/Converter.pm (output),
+ tp/Texinfo/Convert/DocBook.pm (output),
+ tp/Texinfo/Convert/HTML.pm (output),
+ tp/Texinfo/Convert/IXIN.pm (output_ixin),
+ tp/Texinfo/Convert/Info.pm (output, _register_closed_info_file),
+ tp/Texinfo/Convert/LaTeX.pm (output),
+ tp/Texinfo/Convert/TexinfoXML.pm (output),
+ tp/init/chm.pm, tp/init/epub3.pm, tp/init/highlight_syntax.pm,
+ tp/init/latex2html.pm, tp/init/tex4ht.pm, tp/texi2any.pl:
+ encode file names and command calls when needed.
+ In texi2any.pl, decode INTERNAL_LINKS and MACRO_EXPAND for
+ error message.
+
+ * tp/Texinfo/Convert/Converter.pm (output_no_split): remove.
+
+ * tp/DebugTexinfo/DebugTree.pm: general improvements.
+
2022-02-27 Patrice Dumas <pertusus@free.fr>
Decode more inputs as perl character strings
diff --git a/tp/DebugTexinfo/DebugTree.pm b/tp/DebugTexinfo/DebugTree.pm
index 5ebc00a038..427e44fdc0 100644
--- a/tp/DebugTexinfo/DebugTree.pm
+++ b/tp/DebugTexinfo/DebugTree.pm
@@ -30,11 +30,13 @@
# --debug=10 (or more), the tree is printed at the end of the run,
# --debug=100 (or more), the tree is printed at each newline.
+package DebugTexinfo::DebugTree;
+# also for __(
+use Texinfo::Common;
+use Texinfo::Structuring;
use Texinfo::Convert::Converter;
-package DebugTexinfo::DebugTree;
-
@ISA = qw(Texinfo::Convert::Converter);
my %defaults = (
@@ -58,22 +60,6 @@ sub output($$)
# a file with the same name does not make sense for this format.
# Given that this format is only to be used for debugging, this is
# not an issue that really needs fixing.
- my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
- return undef unless $succeeded;
-
- my $fh;
- if (! $output_file eq '') {
- $fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self,
- $output_file);
- if (!$fh) {
- $self->document_error($self,
- sprintf($self->__("could not open %s for writing: %s"),
- $output_file, $!));
- return undef;
- }
- }
my $elements;
if ($self) {
@@ -95,7 +81,42 @@ sub output($$)
$root = {'type' => 'elements_root',
'contents' => $elements };
}
- return $self->write_or_return(_print_tree($self, $root), $fh);
+
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
+ my ($succeeded, $created_directory)
+ = $self->create_destination_directory($encoded_destination_directory);
+ return undef unless $succeeded;
+
+ my $fh;
+ my $encoded_output_file;
+ if (! $output_file eq '') {
+ my $path_encoding;
+ ($encoded_output_file, $path_encoding)
+ = $self->encoded_file_name($output_file);
+ $fh = Texinfo::Common::output_files_open_out(
+ $self->output_files_information(), $self,
+ $encoded_output_file);
+ if (!$fh) {
+ $self->document_error($self,
+ sprintf(__("could not open %s for writing: %s"),
+ $output_file, $!));
+ return undef;
+ }
+ }
+ my $result = $self->write_or_return(_print_tree($self, $root), $fh);
+ # NOTE that we close STDOUT too here
+ if ($fh) {
+ Texinfo::Common::output_files_register_closed(
+ $self->output_files_information(), $encoded_output_file);
+ if (!close ($fh)) {
+ $self->document_error($self,
+ sprintf(__("error on closing %s: %s"),
+ $output_file, $!));
+ return undef;
+ }
+ }
+ return $result;
}
sub convert($$)
diff --git a/tp/TODO b/tp/TODO
index fbc3b5878a..fe6c2fe554 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -20,15 +20,75 @@ Before next release
for @example args, use *-user as class?
-byte encoding, check how used, check XS parser?
-l 3226 ParserNonXS.pm
- unshift @{$self->{'input'}}, {
- 'name' => $file,
+bytes. To check that they can never be upgraded + document
+* texi2any.pl
+ @input_files = @ARGV
+ $input_file_arg
+ @include_dirs, 'INCLUDE_DIRECTORIES'
+ @css_files, CSS_FILES
+ MACRO_EXPAND
+ INTERNAL_LINKS
-bytes: (global_information)
-$self->{'info'}->{'input_file_name'}
-$self->{'info'}->{'input_directory'}
+* ParserNonXS.pm
+ l 3226 ParserNonXS.pm
+ unshift @{$self->{'input'}}, {
+ 'name' => $file,
+ $self->{'info'}->{'input_file_name'}
+ $self->{'info'}->{'input_directory'}
+* XS Parser?
+
+
+check with latin1
+CPP directive with encoded characters, UTF8 Texinfo manual
+./texi2any.pl -I ./t/include/ ./t/input_files/cpp_lines.texi
+accentêd:7: warning: làng is not a valid language code
+The file is UTF-8 encoded, the @documentencoding is obeyed which leads
+to an incorrect encoding, in the Parser, to UTF-8, and not to the latin1
+encoding which should be used for the output messages encoding.
+This output is by (Gavin) design.
+
+Tests more interesting in non utf8 locale
+./texi2any.pl --set TEXINFO_OUTPUT_FORMAT=debugtree --set USE_NODES=0 -o
résultat/encodé.txt ./t/input_files/simplest_no_node_section.texi
+
+./texi2any.pl -o encodé/ ./t/input_files/simplest.texi
+
++ need to have file names/file content encoded in the non utf8 locale
+test of non ascii included file name in utf8 locale is already in formatting:
+formatting/osé.texi:@include included_akçentêd.texi
+But the test needs also to be done in non utf8 locale
+./texi2any.pl include_acc.texi
+
+CPP line directive with accented characters already in tests:
+./t/input_files/cpp_lines.texi
+But the test needs also to be done in non utf8 locale (still TODO for XS
Parser)
+./texi2any.pl cpp_line_latin1.texi
+
+Add tests even if not as interesting in UTF8 locale as in non UTF8
+./texi2any.pl --set TEXINFO_OUTPUT_FORMAT=debugtree --set USE_NODES=0 -o
résultat/encodé.txt ./t/input_files/simplest_no_node_section.texi
+
+./texi2any.pl -o encodé/ ./t/input_files/simplest.texi
+
+./texi2any.pl -o encodé/assé.info ./t/input_files/simplest.texi
+
+test l2h with non ascii file names
+
+
+Should we warn if output is on STDOUT and OUTPUT_ENCODING_NAME !=
MESSAGE_OUTPUT_ENCODING_NAME?
+
+
+Check Archive::Zip/EPUB_CREATE_CONTAINER in epub with non ascii
+
+
+Document bytes in input:
+create_destination_directory
+output_files_register_closed
+output_files_open_out
+locate_include_file (also in output)
+
+
+Test of init/highlight_syntax.pm with non ascii characters in highlighted
+@example contents.
Bugs
====
@@ -66,7 +126,7 @@ Tree documentation in ParserNonXS.pm
replaced, elided, elided_block types.
'extra'->'file' in replaced @include.
-extra->'comment_at_end' and extra->'spaces_after_argument'
+extra->'comment_at_end' and extra->'spaces_after_argument'
likely in many line commands
'extra'->'isindex' for nodes.
@@ -160,7 +220,7 @@ Not sure it is a big deal. An example in
sectioning/at_commands_in_refs.
warn when a @noindent/@indent appears within a paragraph.
-in info_tests/error_in_footnote there is an error message for each
+in info_tests/error_in_footnote there is an error message for each
listoffloats; Line numbers are right, though, so maybe this is not
an issue.
@@ -238,9 +298,9 @@ Automatic generation of node names from section names. To
be protected:
In Info
Nodes:
-* in every case
+* in every case
( at the beginning
-* in Node line
+* in Node line
commas
* In menu entry and *Note
* if there is a label
@@ -321,19 +381,19 @@ correspond to the role in the document rather than to the
formatting style.
Interrogations and remarks
==========================
-Should more Converter ignore the last new line (with type
+Should more Converter ignore the last new line (with type
last_raw_newline) of a raw block format?
There is no forward looking code anymore, so maybe a lex/yacc parser
-could be used for the main loop. More simply, a binary tokenizer, at
+could be used for the main loop. More simply, a binary tokenizer, at
least, could make for a notable speedup.
def/end_of_lines_protected_in_footnote.pl the footnote is
(1) -- category: deffn_name arguments arg2 more args with end of line
-and not
+and not
(1)
-- category: deffn_name arguments arg2 more args with end of line
-It happens this way because the paragraph starts right after the footnote
+It happens this way because the paragraph starts right after the footnote
number.
in HTML, the argument of a quotation is ignored if the quotation is empty,
@@ -343,7 +403,7 @@ as in
Is it really a bug?
In @copying things like some raw formats may be expanded. However it is
-not clear that it should be the same than in the main converter. Maybe a
+not clear that it should be the same than in the main converter. Maybe a
specific list of formats could be passed to Convert::Text::convert, which
would be different (for example Info and Plaintext even if converting HTML).
This requires a test, to begin with.
@@ -381,21 +441,21 @@ The @FIGURE @macro is, for html:
Add @value to the corresponding commands categories?
-Use of specialized synopsis in DocBook is not a priority and it is not even
+Use of specialized synopsis in DocBook is not a priority and it is not even
obvious that it is interesting to do so. The following notes explain the
possibilities and issues extensively.
-Instead of synopsis it might seem to be relevant to use specialized synopsis,
-funcsynopsis/funcprototype for deftype* and some def*, and other for object
+Instead of synopsis it might seem to be relevant to use specialized synopsis,
+funcsynopsis/funcprototype for deftype* and some def*, and other for object
oriented. There are many issues such that this possibility do not appear
appealing at all.
-1) there is no possibility to have a category. So the category must be
+1) there is no possibility to have a category. So the category must be
added somewhere as a role= or in the *synopsisinfo, or this should only
be used for specialized @def, like @defun.
2) @defmethod and @deftypemethod cannot really be mapped to methodsynopsis
- as the class name is not associated with the method as in Texinfo, but
+ as the class name is not associated with the method as in Texinfo, but
instead the method should be in a class in docbook.
3) From the docbook reference for funcsynopsis
@@ -411,7 +471,7 @@ appealing at all.
See also the mails from Per Bothner bug-texinfo, Sun, 22 Jul 2012 01:45:54.
specialized @def, without a need for category:
-@defun and @deftypefun
+@defun and @deftypefun
<funcsynopsis><funcprototype><funcdef>TYPE
<function>NAME</function><paramdef><parameter>args</parameter></paramdef></funcprototype></funcsynopsis>
specialized @def, without a need for category, but without DocBook synopsis
@@ -422,7 +482,7 @@ is not available
is not available
Generic @def with a need for a category
-For deffn deftypefn (and defmac?, defspec?), the possibilities of
+For deffn deftypefn (and defmac?, defspec?), the possibilities of
funcsynopsis, with a category added could be used:
<funcsynopsis><funcprototype><funcdef role=...>TYPE
<function>NAME</function></funcdef><paramdef>PARAMTYPE
<parameter>PARAM</parameter></paramdef></funcprototype></funcsynopsis>
@@ -435,7 +495,7 @@ is not available
defcv, deftypecv: fieldsynopsis cannot be used since the class
is not available
-Remaining @def without DocBook synopsis because there is no equivalent,
+Remaining @def without DocBook synopsis because there is no equivalent,
and requires a category
defvr (defvar, defopt), deftypevr (deftypevar)
deftp
@@ -445,7 +505,7 @@ deftp
Missing test outputs as files in t/
===================================
-output files split (node or not split) could be interesting +texi2html
+output files split (node or not split) could be interesting +texi2html
style for some tests. However, the test suite is already too long to
run so such additions should be done with caution.
@@ -457,7 +517,7 @@ t/30sectioning.t
character_and_spaces_in_refs
character_and_spaces_in_node
some_at_commands_in_ref_nodes
- at_commands_in_refs
+ at_commands_in_refs
character_and_spaces_in_refs <- mono/chapter
rec_nodes (with USE_NODES and without)
loop_nodes?
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 195af8e1a5..3ae8602fc5 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -320,8 +320,10 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename,
$document_name) = $self->determine_files_and_directory();
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
if ($self->get_conf('USE_NODES')) {
@@ -345,24 +347,32 @@ sub output($$)
my $output = '';
if (!$tree_units or
!defined($tree_units->[0]->{'structure'}->{'unit_filename'})) {
# no page
- my $outfile;
+ my $outfile_name;
+ my $encoded_outfile_name;
if ($output_file ne '') {
if ($self->get_conf('SPLIT')) {
- $outfile = $self->top_node_filename($document_name);
+ my $top_node_file_name = $self->top_node_filename($document_name);
if (defined($created_directory) and $created_directory ne '') {
- $outfile = File::Spec->catfile($created_directory, $outfile);
+ $outfile_name = File::Spec->catfile($created_directory,
+ $top_node_file_name);
+ } else {
+ $outfile_name = $top_node_file_name;
}
} else {
- $outfile = $output_file;
+ $outfile_name = $output_file;
}
- print STDERR "DO No pages, output in $outfile\n"
+ print STDERR "DO No pages, output in $outfile_name\n"
if ($self->get_conf('DEBUG'));
+ my $path_encoding;
+ ($encoded_outfile_name, $path_encoding)
+ = $self->encoded_file_name($outfile_name);
$fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $outfile);
+ $self->output_files_information(), $self,
+ $encoded_outfile_name);
if (!$fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
- $outfile, $!));
+ $outfile_name, $!));
return undef;
}
} else {
@@ -387,13 +397,14 @@ sub output($$)
$output .= $self->write_or_return($self->convert($root), $fh);
}
# NOTE do not close STDOUT now to avoid a perl warning.
- if ($fh and $outfile ne '-') {
+ # FIXME is it still true that there is such a warning?
+ if ($fh and $outfile_name ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $outfile);
+ $self->output_files_information(), $encoded_outfile_name);
if (!close($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
- $outfile, $!));
+ $outfile_name, $!));
}
}
return $output if ($output_file eq '');
@@ -527,6 +538,10 @@ sub determine_files_and_directory($;$)
# determine input file base name
my $input_basefile;
if (defined($self->{'parser_info'}->{'input_file_name'})) {
+ # 'input_file_name' is not decoded, as it is derived from input
+ # file which is not decoded either. We want to return only
+ # decoded character strings such that they can easily be mixed
+ # with other character strings, so we decode here.
my $input_file_name = $self->{'parser_info'}->{'input_file_name'};
my $encoding = $self->get_conf('DATA_INPUT_ENCODING_NAME');
if (defined($encoding)) {
@@ -1213,50 +1228,6 @@ sub table_item_content_tree($$$)
return $table_item_tree;
}
-# generic output method, not used anywhere.
-# FIXME remove?
-sub output_no_split($$)
-{
- my $self = shift;
- my $root = shift;
-
- my ($output_file, $destination_directory) =
$self->determine_files_and_directory();
- my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
- return undef unless $succeeded;
-
- my $fh;
- if (! $output_file eq '') {
- $fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self,
- $output_file);
- if (!$fh) {
- $self->document_error($self,
- sprintf(__("could not open %s for writing: %s"),
- $output_file, $!));
- return undef;
- }
- }
-
- my $result = '';
- if ($self->get_conf('USE_NODES')) {
- $result .= $self->convert_document_nodes($root, $fh);
- } else {
- $result .= $self->convert_document_sections($root, $fh);
- }
-
- if ($fh and $output_file ne '-') {
- Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
- if (!close ($fh)) {
- $self->document_error($self,
- sprintf(__("error on closing %s: %s"),
- $output_file, $!));
- }
- }
- return $result;
-}
-
sub convert_accents($$$;$)
{
my $self = shift;
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index c240c25a02..67dc868d2c 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -305,15 +305,22 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename)
= $self->determine_files_and_directory();
+
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
my $fh;
+ my $encoded_output_file;
if (! $output_file eq '') {
+ my $path_encoding;
+ ($encoded_output_file, $path_encoding)
+ = $self->encoded_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $output_file);
+ $encoded_output_file);
if (!$fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
@@ -480,7 +487,7 @@ sub output($$)
$result .= $self->write_or_return("</book>\n", $fh);
if ($fh and $output_file ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->output_files_information(), $encoded_output_file);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index e8f4835791..8c1ffc0b7d 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9307,8 +9307,10 @@ sub output($$)
# 'destination_directory' and 'output_filename' that are useful when split.
my ($output_file, $destination_directory, $output_filename,
$document_name) = $self->determine_files_and_directory();
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
# set for init files
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 2ec7066016..fde5be0ffb 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -18,7 +18,7 @@
# Original author: Patrice Dumas <pertusus@free.fr>
#
# This module implements abstract functions that output the IXIN format
-# using lower level formatting funtions, here adapted to lisp like
+# using lower level formatting funtions, here adapted to lisp like
# output. For other output, the output specific functions should be
# redefined. This module is not enough to output IXIN format, a module
# inheriting both from a converter module and this module is required.
@@ -50,7 +50,7 @@ sub _ixin_version($)
my %additional_setting_commands;
# FIXME pagesizes is line
-foreach my $command ('pagesizes', 'everyheading', 'everyfooting',
+foreach my $command ('pagesizes', 'everyheading', 'everyfooting',
'evenheading', 'evenfooting', 'oddheading', 'oddfooting',
'documentencoding', 'documentlanguage', 'clickstyle') {
$additional_setting_commands{$command} = 1;
@@ -61,21 +61,21 @@ foreach my $command ('pagesizes', 'everyheading',
'everyfooting',
# but are not setting commands.
my %global_misc_not_setting_commands = (
'printindex' => 1,
-);
+);
my @image_files_extensions = ('eps', 'gif', 'jpg', 'jpeg', 'pdf', 'png', 'svg',
'txt');
my %extension_mime_mapping = (
'eps' => 'application/postscript',
- 'gif' => 'image/gif',
- 'jpg' => 'image/jpeg',
+ 'gif' => 'image/gif',
+ 'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
- 'pdf' => 'application/pdf',
- 'png' => 'image/png',
+ 'pdf' => 'application/pdf',
+ 'png' => 'image/png',
'svg' => 'image/svg+xml',
'txt' => 'text/plain',
'tiff' => 'image/tiff',
- '' => 'image/unknown',
+ '' => 'image/unknown',
);
# output specific
@@ -109,7 +109,7 @@ sub _ixin_attributes($$$)
my $result = '';
if ($attributes) {
for (my $i = 0; $i < scalar(@$attributes); $i += 2) {
- if ($attribute_string_names{$name}
+ if ($attribute_string_names{$name}
and $attribute_string_names{$name}->{$attributes->[$i]}) {
$result .= '"'
.Texinfo::Convert::TexinfoSXML->protect_text($attributes->[$i+1]).'"';
@@ -207,7 +207,7 @@ sub _get_element($$)
}
}
-sub _count_bytes($$)
+sub _count_bytes($$)
{
my $self = shift;
my $string = shift;
@@ -239,9 +239,9 @@ sub _associated_node_id($$$;$)
}
}
my $associated_node_id;
- if (defined($node_command)
+ if (defined($node_command)
and defined($node_command->{'extra'}->{'normalized'})) {
- $associated_node_id
+ $associated_node_id
= $node_label_number->{$node_command->{'extra'}->{'normalized'}};
} else {
$associated_node_id = -1;
@@ -268,15 +268,22 @@ sub output_ixin($$)
my $root = shift;
my ($outfile, $destination_directory) =
$self->determine_files_and_directory();
+
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
my $fh;
+ my $encoded_output_file;
if (! $output_file eq '') {
+ my $path_encoding;
+ ($encoded_output_file, $path_encoding)
+ = $self->encoded_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $output_file);
+ $encoded_output_file);
if (!$fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
@@ -292,7 +299,7 @@ sub output_ixin($$)
my $output_file = $self->ixin_none_element('filename');
if ($output_file ne '') {
- $result .= $self->ixin_list_element('filename',
+ $result .= $self->ixin_list_element('filename',
['name', $output_file]);
}
my $lang = $self->get_conf('documentlanguage');
@@ -332,7 +339,7 @@ sub output_ixin($$)
my $tree_units = Texinfo::Structuring::split_by_node($root);
# setting_commands is for @-commands appearing before the first node,
- # while end_of_nodes_setting_commands holds, for @-commands names, the
+ # while end_of_nodes_setting_commands holds, for @-commands names, the
# last @-command element.
my %setting_commands;
my %end_of_nodes_setting_commands;
@@ -774,10 +781,10 @@ sub output_ixin($$)
# already determined from listoffloats
if (!defined($floats_information{$type}->{'type'})) {
my $command = $self->{'floats'}->{$type}->[0];
- if ($command->{'extra'}->{'type'}
+ if ($command->{'extra'}->{'type'}
and $command->{'extra'}->{'type'}->{'content'}) {
- $floats_information{$type}->{'type'}
- = $self->convert_tree({'contents'
+ $floats_information{$type}->{'type'}
+ = $self->convert_tree({'contents'
=> $command->{'extra'}->{'type'}->{'content'}});
}
}
@@ -794,7 +801,7 @@ sub output_ixin($$)
if ($floats_information{$type}->{'node_id'}) {
foreach my $associated_node_id
(@{$floats_information{$type}->{'node_id'}}) {
$floats_index .= ' ';
- $floats_index .= $self->ixin_list_element('floatindexnode',
+ $floats_index .= $self->ixin_list_element('floatindexnode',
['nodeid', $associated_node_id]);
}
}
@@ -805,7 +812,6 @@ sub output_ixin($$)
if ($floats_index ne '') {
$floats_index = $self->ixin_open_element('floatsindex', ['floatsindexlen',
$self->_count_bytes($floats_text)])
-
.$floats_index .$self->ixin_close_element('floatsindex');
} else {
$floats_index = $self->ixin_none_element('floatsindex');
@@ -866,7 +872,7 @@ sub output_ixin($$)
} else {
$mime_type = $extension_mime_mapping{''};
}
- $blobs_index .= $self->ixin_element('blobentry',
+ $blobs_index .= $self->ixin_element('blobentry',
['bloblen', $blob_len, 'encoding', 'base64',
'mimetype', $mime_type, 'filename', $file_name_text]) ."\n";
}
@@ -875,12 +881,12 @@ sub output_ixin($$)
#print STDERR "$basefile\n";
}
}
- $blobs_index = $self->ixin_open_element('blobsindex',
+ $blobs_index = $self->ixin_open_element('blobsindex',
['count', $blob_nr])
.$blobs_index.$self->ixin_close_element('blobsindex')."\n";
my @counts_attributes = ('nodeindexlen', $self->_count_bytes($nodes_index),
- 'nodecounts', $node_nr,
+ 'nodecounts', $node_nr,
'sectioningtreelen', $self->_count_bytes($sectioning_tree),
'labelslen', $self->_count_bytes($labels_text),
'blobsindexlen', $self->_count_bytes($blobs_index));
@@ -905,7 +911,7 @@ sub output_ixin($$)
if ($fh and $output_file ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->output_files_information(), $encoded_output_file);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 7d0be98af3..5ea46e192d 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -156,8 +156,7 @@ sub output($)
$close_error = $!;
}
if ($out_file_nr == 1) {
- Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->_register_closed_info_file($output_file);
if (defined($close_error)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
@@ -184,9 +183,7 @@ sub output($)
$complete_header_bytes];
#print STDERR join(' --> ', @{$indirect_files[-1]}) ."\n";
} else {
- Texinfo::Common::output_files_register_closed(
- $self->output_files_information(),
- $output_file.'-'.$out_file_nr);
+ $self->_register_closed_info_file($output_file.'-'.$out_file_nr);
if (defined($close_error)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
@@ -215,8 +212,7 @@ sub output($)
}
my $tag_text = '';
if ($out_file_nr > 1) {
- Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file.'-'.$out_file_nr);
+ $self->_register_closed_info_file($output_file.'-'.$out_file_nr);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
@@ -280,8 +276,7 @@ sub output($)
# reopened after closing STDOUT. So closing STDOUT is handled by the
# caller.
unless ($output_file eq '-') {
- Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->_register_closed_info_file($output_file);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
@@ -301,9 +296,12 @@ sub _open_info_file($$)
{
my $self = shift;
my $filename = shift;
+
+ my ($encoded_filename, $path_encoding)
+ = $self->encoded_file_name($filename);
my $fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $filename, 'use_binmode');
+ $encoded_filename, 'use_binmode');
if (!$fh) {
$self->document_error($self, sprintf(
@@ -314,6 +312,18 @@ sub _open_info_file($$)
return $fh;
}
+sub _register_closed_info_file($$)
+{
+ my $self = shift;
+ my $filename = shift;
+
+ my ($encoded_filename, $path_encoding)
+ = $self->encoded_file_name($filename);
+
+ Texinfo::Common::output_files_register_closed(
+ $self->output_files_information(), $encoded_filename)
+}
+
sub _info_header($$$)
{
my $self = shift;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 0e1bf16fb3..56373db3c0 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -914,15 +914,22 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename)
= $self->determine_files_and_directory();
+
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
my $fh;
+ my $encoded_output_file;
if (! $output_file eq '') {
+ my $path_encoding;
+ ($encoded_output_file, $path_encoding)
+ = $self->encoded_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $output_file);
+ $encoded_output_file);
if (!$fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
@@ -979,7 +986,7 @@ sub output($$)
#print STDERR "OUTPUT fh:$fh|F:$output_file|$result";
if ($fh and $output_file ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->output_files_information(), $encoded_output_file);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index 8d1ebda082..d00e8ecf65 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -427,16 +427,23 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename)
= $self->determine_files_and_directory();
+
+ my ($encoded_destination_directory, $dir_encoding)
+ = $self->encoded_file_name($destination_directory);
my ($succeeded, $created_directory)
- = $self->create_destination_directory($destination_directory);
+ = $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
my $fh;
+ my $encoded_output_file;
if (! $output_file eq '') {
+ my $path_encoding;
+ ($encoded_output_file, $path_encoding)
+ = $self->encoded_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
- $output_file);
+ $encoded_output_file);
if (!$fh) {
$self->document_error($self,
sprintf(__("could not open %s for writing: %s"),
@@ -456,7 +463,7 @@ sub output($$)
$result .= $self->write_or_return($self->close_element('texinfo')."\n", $fh);
if ($fh and $output_file ne '-') {
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $output_file);
+ $self->output_files_information(), $encoded_output_file);
if (!close ($fh)) {
$self->document_error($self,
sprintf(__("error on closing %s: %s"),
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 8dab645a9f..e5992642ff 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -214,16 +214,19 @@ sub chm_init($)
$outdir = File::Spec->curdir() if ($outdir eq '');
my $hhk_filename = $document_name . ".hhk";
- my $hhk_file = File::Spec->catfile($outdir, $hhk_filename);
+ my $hhk_file_path_name = File::Spec->catfile($outdir, $hhk_filename);
+ my ($encoded_hhk_file_path_name, $hhk_path_encoding)
+ = $self->encoded_file_name($hhk_file_path_name);
my $hhk_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $hhk_file);
+ $self->output_files_information(), $self,
+ $encoded_hhk_file_path_name);
if (!defined($hhk_fh)) {
$self->document_error($self,
sprintf(__("chm.pm: could not open %s for writing: %s\n"),
- $hhk_file, $!));
+ $hhk_file_path_name, $!));
return 0;
}
- print STDERR "# writing HTML Help index in $hhk_file...\n"
+ print STDERR "# writing HTML Help index in $hhk_file_path_name...\n"
if ($self->get_conf('VERBOSE'));
print $hhk_fh "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n<HTML>\n";
print $hhk_fh "<HEAD>\n<meta name=\"GENERATOR\" content=\""
@@ -252,27 +255,30 @@ sub chm_init($)
}
print $hhk_fh "</BODY>\n</HTML>\n";
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $hhk_file);
+ $self->output_files_information(), $encoded_hhk_file_path_name);
if (!close ($hhk_fh)) {
$self->document_error($self,
sprintf(__("chm.pm: error on closing %s: %s"),
- $hhk_file, $!));
+ $hhk_file_path_name, $!));
return 0;
}
my $hhc_filename = $document_name . ".hhc";
- my $hhc_file = File::Spec->catfile($outdir, $hhc_filename);
+ my $hhc_file_path_name = File::Spec->catfile($outdir, $hhc_filename);
+ my ($encoded_hhc_file_path_name, $hhc_path_encoding)
+ = $self->encoded_file_name($hhc_file_path_name);
my $hhc_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $hhc_file);
+ $self->output_files_information(), $self,
+ $encoded_hhc_file_path_name);
# Not sure $! is still valid
if (!defined($hhc_fh)) {
$self->document_error($self,
sprintf(__("chm.pm: could not open %s for writing: %s\n"),
- $hhc_file, $!));
+ $hhc_file_path_name, $!));
return 0;
}
- print STDERR "# writing HTML Help project in $hhc_file...\n"
+ print STDERR "# writing HTML Help project in $hhc_file_path_name...\n"
if ($self->get_conf('VERBOSE'));
print $hhc_fh "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n<HTML>\n";
@@ -327,26 +333,29 @@ sub chm_init($)
}
print $hhc_fh "</HTML>\n</BODY>\n";
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $hhc_file);
+ $self->output_files_information(), $encoded_hhc_file_path_name);
if (!close ($hhc_fh)) {
$self->document_error($self,
sprintf(__("chm.pm: error on closing %s: %s"),
- $hhc_file, $!));
+ $hhc_file_path_name, $!));
return 0;
}
my $hhp_filename = $document_name . ".hhp";
- my $hhp_file = File::Spec->catfile($outdir, $hhp_filename);
+ my $hhp_file_path_name = File::Spec->catfile($outdir, $hhp_filename);
+ my ($encoded_hhp_file_path_name, $hhp_path_encoding)
+ = $self->encoded_file_name($hhp_file_path_name);
my $hhp_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $hhp_file);
+ $self->output_files_information(), $self,
+ $encoded_hhp_file_path_name);
# Not sure $! is still valid
if (!defined($hhp_fh)) {
$self->document_error(
$self, sprintf(__("chm.pm: could not open %s for writing: %s\n"),
- $hhp_file, $!));
+ $hhp_file_path_name, $!));
return 0;
}
- print STDERR "# writing HTML Help project in $hhp_file...\n"
+ print STDERR "# writing HTML Help project in $hhp_file_path_name...\n"
if ($self->get_conf('VERBOSE'));
my $language = $chm_languages{'en'};
my $documentlanguage = $self->get_conf('documentlanguage');
@@ -391,11 +400,11 @@ EOT
}
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $hhp_file);
+ $self->output_files_information(), $encoded_hhp_file_path_name);
if (!close ($hhp_fh)) {
$self->document_error($self,
sprintf(__("chm.pm: error on closing %s: %s"),
- $hhp_file, $!));
+ $hhp_file_path_name, $!));
return 0;
}
diff --git a/tp/init/epub3.pm b/tp/init/epub3.pm
index 2d850f1991..f23c02f032 100644
--- a/tp/init/epub3.pm
+++ b/tp/init/epub3.pm
@@ -347,15 +347,17 @@ sub epub_finish($$)
$meta_inf_directory, $!));
return 0;
}
- my $container_file = File::Spec->catfile($meta_inf_directory,
+ my $container_file_path_name = File::Spec->catfile($meta_inf_directory,
'container.xml');
+ my ($encoded_container_file_path_name, $container_path_encoding)
+ = $self->encoded_file_name($container_file_path_name);
my $container_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $container_file,
- undef, 'utf-8');
+ $self->output_files_information(), $self,
+ $encoded_container_file_path_name, undef, 'utf-8');
if (!defined($container_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
- $container_file, $!));
+ $container_file_path_name, $!));
return 0;
}
my $document_name = $self->get_info('document_name');
@@ -371,49 +373,53 @@ sub epub_finish($$)
EOT
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $container_file);
+ $self->output_files_information(), $encoded_container_file_path_name);
if (!close ($container_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: error on closing %s: %s"),
- $container_file, $!));
+ $container_file_path_name, $!));
return 0;
}
my $mimetype_filename = 'mimetype';
- my $mimetype_file = File::Spec->catfile($epub_destination_directory,
- $mimetype_filename);
+ my $mimetype_file_path_name =
File::Spec->catfile($epub_destination_directory,
+ $mimetype_filename);
+ my ($encoded_mimetype_file_path_name, $mimetype_path_encoding)
+ = $self->encoded_file_name($mimetype_file_path_name);
my $mimetype_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $mimetype_file,
- undef, 'utf-8');
+ $self->output_files_information(), $self,
+ $encoded_mimetype_file_path_name, undef, 'utf-8');
if (!defined($mimetype_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
- $mimetype_file, $!));
+ $mimetype_file_path_name, $!));
return 0;
}
print $mimetype_fh 'application/epub+zip'."\n";
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $mimetype_file);
+ $self->output_files_information(), $encoded_mimetype_file_path_name);
if (!close ($mimetype_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: error on closing %s: %s"),
- $mimetype_file, $!));
+ $mimetype_file_path_name, $!));
return 0;
}
my $nav_id = 'nav';
- my $nav_file;
+ my $nav_file_path_name;
my $title = _epub_convert_tree_to_text($self, $self->get_info('title_tree'));
if ($self->{'structuring'} and $self->{'structuring'}->{'sectioning_root'}) {
- $nav_file = File::Spec->catfile($epub_document_destination_directory,
- $nav_filename);
+ $nav_file_path_name
+ = File::Spec->catfile($epub_document_destination_directory,
$nav_filename);
+ my ($encoded_nav_file_path_name, $nav_path_encoding)
+ = $self->encoded_file_name($nav_file_path_name);
my $nav_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $nav_file,
- undef, 'utf-8');
+ $self->output_files_information(), $self,
+ $encoded_nav_file_path_name, undef, 'utf-8');
if (!defined($nav_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
- $nav_file, $!));
+ $nav_file_path_name, $!));
return 0;
}
my $table_of_content_str = _epub_convert_tree_to_text($self,
@@ -488,11 +494,11 @@ EOT
print $nav_fh '</body>'."\n".'</html>'."\n";
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $nav_file);
+ $self->output_files_information(), $encoded_nav_file_path_name);
if (!close ($nav_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: error on closing %s: %s"),
- $nav_file, $!));
+ $nav_file_path_name, $!));
return 0;
}
}
@@ -504,15 +510,17 @@ EOT
# also to discuss
# <meta property="dcterms:modified">2012-03-05T12:47:00Z</meta>
# also <dc:rights>
- my $opf_file = File::Spec->catfile($epub_destination_directory,
+ my $opf_file_path_name = File::Spec->catfile($epub_destination_directory,
$epub_document_dir_name,
$opf_filename);
+ my ($encoded_opf_file_path_name, $opf_path_encoding)
+ = $self->encoded_file_name($opf_file_path_name);
my $opf_fh = Texinfo::Common::output_files_open_out(
- $self->output_files_information(), $self, $opf_file,
- undef, 'utf-8');
+ $self->output_files_information(), $self,
+ $encoded_opf_file_path_name, undef, 'utf-8');
if (!defined($opf_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: could not open %s for writing: %s\n"),
- $opf_file, $!));
+ $opf_file_path_name, $!));
return 0;
}
print $opf_fh <<EOT;
@@ -559,7 +567,7 @@ EOT
<manifest>
EOT
- if (defined($nav_file)) {
+ if (defined($nav_file_path_name)) {
print $opf_fh " <item id=\"$nav_id\" properties=\"nav\" "
. "media-type=\"application/xhtml+xml\"
href=\"${epub_xhtml_dir}/${nav_filename}\"/>\n";
}
@@ -631,7 +639,7 @@ EOT
EOT
# To put the nav file as part of the document
- #if (defined($nav_file)) {
+ #if (defined($nav_file_path_name)) {
# print $opf_fh " <itemref idref=\"${nav_id}\"/>\n";
#}
$id_count = 0;
@@ -657,11 +665,11 @@ EOT
EOT
Texinfo::Common::output_files_register_closed(
- $self->output_files_information(), $opf_file);
+ $self->output_files_information(), $encoded_opf_file_path_name);
if (!close ($opf_fh)) {
$self->document_error($self,
sprintf(__("epub3.pm: error on closing %s: %s"),
- $opf_file, $!));
+ $opf_file_path_name, $!));
return 0;
}
@@ -669,7 +677,7 @@ EOT
require Archive::Zip;
my $zip = Archive::Zip->new();
- $zip->addFile($mimetype_file, $mimetype_filename);
+ $zip->addFile($mimetype_file_path_name, $mimetype_filename);
$zip->addTree($meta_inf_directory, $meta_inf_directory_name);
$zip->addTree(File::Spec->catdir($epub_destination_directory,
$epub_document_dir_name),
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 638e0903b6..33549ce82f 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -59,7 +59,7 @@ sub highlight_open_inline_container_type($$$)
}
-# the end of a string were randomly generated once for all.
+# the end of the string was randomly generated once for all.
my $range_separator = '_______________________________________ highlight
texinfo _GT Haib0aik zei4YieH';
my %languages = ();
@@ -149,7 +149,9 @@ sub highlight_process($$)
my @highlighted_commands = ('example');
- my $collected_commands =
Texinfo::Common::collect_commands_in_tree($document_root,
\@highlighted_commands);
+ my $collected_commands
+ = Texinfo::Common::collect_commands_in_tree($document_root,
+ \@highlighted_commands);
foreach my $cmdname (@highlighted_commands) {
if (scalar(@{$collected_commands->{$cmdname}}) > 0) {
foreach my $element (@{$collected_commands->{$cmdname}}) {
@@ -178,18 +180,19 @@ sub highlight_process($$)
my $language_base = ${highlight_basename} . "_${language}";
$languages{$language}->{'basefile'} = $language_base . "_input.$suffix";
$languages{$language}->{'html_file'} = $language_base . '_output.html';
- $languages{$language}->{'rfile'} = File::Spec->catfile($highlight_out_dir,
+ my $input_language_path_name = File::Spec->catfile($highlight_out_dir,
$languages{$language}->{'basefile'});
- $languages{$language}->{'r_html_file'} =
File::Spec->catfile($highlight_out_dir,
+ my $html_result_path_name = File::Spec->catfile($highlight_out_dir,
$languages{$language}->{'html_file'});
# expand @example texts in an input file for highlight source
# program
- my $rfile = $languages{$language}->{'rfile'};
- unless (open (HIGHLIGHT_LANG_IN, ">$rfile")) {
+ my ($encoded_input_language_path_name, $input_language_path_encoding)
+ = $self->encoded_file_name($input_language_path_name);
+ unless (open (HIGHLIGHT_LANG_IN, ">$encoded_input_language_path_name")) {
$self->document_warn($self,
sprintf(__("highlight_syntax.pm: could not open %s: %s"),
- $rfile, $!));
+ $input_language_path_name, $!));
return 0;
}
@@ -230,15 +233,22 @@ sub highlight_process($$)
# call source highlighting program
my $version_option='';
$version_option='--gen-version ' if ($self->get_conf('TEST'));
- my $html_result_file = $languages{$language}->{'r_html_file'};
my @option_line_ranges = ();
foreach my $line_range (@{$languages{$language}->{'line_ranges'}}) {
push @option_line_ranges, '"'.$line_range->[0].'-'.$line_range->[1].'"';
}
my $option_line_range_str = join(',', @option_line_ranges);
- my $cmd = "source-highlight ${version_option}--src-lang=$language
--out-format=html5 -i '$rfile' -o '$html_result_file'
--line-range=$option_line_range_str --range-separator='$range_separator'";
+ my $cmd = "source-highlight ${version_option}--src-lang=$language
--out-format=html5 -i '$input_language_path_name' -o '$html_result_path_name'
--line-range=$option_line_range_str --range-separator='$range_separator'";
- if (system($cmd)) {
+ # FIXME do not know what would be better here
+ my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoded_cmd;
+ if (defined($encoding)) {
+ $encoded_cmd = encode($encoding, $cmd);
+ } else {
+ $encoded_cmd = $cmd;
+ }
+ if (system($encoded_cmd)) {
$self->document_error($self,
sprintf(__("highlight_syntax.pm: command did not succeed: %s"),
$cmd));
@@ -247,10 +257,12 @@ sub highlight_process($$)
my $language_fragments_nr = $languages{$language}->{'counter'};
# extract highlighted fragments
- unless (open (HIGHLIGHT_LANG_OUT, $html_result_file)) {
+ my ($encoded_html_result_path_name, $html_result_path_encoding)
+ = $self->encoded_file_name($html_result_path_name);
+ unless (open (HIGHLIGHT_LANG_OUT, $encoded_html_result_path_name)) {
$self->document_warn($self,
sprintf(__("highlight_syntax.pm: could not open %s: %s"),
- $html_result_file, $!));
+ $html_result_path_name, $!));
return 0;
}
my $got_count = 0;
@@ -258,7 +270,7 @@ sub highlight_process($$)
my $text;
my $separators_count = 0;
while ($line = <HIGHLIGHT_LANG_OUT>) {
- #print STDERR "$html_result_file: while $line";
+ #print STDERR "$encoded_html_result_path_name: while $line";
if ($line =~ /$range_separator/) {
$separators_count++;
if (defined($text)) {
@@ -281,7 +293,7 @@ sub highlight_process($$)
}
if ($separators_count != $language_fragments_nr +1) {
$self->document_warn($self, sprintf(__(
- "highlight_syntax.pm: %s: %d separators; expected %d, the number of
fragments +1"),
+ "highlight_syntax.pm: %s: %d separators; expected %d, the number of
fragments +1"),
$language, $separators_count,
$language_fragments_nr+1));
}
if (defined($text) and $text ne '') {
@@ -315,7 +327,7 @@ sub highlight_preformatted_command($$$$$)
and defined($commands{$cmdname}->{'results'}->{$command})) {
if (not defined($language)) {
$self->document_warn($self, sprintf(__(
- "highlight_syntax.pm: output has HTML item for \@%s but
no language %s"),
+ "highlight_syntax.pm: output has HTML item for \@%s but no language
%s"),
$cmdname, $command));
} else {
diff --git a/tp/init/latex2html.pm b/tp/init/latex2html.pm
index 36328905d9..8bd03efa64 100644
--- a/tp/init/latex2html.pm
+++ b/tp/init/latex2html.pm
@@ -31,6 +31,8 @@ use Cwd;
use File::Copy;
use File::Spec;
+use Encode qw(encode);
+
# also for __(
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
@@ -78,7 +80,8 @@ texinfo_set_from_init_file('L2H_CLEAN', 1);
# init l2h defaults for files and names
-my ($l2h_name, $l2h_latex_file, $l2h_cache_file, $l2h_html_file, $l2h_prefix);
+my ($l2h_name, $l2h_latex_path_name, $l2h_cache_path_name, $l2h_html_path_name,
+ $l2h_prefix);
# holds the status of latex2html operations. If 0 it means that there was
# an error
@@ -181,27 +184,27 @@ sub l2h_process($$)
($docu_volume, $docu_directories, $no_file)
= File::Spec->splitpath($docu_rdir, 1);
$l2h_name = "${docu_name}_l2h";
- $l2h_latex_file = File::Spec->catpath($docu_volume, $docu_directories,
- "${l2h_name}.tex");
- $l2h_cache_file = File::Spec->catpath($docu_volume, $docu_directories,
+ $l2h_latex_path_name = File::Spec->catpath($docu_volume, $docu_directories,
+ "${l2h_name}.tex");
+ $l2h_cache_path_name = File::Spec->catpath($docu_volume, $docu_directories,
"${docu_name}-l2h_cache.pm");
# destination dir -- generated images are put there, should be the same
# as dir of enclosing html document --
- $l2h_html_file = File::Spec->catpath($docu_volume, $docu_directories,
+ $l2h_html_path_name = File::Spec->catpath($docu_volume, $docu_directories,
"${l2h_name}.html");
$l2h_prefix = "${l2h_name}_";
$debug = $self->get_conf('DEBUG');
$verbose = $self->get_conf('VERBOSE');
unless ($self->get_conf('L2H_SKIP')) {
- unless (open(L2H_LATEX, ">$l2h_latex_file")) {
+ unless (open(L2H_LATEX, ">$l2h_latex_path_name")) {
$self->document_error($self, sprintf(__(
"l2h: could not open latex file %s for writing: %s"),
- $l2h_latex_file, $!));
+ $l2h_latex_path_name, $!));
$status = 0;
return;
}
- warn "# l2h: use ${l2h_latex_file} as latex file\n" if ($verbose);
+ warn "# l2h: use ${l2h_latex_path_name} as latex file\n" if ($verbose);
print L2H_LATEX $l2h_latex_preamble;
}
# open the database that holds cached text
@@ -273,7 +276,7 @@ sub l2h_to_latex($$$$)
$latex_count++;
$count = $latex_count;
# try whether we can get it from cache
- my $cached_text = l2h_from_cache($text);
+ my $cached_text = l2h_from_cache($self, $text);
if (defined($cached_text)) {
$cached_count++;
# put the cached result in the html result array
@@ -320,8 +323,8 @@ sub l2h_finish_to_latex($)
###################################
# Use latex2html to generate corresponding html code and images
#
-# to_html([$l2h_latex_file, [$l2h_html_dir]]):
-# Call latex2html on $l2h_latex_file
+# to_html():
+# Call latex2html on $l2h_latex_path_name
# Put images (prefixed with $l2h_name."_") and html file(s) in $l2h_html_dir
# Return 1, on success
# 0, otherwise
@@ -360,9 +363,11 @@ sub l2h_to_html($)
$call = $latex2html_command;
# use init file, if specified
my $init_file = $self->get_conf('L2H_FILE');
+ my ($encoded_init_file, $init_path_encoding)
+ = $self->encoded_file_name($init_file);
$call .= " -init_file " . $init_file
if (defined($init_file) and $init_file ne ''
- and -f $init_file and -r $init_file);
+ and -f $encoded_init_file and -r $encoded_init_file);
# set output dir
$call .= (($docu_rdir ne '') ? " -dir $docu_rdir" : " -no_subdir");
# use l2h_tmp, if specified
@@ -375,10 +380,18 @@ sub l2h_to_html($)
and $self->get_conf('L2H_HTML_VERSION') ne '');
# options we want to be sure of
$call .= " -address 0 -info 0 -split 0 -no_navigation -no_auto_link";
- $call .= " -prefix $l2h_prefix $l2h_latex_file";
+ $call .= " -prefix $l2h_prefix $l2h_latex_path_name";
- warn "# l2h: executing '$call'\n" if ($verbose);
- if (system($call)) {
+ # FIXME do not know what would be better here
+ my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoded_call;
+ if (defined($encoding)) {
+ $encoded_call = encode($encoding, $call);
+ } else {
+ $encoded_call = $call;
+ }
+ warn "# l2h: executing '$encoded_call'\n" if ($verbose);
+ if (system($encoded_call)) {
$self->document_error($self,
sprintf(__("l2h: command did not succeed: %s"),
$call));
@@ -392,7 +405,7 @@ sub l2h_to_html($)
##########################
# Third stage: Extract generated contents from latex2html run
# Initialize with: init_from_html
-# open $l2h_html_file for reading
+# open $l2h_html_path_name for reading
# reads in contents into array indexed by numbers
# return 1, on success -- 0, otherwise
# Finish with: finish
@@ -431,19 +444,30 @@ sub l2h_change_image_file_names($$)
"l2h: image has invalid extension: %s"), $src));
next;
}
- while (-e File::Spec->catpath($docu_volume, $docu_directories,
- "${docu_name}_${image_count}$ext")) {
+ while (1) {
+ my $image_file_name = "${docu_name}_${image_count}$ext";
+ my $image_file_path_name = File::Spec->catpath($docu_volume,
+ $docu_directories, $image_file_name);
+ my ($encoded_image_file_path_name, $image_path_encoding)
+ = $self->encoded_file_name($image_file_path_name);
+ unless (-e $encoded_image_file_path_name) {
+ last;
+ }
$image_count++;
}
my $file_src
= File::Spec->catpath($docu_volume, $docu_directories, $src);
+ my ($encoded_file_src, $src_file_encoding)
+ = $self->encoded_file_name($file_src);
$dest = "${docu_name}_${image_count}$ext";
my $file_dest
= File::Spec->catpath($docu_volume, $docu_directories, $dest);
+ my ($encoded_file_dest, $dest_file_encoding)
+ = $self->encoded_file_name($file_dest);
if ($debug) {
- copy($file_src, $file_dest);
+ copy($encoded_file_src, $encoded_file_dest);
} else {
- if (!rename($file_src, $file_dest)) {
+ if (!rename($encoded_file_src, $encoded_file_dest)) {
$self->document_warn($self,
sprintf(__("l2h: rename %s as %s failed: %s"),
$file_src, $file_dest, $!));
@@ -466,18 +490,21 @@ sub l2h_init_from_html($)
return 1;
}
- if (! open(L2H_HTML, "<$l2h_html_file")) {
+ my ($encoded_l2h_html_path_name, $l2h_html_path_encoding)
+ = $self->encoded_file_name($l2h_html_path_name);
+ if (! open(L2H_HTML, "<$encoded_l2h_html_path_name")) {
$self->document_warn($self,
sprintf(__("l2h: could not open %s: %s"),
- $l2h_html_file, $!));
+ $l2h_html_path_name, $!));
return 0;
}
- warn "# l2h: use $l2h_html_file as html file\n" if ($verbose);
+ warn "# l2h: use $l2h_html_path_name as html file\n" if ($verbose);
my $html_converted_count = 0; # number of html resulting texts
# retrieved in the file
my ($count, $h_line);
+ # FIXME encoding?
while ($h_line = <L2H_HTML>) {
if ($h_line =~ /!-- l2h_begin $l2h_name ([0-9]+) --/) {
$count = $1;
@@ -624,16 +651,18 @@ sub l2h_finish($)
# FIXME it is clear that l2h stuff takes very long compared with texi2any
# which is already quite long. However this also adds some complexity
-# I tried doing this with a dbm data base, but it did not store all
-# keys/values. Hence, I did as latex2html does it
+# It was originally tried with a dbm data base, but it did not store all
+# keys/values. Hence, do as latex2html does
sub l2h_init_cache($)
{
my $self = shift;
- if (-r $l2h_cache_file) {
- my $rdo = do "$l2h_cache_file";
+ my ($encoded_l2h_cache_path_name, $l2h_cache_path_encoding)
+ = $self->encoded_file_name($l2h_cache_path_name);
+ if (-r $encoded_l2h_cache_path_name) {
+ my $rdo = do "$encoded_l2h_cache_path_name";
$self->document_error($self,
sprintf(__("l2h: could not load %s: %s"),
- $l2h_cache_file, $@))
+ $l2h_cache_path_name, $@))
unless ($rdo);
}
}
@@ -644,14 +673,18 @@ sub l2h_store_cache($)
my $self = shift;
return unless $latex_count;
my ($key, $value);
- unless (open(FH, ">$l2h_cache_file")) {
+ my ($encoded_l2h_cache_path_name, $l2h_cache_path_encoding)
+ = $self->encoded_file_name($l2h_cache_path_name);
+ unless (open(FH, ">$encoded_l2h_cache_path_name")) {
$self->document_error($self,
sprintf(__("l2h: could not open %s for writing: %s"),
- $l2h_cache_file, $!));
+ $l2h_cache_path_name, $!));
return;
}
+ # FIXME encoding? encode to utf8 and output use utf8;?
+ # Not necessarily as l2h_cache may be populated with non decoded
+ # strings.
foreach my $key(sort(keys(%l2h_cache))) {
- #while (($key, $value) = each %l2h_cache) {
my $value = $l2h_cache{$key};
# escape stuff
$key =~ s|/|\\/|g;
@@ -671,13 +704,19 @@ sub l2h_store_cache($)
# return cached html, if it exists for text, and if all pictures
# are there, as well
-sub l2h_from_cache($)
+sub l2h_from_cache($$)
{
+ my $self = shift;
my $text = shift;
my $cached = $l2h_cache{$text};
if (defined($cached)) {
while ($cached =~ m/SRC="(.*?)"/g) {
- unless (-e File::Spec->catpath($docu_volume, $docu_directories, $1)) {
+ my $cached_image_file_name = $1;
+ my $cached_image_path_name = File::Spec->catpath($docu_volume,
+ $docu_directories, $cached_image_file_name);
+ my ($encoded_cached_image_path_name, $cached_image_path_encoding)
+ = $self->encoded_file_name($cached_image_path_name);
+ unless (-e $encoded_cached_image_path_name) {
return undef;
}
}
diff --git a/tp/init/tex4ht.pm b/tp/init/tex4ht.pm
index 449c45a2aa..cf42fb44ac 100644
--- a/tp/init/tex4ht.pm
+++ b/tp/init/tex4ht.pm
@@ -32,6 +32,9 @@
use strict;
+use Cwd;
+use Encode qw(encode);
+
# Also for __(
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
@@ -45,7 +48,6 @@ texinfo_register_command_formatting('tex', \&tex4ht_do_tex);
texinfo_register_command_formatting('displaymath', \&tex4ht_do_tex);
{
-use Cwd;
package Texinfo::TeX4HT;
@@ -131,21 +133,31 @@ sub tex4ht_prepare($$)
$formats{$format}->{'basename'} = $tex4ht_basename . "_$format";
my $suffix = '.tex';
$suffix = '.texi' if ($format eq 'texi');
- $formats{$format}->{'basefile'} = $formats{$format}->{'basename'} .
$suffix;
- $formats{$format}->{'html_file'} = $formats{$format}->{'basename'} .
'.html';
- $formats{$format}->{'rfile'} = File::Spec->catfile($tex4ht_out_dir,
- $formats{$format}->{'basefile'});
- my $rfile = $formats{$format}->{'rfile'};
+ $formats{$format}->{'basefile_name'}
+ = $formats{$format}->{'basename'} . $suffix;
+ my ($encoded_basefile_name, $basefile_name_encoding)
+ = $self->encoded_file_name($formats{$format}->{'basefile_name'});
+ $formats{$format}->{'basefile_path'} = $encoded_basefile_name;
+ $formats{$format}->{'html_basefile_name'}
+ = $formats{$format}->{'basename'} . '.html';
+ my ($encoded_html_basefile_name, $html_basefile_name_encoding)
+ = $self->encoded_file_name($formats{$format}->{'html_basefile_name'});
+ $formats{$format}->{'html_basefile_path'} = $encoded_html_basefile_name;
+
+ my $tex4ht_file_path_name = File::Spec->catfile($tex4ht_out_dir,
+ $formats{$format}->{'basefile_name'});
+ my ($encoded_tex4ht_file_path_name, $tex4ht_path_encoding)
+ = $self->encoded_file_name($tex4ht_file_path_name);
$formats{$format}->{'counter'} = 0;
$formats{$format}->{'output_counter'} = 0;
if (scalar(@{$format_collected_commands{$format}}) > 0) {
local *TEX4HT_TEXFILE;
- unless (open (*TEX4HT_TEXFILE, ">$rfile")) {
+ unless (open (*TEX4HT_TEXFILE, ">$encoded_tex4ht_file_path_name")) {
$self->document_warn($self,
sprintf(__("tex4ht.pm: could not open %s: %s"),
- $rfile, $!));
+ $tex4ht_file_path_name, $!));
return 1;
}
$formats{$format}->{'handle'} = *TEX4HT_TEXFILE;
@@ -270,8 +282,8 @@ sub tex4ht_process_format($$) {
$self->document_warn($self,
sprintf(__("tex4ht.pm: output file missing: %s"),
- $formats{$format}->{'basefile'}))
- unless (-f $formats{$format}->{'basefile'});
+ $formats{$format}->{'basefile_name'}))
+ unless (-f $formats{$format}->{'basefile_path'});
# now run tex4ht
my $options = '';
if ($format eq 'tex' and defined($Texinfo::TeX4HT::tex4ht_options_tex)) {
@@ -282,13 +294,21 @@ sub tex4ht_process_format($$) {
$options = $Texinfo::TeX4HT::tex4ht_options_texi;
}
- my $cmd = "$formats{$format}->{'exec'} $formats{$format}->{'basefile'}
$options";
- print STDERR "tex4ht command: $cmd\n" if ($self->get_conf('VERBOSE'));
+ my $cmd = "$formats{$format}->{'exec'} $formats{$format}->{'basefile_name'}
$options";
+ # FIXME do not know what would be better here
+ my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoded_cmd;
+ if (defined($encoding)) {
+ $encoded_cmd = encode($encoding, $cmd);
+ } else {
+ $encoded_cmd = $cmd;
+ }
+ print STDERR "tex4ht command: $encoded_cmd\n" if
($self->get_conf('VERBOSE'));
# do not use system in order to be sure that tex STDIN is not
# mixed up with the main script STDIN. It is important because
# if tex fails, it will read from STDIN and the input may trigger
# diverse actions by tex.
- if (not(open(TEX4HT, "|-", $cmd))) {
+ if (not(open(TEX4HT, "|-", $encoded_cmd))) {
$self->document_warn($self, sprintf(__(
"tex4ht.pm: command failed: %s"), $cmd));
return 1;
@@ -301,8 +321,9 @@ sub tex4ht_process_format($$) {
}
# extract the html from the file created by tex4ht
- my $html_basefile = $formats{$format}->{'html_file'};
- unless (open (TEX4HT_HTMLFILE, $html_basefile)) {
+ my $html_basefile = $formats{$format}->{'html_basefile_name'};
+ my $encoded_html_basefile = $formats{$format}->{'html_basefile_path'};
+ unless (open (TEX4HT_HTMLFILE, $encoded_html_basefile)) {
$self->document_warn($self,
sprintf(__("tex4ht.pm: could not open %s: %s"),
$html_basefile, $!));
@@ -310,8 +331,9 @@ sub tex4ht_process_format($$) {
}
my $got_count = 0;
my $line;
+ # FIXME decode?
while ($line = <TEX4HT_HTMLFILE>) {
- #print STDERR "$html_basefile: while $line";
+ #print STDERR "$encoded_html_basefile: while $line";
if ($line =~ /!-- tex4ht_begin $formats{$format}->{'basename'} (\w+) (\d+)
--/) {
my $command = $1;
my $count = $2;
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 3fc5a8ea49..2affebc7ac 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -853,6 +853,11 @@ Texinfo home page: http://www.gnu.org/software/texinfo/")
."\n";
return $makeinfo_help;
}
+my %non_decoded_customization_variables;
+foreach my $variable_name ('MACRO_EXPAND', 'INTERNAL_LINKS') {
+ $non_decoded_customization_variables{$variable_name} = 1;
+}
+
my $Xopt_arg_nr = 0;
my $result_options = Getopt::Long::GetOptions (
@@ -954,7 +959,12 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
"2021");
locate_and_load_init_file($_[1], [ @conf_dirs, @program_init_dirs ]);
},
'set-customization-variable|c=s' => sub {
- my $var_val = _decode_input($_[1]);
+ my $var_val;
+ if ($non_decoded_customization_variables{$_[1]}) {
+ $var_val = $_[1];
+ } else {
+ $var_val = _decode_input($_[1]);
+ }
if ($var_val =~ s/^(\w+)\s*=?\s*//) {
my $var = $1;
my $value = $var_val;
@@ -1297,6 +1307,10 @@ while(@input_files) {
my $main_configuration = Texinfo::MainConfig::new();
my $parser_information = $parser->global_information();
+ my $input_perl_encoding;
+ if (defined($parser_information->{'input_perl_encoding'})) {
+ $input_perl_encoding = $parser_information->{'input_perl_encoding'};
+ }
# encoding is needed for output files
# encoding and documentlanguage are needed for gdt() in
regenerate_master_menu
Texinfo::Common::set_output_encodings($main_configuration,
$parser_information);
@@ -1314,23 +1328,25 @@ while(@input_files) {
require Texinfo::Convert::Texinfo;
my $texinfo_text = Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
#print STDERR "$texinfo_text\n";
- my $macro_expand_file = get_conf('MACRO_EXPAND');
+ my $encoded_macro_expand_file_name = get_conf('MACRO_EXPAND');
+ my $macro_expand_file_name =
_decode_input($encoded_macro_expand_file_name);
my $macro_expand_files_information = {};
my $macro_expand_fh = Texinfo::Common::output_files_open_out(
- $macro_expand_files_information, $main_configuration,
$macro_expand_file);
+ $macro_expand_files_information, $main_configuration,
+ $encoded_macro_expand_file_name);
my $error_macro_expand_file;
if (defined($macro_expand_fh)) {
print $macro_expand_fh $texinfo_text;
Texinfo::Common::output_files_register_closed($macro_expand_files_information,
- $macro_expand_file);
+
$encoded_macro_expand_file_name);
if (!close($macro_expand_fh)) {
document_warn(sprintf(__("error on closing macro expand file %s:
%s\n"),
- $macro_expand_file, $!));
+ $macro_expand_file_name, $!));
$error_macro_expand_file = 1;
}
} else {
document_warn(sprintf(__("could not open %s for writing: %s\n"),
- $macro_expand_file, $!));
+ $macro_expand_file_name, $!));
$error_macro_expand_file = 1;
}
push @opened_files, Texinfo::Common::output_files_opened_files(
@@ -1508,25 +1524,27 @@ while(@input_files) {
= $converter->output_internal_links();
# always create a file, even if empty.
$internal_links_text = '' if (!defined($internal_links_text));
- my $internal_links_file = get_conf('INTERNAL_LINKS');
+ my $encoded_internal_links_file_name = get_conf('INTERNAL_LINKS');
+ my $internal_links_file_name
+ = _decode_input($encoded_internal_links_file_name);
my $internal_links_files_information = {};
my $internal_links_fh = Texinfo::Common::output_files_open_out(
$internal_links_files_information, $converter,
- $internal_links_file);
+ $encoded_internal_links_file_name);
my $error_internal_links_file;
if (defined ($internal_links_fh)) {
print $internal_links_fh $internal_links_text;
if (!close ($internal_links_fh)) {
warn(sprintf(__("%s: error on closing internal links file %s: %s\n"),
- $real_command_name, $internal_links_file, $!));
+ $real_command_name, $internal_links_file_name, $!));
$error_internal_links_file = 1;
}
Texinfo::Common::output_files_register_closed(
- $internal_links_files_information, $internal_links_file);
+ $internal_links_files_information,
$encoded_internal_links_file_name);
} else {
warn(sprintf(__("%s: could not open %s for writing: %s\n"),
- $real_command_name, $internal_links_file, $!));
+ $real_command_name, $internal_links_file_name, $!));
$error_internal_links_file = 1;
}
@@ -1553,7 +1571,11 @@ while(@input_files) {
$converter_element_count_file, $tree, $use_sections,
get_conf('SORT_ELEMENT_COUNT_WORDS'));
- my $sort_element_count_file = get_conf('SORT_ELEMENT_COUNT');
+ my $sort_element_count_file_name = get_conf('SORT_ELEMENT_COUNT');
+ my ($encoded_sort_element_count_file_name, $path_encoding)
+ = Texinfo::Common::encode_file_name($main_configuration,
+ $sort_element_count_file_name,
+ $input_perl_encoding);
my $sort_elem_files_information = {};
# FIXME using $converter here for the configuration is
# not right, should be changed by something not associated
@@ -1561,21 +1583,21 @@ while(@input_files) {
# is not much better
my $sort_element_count_fh = Texinfo::Common::output_files_open_out(
$sort_elem_files_information, $converter,
- $sort_element_count_file);
+ $encoded_sort_element_count_file_name);
my $error_sort_element_count_file;
if (defined ($sort_element_count_fh)) {
print $sort_element_count_fh $sort_element_count_text;
if (!close ($sort_element_count_fh)) {
warn(sprintf(__("%s: error on closing internal links file %s: %s\n"),
- $real_command_name, $sort_element_count_file, $!));
+ $real_command_name, $sort_element_count_file_name, $!));
$error_sort_element_count_file = 1;
}
Texinfo::Common::output_files_register_closed($sort_elem_files_information,
- $sort_element_count_file);
+
$encoded_sort_element_count_file_name);
} else {
warn(sprintf(__("%s: could not open %s for writing: %s\n"),
- $real_command_name, $sort_element_count_file, $!));
+ $real_command_name, $sort_element_count_file_name, $!));
$error_sort_element_count_file = 1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Encode file names when needed,
Patrice Dumas <=