texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * Pod-Simple-Texinfo/pod2texi.pl: add @shorttitle


From: Patrice Dumas
Subject: branch master updated: * Pod-Simple-Texinfo/pod2texi.pl: add @shorttitlepage to main manual preamble.
Date: Mon, 15 Aug 2022 03:54:51 -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 e5a7d2516b * Pod-Simple-Texinfo/pod2texi.pl: add @shorttitlepage to 
main manual preamble.
e5a7d2516b is described below

commit e5a7d2516b70999e153f9fc71a39954df5443b89
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 15 09:54:41 2022 +0200

    * Pod-Simple-Texinfo/pod2texi.pl: add @shorttitlepage to main manual
    preamble.
---
 ChangeLog                         |   5 ++
 Pod-Simple-Texinfo/pod2texi.pl    |   2 +
 tp/init/documentation_examples.pm | 126 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 133 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 900a7b1c3d..04888b40ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-15  Patrice Dumas  <pertusus@free.fr>
+
+       * Pod-Simple-Texinfo/pod2texi.pl: add @shorttitlepage to main manual
+       preamble.
+
 2022-08-14  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * TODO: Add tagging system for definitions.
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 7072727f44..34c5dc9d2c 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -538,6 +538,8 @@ if ($base_level > 0) {
     $preamble_result = '\input texinfo
 @setfilename ' . Pod::Simple::Texinfo::_protect_text($setfilename) . "
 \@settitle $top
+\@shorttitlepage $top
+\@headings on
 
 \@contents
 
diff --git a/tp/init/documentation_examples.pm 
b/tp/init/documentation_examples.pm
new file mode 100644
index 0000000000..7053d568c2
--- /dev/null
+++ b/tp/init/documentation_examples.pm
@@ -0,0 +1,126 @@
+# API documentation code examples implemented, to check syntax
+# and also expected effects.  Only for code that is not already elsewhere,
+# nor is too complex to set up.
+
+use strict;
+
+my $default_footnotestyle = texinfo_get_conf('footnotestyle');
+my $main_program_footnotestyle;
+if (not defined($default_footnotestyle)) {
+  $main_program_footnotestyle = 'is undef';
+} elsif ($default_footnotestyle eq 'separate') {
+  $main_program_footnotestyle = 'is separate';
+} else {
+  $main_program_footnotestyle = 'not separate '.$default_footnotestyle;
+}
+
+texinfo_register_no_arg_command_formatting('-', undef, '&shy;');
+
+texinfo_register_no_arg_command_formatting('error', undef, undef, undef,
+                                           'error--&gt;');
+
+texinfo_register_style_command_formatting('sansserif', 'code', 0, 'normal');
+texinfo_register_style_command_formatting('sansserif', 'code', 0, 
'preformatted');
+texinfo_register_style_command_formatting('sansserif', undef, 1, 'string');
+
+my $shown_styles;
+my $footnotestyle;
+sub my_function_set_some_css {
+  my $converter = shift;
+  my @all_included_rules = $converter->css_get_info('rules');
+  my $all_default_selector_styles = $converter->css_get_info('styles');
+  my $titlefont_style = $all_default_selector_styles->{'h1.titlefont'};
+  $titlefont_style = 'undefined' if (!defined($titlefont_style));
+  $shown_styles = $titlefont_style.' '.
+              $all_default_selector_styles->{'h1.shorttitlepage'};
+  $converter->css_add_info('styles', 'h1.titlefont', 'text-align:center');
+
+  my $footnotestyle_before_setting = $converter->get_conf('footnotestyle');
+  $footnotestyle_before_setting = 'UNDEF'
+     if (not defined($footnotestyle_before_setting));
+  $converter->set_conf('footnotestyle', 'separate');
+  $footnotestyle = $main_program_footnotestyle
+                    .'|'.$footnotestyle_before_setting
+                    .'|'.$converter->get_conf('footnotestyle');
+  # there should be nothing in @all_included_rules for two reasons,
+  # first because it requires 'CSS_FILES' to be set to parseable
+  # CSS files, and CSS files parsing is done after the setup handler
+  # is called.
+  #print STDERR "all_included_rules: ".join('|', @all_included_rules)."\n";
+  return 0;
+}
+
+texinfo_register_handler('setup', \&my_function_set_some_css);
+
+sub my_email_formatting_function {
+  my $converter = shift;
+  my $cmdname = shift;
+  my $command = shift;
+  my $args = shift;
+
+  my $mail_arg = shift @$args;
+  my $text_arg = shift @$args;
+  my $mail = '';
+  my $mail_string;
+  if (defined($mail_arg)) {
+    $mail = $mail_arg->{'url'};
+    $mail_string = $mail_arg->{'monospacestring'};
+  }
+  my $text = '';
+  if (defined($text_arg)) {
+    $text = $text_arg->{'normal'};
+  }
+
+  if ($converter->in_string()) {
+    return "$mail_string ($text) $shown_styles, $footnotestyle";
+  } else {
+    return $converter->html_attribute_class('a', [$cmdname])
+     ." href=\"mailto:$mail_string\";>$text</a> [$shown_styles, 
$footnotestyle]";
+  }
+}
+
+texinfo_register_command_formatting('email', \&my_email_formatting_function);
+
+sub my_convert_paragraph_type($$$$)
+{
+  my $converter = shift;
+  my $type = shift;
+  my $element = shift;
+  my $content = shift;
+
+  return $content if ($converter->in_string());
+
+  my @contents = @{$element->{'contents'}};
+  push @contents, {'text' => ' <code>HTML</code> text ',
+                   'type' => '_converted'};
+  my $result = $converter->convert_tree({'type' => '_code',
+                                   'contents' => \@contents });
+  return "<p>".$result."</p>";
+}
+
+texinfo_register_type_formatting('paragraph', \&my_convert_paragraph_type);
+
+sub my_node_file_name($$$) {
+  my ($converter, $element, $filename) = @_;
+  # ....
+  my $node_file_name = 'prepended_to_filenames-'.$filename;
+  return $node_file_name;
+}
+
+texinfo_register_file_id_setting_function('node_file_name',
+                                          \&my_node_file_name);
+
+
+sub my_label_target_name($$$) {
+  my ($converter, $label_info, $default_target) = @_;
+  if (defined($label_info->{'normalized'})) {
+    my $element = $converter->label_command($label_info->{'normalized'});
+    return 'prepended_to_labels-'.$element->{'extra'}->{'normalized'};
+  }
+  return $default_target;
+}
+
+texinfo_register_file_id_setting_function('label_target_name',
+                                          \&my_label_target_name);
+
+1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]