texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: @link for LaTeX


From: Gavin D. Smith
Subject: branch master updated: @link for LaTeX
Date: Sun, 11 Jun 2023 08:24:24 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8605380288 @link for LaTeX
8605380288 is described below

commit 8605380288373769a886cc67f00d668a56af453f
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Jun 11 13:24:15 2023 +0100

    @link for LaTeX
    
    * tp/Texinfo/Convert/LaTeX.pm (_convert): Handle @link.
---
 ChangeLog                   |  6 ++++++
 tp/Texinfo/Convert/LaTeX.pm | 34 +++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8971f9a198..6c2dfc84ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-06-11  Gavin Smith <gavinsmith0123@gmail.com>
+
+       @link for LaTeX
+
+       * tp/Texinfo/Convert/LaTeX.pm (_convert): Handle @link.
+
 2023-06-10  Paul Eggert <eggert@cs.ucla.edu>
 
        * doc/texinfo.tex: Fix two misspellings in comments.
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index eb78878ab4..bb3033022a 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3145,8 +3145,9 @@ sub _convert($$)
           }
         }
         my $node_arg = $element->{'args'}->[0];
-        if ($cmdname eq 'inforef' and scalar(@args) == 3) {
-          $args[3] = $args[2];
+        if (($cmdname eq 'link' or $cmdname eq 'inforef')
+            and scalar(@args) == 3) {
+          $args[3] = $args[2]; # use as the manual argument
           $args[2] = undef;
         }
         my $book = '';
@@ -3156,7 +3157,7 @@ sub _convert($$)
 
         my $file_contents;
         # FIXME not sure if Texinfo TeX uses the external node manual
-        # specified as part of the node name with manual name prependended
+        # specified as part of the node name with manual name prepended
         # in parentheses
         if (defined($args[3])) {
           $file_contents = $args[3];
@@ -3275,7 +3276,9 @@ sub _convert($$)
           $text_representation .= $reference_result
             if defined($text_representation);
           my $name;
-          if (defined($args[2])) {
+          if ($cmdname eq 'link' and defined($args[1])) {
+            $name = $args[1];
+          } elsif (defined($args[2])) {
             $name = $args[2];
           } elsif (not defined($float_type)) {
             if (defined($self->get_conf('xrefautomaticsectiontitle'))
@@ -3294,8 +3297,11 @@ sub _convert($$)
             $text_representation .= $name_text if 
(defined($text_representation));
           }
 
-          # TODO translation
-          if (defined($float_type)) {
+          if ($cmdname eq 'link') {
+            if (defined($name_text)) {
+              $reference_result .= "\\hyperref[$reference_label]{$name_text}";
+            }
+          } elsif (defined($float_type)) {
             # no page for float reference in Texinfo TeX
             if (defined($name_text)) {
               $reference_result .= "\\hyperref[$reference_label]{$name_text}";
@@ -3348,7 +3354,7 @@ sub _convert($$)
                              .$text_representation.'}';
           }
           return $result;
-        } else {
+        } elsif ($cmdname ne 'link') {
           # external ref
           # TODO hyper reference to manual file which seems to be implemented
           # in recent Texinfo TeX
@@ -3387,6 +3393,20 @@ sub _convert($$)
           } elsif ($name_text) {
             $result .= $name_text;
           }
+        } else {
+          # external @link - just produce non-working text.
+          my $name;
+          if (defined($args[1])) {
+            $name = $args[1];
+          } elsif (defined($args[0])) {
+            $name = $args[0];
+          }
+
+          my $name_text;
+          if (defined($name)) {
+            $name_text = _convert($self, {'contents' => $name});
+            $result .= $name_text;
+          }
         }
         return $result;
       }



reply via email to

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