[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_root_html_element_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_root_html_element_attributes_string), doc/texinfo.texi (HTML Customization Variables): add HTML_ROOT_ELEMENT_ATTRIBUTES to be able to add attributes to the <html> HTML document root element. |
Date: |
Sun, 19 Dec 2021 18:23:58 -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 59863cd * tp/Texinfo/Convert/HTML.pm
(_root_html_element_attributes_string), doc/texinfo.texi (HTML Customization
Variables): add HTML_ROOT_ELEMENT_ATTRIBUTES to be able to add attributes to
the <html> HTML document root element.
59863cd is described below
commit 59863cd9e5d3bd21ce47d7418804411763dce848
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Dec 20 00:23:49 2021 +0100
* tp/Texinfo/Convert/HTML.pm (_root_html_element_attributes_string),
doc/texinfo.texi (HTML Customization Variables): add
HTML_ROOT_ELEMENT_ATTRIBUTES to be able to add attributes
to the <html> HTML document root element.
---
ChangeLog | 7 +++++
doc/texinfo.texi | 10 +++++--
tp/Texinfo/Common.pm | 1 +
tp/Texinfo/Convert/HTML.pm | 33 +++++++++++++++-------
tp/tests/layout/list-of-tests | 2 +-
.../res_parser/formatting_xhtml/formatting.html | 2 +-
6 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 04a0ec6..e542c07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-12-20 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_root_html_element_attributes_string),
+ doc/texinfo.texi (HTML Customization Variables): add
+ HTML_ROOT_ELEMENT_ATTRIBUTES to be able to add attributes
+ to the <html> HTML document root element.
+
2021-12-19 Patrice Dumas <pertusus@free.fr>
* tp/init/html32.pm: set NO_CUSTOM_HTML_ATTRIBUTE.
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index da23d46..1f8afc3 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16263,6 +16263,10 @@ set to @samp{l2h}, which uses @command{latex2html}
(@pxref{@command{latex2html} Customization Variables}), or set to
@samp{t2h}, which uses @command{tex4ht}.
+@item HTML_ROOT_ELEMENT_ATTRIBUTES
+Use that string for the @code{<html>} HTML document root element.
+Default undefined.
+
@item ICONS
Use icons for the navigation panel; default false.
@@ -16422,6 +16426,9 @@ practical effect.
@item USE_REL_REV
Use @code{rel} in cross-references; default true.
+@item USE_XML_SYNTAX
+Use XML/XHTML compatible syntax.
+
@item VERTICAL_HEAD_NAVIGATION
If set, a vertical navigation panel is used; default false.
@@ -16830,9 +16837,6 @@ default false.
If set to false, do not use the @code{Text::Unidecode} Perl module to
transliterate more characters; default true.
-@item USE_XML_SYNTAX
-For HTML@. Use XML/XHTML compatible syntax.
-
@end vtable
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index df9e45a..6d182fa 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -287,6 +287,7 @@ my @variable_string_settables = (
'FRAMESET_DOCTYPE',
'HEADER_IN_TABLE',
'HTML_MATH',
+'HTML_ROOT_ELEMENT_ATTRIBUTES',
'HTMLXREF',
'ICONS',
'IMAGE_LINK_PREFIX',
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6e879be..fea81a6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6931,6 +6931,16 @@ $pre_body_close
";
}
+sub _root_html_element_attributes_string($)
+{
+ my $self = shift;
+ if (defined($self->get_conf('HTML_ROOT_ELEMENT_ATTRIBUTES'))
+ and $self->get_conf('HTML_ROOT_ELEMENT_ATTRIBUTES') ne '') {
+ return ' '.$self->get_conf('HTML_ROOT_ELEMENT_ATTRIBUTES');
+ }
+ return '';
+}
+
# This is used for normal output files and other files, like
# redirection file headers. $COMMAND is the tree element for
# a @node that is being output in the file.
@@ -6998,6 +7008,7 @@ sub _file_header_informations($$)
$css_lines = '';
}
my $doctype = $self->get_conf('DOCTYPE');
+ my $root_html_element_attributes =
$self->_root_html_element_attributes_string();
my $bodytext = $self->get_conf('BODYTEXT');
if ($self->{'element_math'} and $self->get_conf('HTML_MATH')) {
if ($self->get_conf('HTML_MATH') eq 'mathjax') {
@@ -7070,8 +7081,8 @@ MathJax = {
}
return ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ $doctype, $root_html_element_attributes, $bodytext, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version,
$program_homepage,
$program, $generator);
}
@@ -7116,14 +7127,14 @@ sub _default_format_begin_file($$$)
}
my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ $doctype, $root_html_element_attributes, $bodytext, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version,
$program_homepage,
$program, $generator) = $self->_file_header_informations($command);
my $links = $self->_get_links ($filename, $element);
my $result = "$doctype
-<html>
+<html${root_html_element_attributes}>
<!-- Created by $program_and_version, $program_homepage -->
<head>
$encoding
@@ -7156,8 +7167,8 @@ sub _default_format_node_redirection_page($$)
my $command = shift;
my ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
- $extra_head, $program_and_version, $program_homepage,
+ $doctype, $root_html_element_attributes, $bodytext, $copying_comment,
+ $after_body_open, $extra_head, $program_and_version,
$program_homepage,
$program, $generator) = $self->_file_header_informations($command);
my $name = $self->command_text($command);
@@ -7167,7 +7178,7 @@ sub _default_format_node_redirection_page($$)
$self->gdt('The node you are looking for is at {href}.',
{ 'href' => {'type' => '_converted', 'text' => $direction }}));
my $result = "$doctype
-<html>
+<html${root_html_element_attributes}>
<!-- Created by $program_and_version, $program_homepage -->
<!-- This file redirects to the location of a node or anchor -->
<head>
@@ -7351,8 +7362,9 @@ sub _do_jslicenses_file {
return if (!$setting or $setting ne 'generate');
my $doctype = $self->get_conf('DOCTYPE');
+ my $root_html_element_attributes =
$self->_root_html_element_attributes_string();
my $a = $doctype . "\n" .
-'<html><head><title>jslicense labels</title></head>
+"<html${root_html_element_attributes}>".'<head><title>jslicense
labels</title></head>
<body>
<table id="jslicense-labels1">
';
@@ -7420,6 +7432,7 @@ sub _default_format_frame_files($$)
$self->output_files_information(), $self, $frame_outfile);
if (defined($frame_fh)) {
my $doctype = $self->get_conf('FRAMESET_DOCTYPE');
+ my $root_html_element_attributes =
$self->_root_html_element_attributes_string();
my $top_file = '';
if ($self->global_element('Top')) {
my $top_element = $self->global_element('Top');
@@ -7428,7 +7441,7 @@ sub _default_format_frame_files($$)
my $title = $self->{'title_string'};
print $frame_fh <<EOT;
$doctype
-<html>
+<html${root_html_element_attributes}>
<head><title>$title</title></head>
<frameset cols="140,*">
<frame name="toc" src="$toc_frame_file">
diff --git a/tp/tests/layout/list-of-tests b/tp/tests/layout/list-of-tests
index 13af3f0..848db45 100644
--- a/tp/tests/layout/list-of-tests
+++ b/tp/tests/layout/list-of-tests
@@ -30,7 +30,7 @@ formatting_weird_quotes formatting.texi -c 'OPEN_QUOTE_SYMBOL
@' -c "CLOSE_QUOTE
formatting_html32 formatting.texi --init html32.pm
formatting_regions formatting_regions.texi
formatting_numerical_entities formatting.texi -c 'USE_NUMERIC_ENTITY 1'
-formatting_xhtml formatting.texi -c DOCTYPE='<?xml version="1.0"
encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' -c 'USE_XML_SYNTAX 1' -c
'NO_CUSTOM_HTML_ATTRIBUTE 1'
+formatting_xhtml formatting.texi -c DOCTYPE='<?xml version="1.0"
encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' -c 'USE_XML_SYNTAX 1' -c
'NO_CUSTOM_HTML_ATTRIBUTE 1' -c 'HTML_ROOT_ELEMENT_ATTRIBUTES
xmlns="http://www.w3.org/1999/xhtml"'
formatting_exotic formatting.texi --split section --no-header
--no-number-sections -c 'TOC_LINKS 1' -c 'DEF_TABLE 1' -c
'XREF_USE_NODE_NAME_ARG 1' --footnote-style=end --css-ref
http://www.environnement.ens.fr/perso/dumas/background-color.css
--internal-links=/dev/null -c 'USE_TITLEPAGE_FOR_TITLE 0'
formatting_fr_icons formatting.texi --document-language fr --init icons.init
formatting_chm formatting.texi -c FORMAT_MENU=nomenu --init chm.pm
diff --git a/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
b/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
index 177789a..de296f4 100644
--- a/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_xhtml/formatting.html
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_root_html_element_attributes_string), doc/texinfo.texi (HTML Customization Variables): add HTML_ROOT_ELEMENT_ATTRIBUTES to be able to add attributes to the <html> HTML document root element.,
Patrice Dumas <=