[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7007] --javascript-ref
From: |
Gavin D. Smith |
Subject: |
[7007] --javascript-ref |
Date: |
Sat, 13 Feb 2016 03:54:07 +0000 |
Revision: 7007
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7007
Author: gavin
Date: 2016-02-13 03:53:42 +0000 (Sat, 13 Feb 2016)
Log Message:
-----------
--javascript-ref
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Common.pm
trunk/tp/Texinfo/Convert/HTML.pm
trunk/tp/texi2any.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-02-09 23:08:35 UTC (rev 7006)
+++ trunk/ChangeLog 2016-02-13 03:53:42 UTC (rev 7007)
@@ -1,3 +1,22 @@
+2016-02-13 Gavin Smith <address@hidden>
+
+ Implement --javascript-ref option, suggested by Per Bothner.
+
+ * tp/texi2any.pl ($result_options): New option --javascript-ref.
+ ($cmdline_options): New value 'JAVASCRIPT_REFS'.
+ * tp/Texinfo/Convert/HTML.pm
+ (default_javascript_lines): New function.
+ (%default_formatting_references): Add 'javascript_lines', and
+ comment changed.
+ (output): Call default_javascript_lines (indirectly).
+ (_file_header_informations): Look at and return
+ 'JAVASCRIPT_LINES' conf value. Callers updated.
+ (_default_begin_file, default_node_redirection_page): Include
+ lines referring to a JavaScript file in the file header.
+ * tp/Texinfo/Common.pm (@variable_string_settables): Add
+ 'JAVASCRIPT_LINES'.
+ (@variable_other_settables): Add 'JAVASCRIPT_REFS'.
+
2016-02-09 Karl Berry <address@hidden>
* doc/texinfo.texi (Output Formats) <XML>: explicitly mention that
Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm 2016-02-09 23:08:35 UTC (rev 7006)
+++ trunk/tp/Texinfo/Common.pm 2016-02-13 03:53:42 UTC (rev 7007)
@@ -241,8 +241,8 @@
'USE_NODE_TARGET',
'PROGRAM_NAME_IN_FOOTER', 'NODE_FILENAMES',
'EXTERNAL_CROSSREF_SPLIT', 'BODYTEXT',
- 'CSS_LINES', 'RENAMED_NODES_REDIRECTIONS', 'RENAMED_NODES_FILE',
- 'CPP_LINE_DIRECTIVES',
+ 'CSS_LINES', 'JAVASCRIPT_LINES',
+ 'RENAMED_NODES_REDIRECTIONS', 'RENAMED_NODES_FILE', 'CPP_LINE_DIRECTIVES',
'TEXI2DVI', 'DUMP_TREE', 'MAX_MACRO_CALL_NESTING',
'INPUT_ENCODING_NAME', 'INPUT_PERL_ENCODING',
'OUTPUT_ENCODING_NAME', 'OUTPUT_PERL_ENCODING',
@@ -277,7 +277,7 @@
'MISC_BUTTONS', 'CHAPTER_BUTTONS', 'BUTTONS_NAME',
'BUTTONS_EXAMPLE', 'SPECIAL_ELEMENTS_NAME', 'SPECIAL_ELEMENTS_CLASS',
'ACTIVE_ICONS', 'PASSIVE_ICONS',
- 'CSS_FILES', 'CSS_REFS',
+ 'CSS_FILES', 'CSS_REFS', 'JAVASCRIPT_REFS',
'GLOBAL_COMMANDS',
);
Modified: trunk/tp/Texinfo/Convert/HTML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/HTML.pm 2016-02-09 23:08:35 UTC (rev 7006)
+++ trunk/tp/Texinfo/Convert/HTML.pm 2016-02-13 03:53:42 UTC (rev 7007)
@@ -4559,11 +4559,13 @@
};
}
+# Functions accessed with e.g. 'format_heading_text' for 'heading_text'.
my %default_formatting_references = (
'heading_text' => \&_default_heading_text,
'comment' => \&_default_comment,
'protect_text' => \&_default_protect_text,
'css_lines' => \&_default_css_lines,
+ 'javascript_lines' => \&_default_javascript_lines,
'begin_file' => \&_default_begin_file,
'node_redirection_page' => \&_default_node_redirection_page,
'end_file' => \&_default_end_file,
@@ -4956,6 +4958,24 @@
$self->{'css_rule_lines'} = address@hidden;
}
+# Set 'JAVASCRIPT_LINES' conf value with text containing a reference to
+# an external JavaScript file.
+sub _default_javascript_lines ($)
+{
+ my $self = shift;
+
+ my $javascript_refs = $self->get_conf('JAVASCRIPT_REFS');
+ return if (!$javascript_refs or address@hidden);
+
+ my $javascript_text = '';
+ foreach my $script (@$javascript_refs) {
+ $javascript_text
+ .= '<script type="text/javascript" '
+ . 'src="' . $script . '"></script>' ."\n";
+ }
+ $self->set_conf('JAVASCRIPT_LINES', $javascript_text);
+}
+
sub _node_id_file($$)
{
my $self = shift;
@@ -6180,6 +6200,12 @@
} else {
$css_lines = '';
}
+ my $javascript_lines;
+ if (defined($self->get_conf('JAVASCRIPT_LINES'))) {
+ $javascript_lines = $self->get_conf('JAVASCRIPT_LINES');
+ } else {
+ $javascript_lines = '';
+ }
my $doctype = $self->get_conf('DOCTYPE');
my $bodytext = $self->get_conf('BODYTEXT');
my $copying_comment = '';
@@ -6199,8 +6225,8 @@
$generator = "\n<meta name=\"Generator\" content=\"$program\">";
}
- return ($title, $description, $encoding, $date, $css_lines,
- $doctype, $bodytext, $copying_comment, $after_body_open,
+ return ($title, $description, $encoding, $date, $css_lines,
+ $javascript_lines, $doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator);
}
@@ -6244,7 +6270,7 @@
$command = $self->element_command($element);
}
- my ($title, $description, $encoding, $date, $css_lines,
+ my ($title, $description, $encoding, $date, $css_lines, $javascript_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
@@ -6262,7 +6288,7 @@
<meta name=\"resource-type\" content=\"document\">
<meta name=\"distribution\" content=\"global\">${generator}$date
$encoding
-${links}$css_lines
+${links}$css_lines$javascript_lines
$extra_head
</head>
@@ -6277,7 +6303,7 @@
my $self = shift;
my $command = shift;
- my ($title, $description, $encoding, $date, $css_lines,
+ my ($title, $description, $encoding, $date, $css_lines, $javascript_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
@@ -6300,7 +6326,7 @@
<meta name=\"resource-type\" content=\"document\">
<meta name=\"distribution\" content=\"global\">${generator}$date
$encoding
-$css_lines
+$css_lines$javascript_lines
<meta http-equiv=\"Refresh\" content=\"0; url=$href\">
$extra_head
</head>
@@ -6782,6 +6808,7 @@
return undef unless($structure_status);
&{$self->{'format_css_lines'}}($self);
+ &{$self->{'format_javascript_lines'}}($self);
$self->set_conf('BODYTEXT',
'lang="' . $self->get_conf('documentlanguage') . '"');
Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl 2016-02-09 23:08:35 UTC (rev 7006)
+++ trunk/tp/texi2any.pl 2016-02-13 03:53:42 UTC (rev 7007)
@@ -117,8 +117,10 @@
# command line parsing.
my @css_files = ();
my @css_refs = ();
+my @javascript_refs = ();
my $cmdline_options = { 'CSS_FILES' => address@hidden,
- 'CSS_REFS' => address@hidden };
+ 'CSS_REFS' => address@hidden,
+ 'JAVASCRIPT_REFS' => address@hidden };
# determine the path separators
my $path_separator = $Config{'path_sep'};
@@ -975,6 +977,7 @@
},
'css-include=s' => address@hidden,
'css-ref=s' => address@hidden,
+ 'javascript-ref=s' => address@hidden,
'transliterate-file-names!' =>
sub {set_from_cmdline('TRANSLITERATE_FILE_NAMES', $_[1]);},
'error-limit|e=i' => sub { set_from_cmdline('ERROR_LIMIT', $_[1]); },
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7007] --javascript-ref,
Gavin D. Smith <=