texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 4 May 2024 04:08:41 -0400 (EDT)

branch: master
commit d74a4eebbdb2df1f8b74e5c6e2081238e273ff07
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat May 4 09:51:28 2024 +0200

    * tp/Texinfo/Convert/HTML.pm (_convert_def_command),
    tp/Texinfo/XS/convert/convert_html.c (convert_def_command): use
    directly defblock as class name.
---
 ChangeLog                               |  6 ++++++
 tp/Texinfo/Convert/HTML.pm              | 18 +++++++++++------
 tp/Texinfo/XS/convert/convert_html.c    | 36 +++++++++++++++++++--------------
 tp/t/results/def/adjacent_defline.pl    |  2 +-
 tp/t/results/def/defblock_no_defline.pl |  2 +-
 tp/t/results/def/defline_no_params.pl   |  2 +-
 tp/t/results/def/deftypeline.pl         |  2 +-
 tp/t/results/def/multiple_defline.pl    |  2 +-
 8 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6afd4b1fb..e3cc66b23c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-05-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_def_command),
+       tp/Texinfo/XS/convert/convert_html.c (convert_def_command): use
+       directly defblock as class name.
+
 2024-05-03  Patrice Dumas  <pertusus@free.fr>
 
        * util/texinfo.dtd: add nodedescriptionblock and nodedescription.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 1c82f38c03..4bc4ec295d 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6939,14 +6939,20 @@ sub _convert_def_command($$$$$) {
   return $content if (in_string($self));
 
   my @classes;
-  my $command_name;
-  if ($Texinfo::Common::def_aliases{$cmdname}) {
-    $command_name = $Texinfo::Common::def_aliases{$cmdname};
-    push @classes, "first-$cmdname-alias-first-$command_name";
+  if ($cmdname ne 'defblock') {
+    # The def* class is used for the def line, the first-def* class is
+    # used for the whole block.
+    my $command_name;
+    if ($Texinfo::Common::def_aliases{$cmdname}) {
+      $command_name = $Texinfo::Common::def_aliases{$cmdname};
+      push @classes, "first-$cmdname-alias-first-$command_name";
+    } else {
+      $command_name = $cmdname;
+    }
+    unshift @classes, "first-$command_name";
   } else {
-    $command_name = $cmdname;
+    push @classes, $cmdname;
   }
-  unshift @classes, "first-$command_name";
 
   if (!$self->get_conf('DEF_TABLE')) {
     return $self->html_attribute_class('dl', \@classes).">\n"
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index d8140e2bcd..6eb381573f 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -13644,30 +13644,36 @@ convert_def_command (CONVERTER *self, const enum 
command_id cmd,
 
   classes = new_string_list ();
 
-  if (builtin_command_data[cmd].flags & CF_def_alias)
+  if (cmd != CM_defblock)
     {
-      int i;
-      for (i = 0; def_aliases[i].alias ; i++)
+      if (builtin_command_data[cmd].flags & CF_def_alias)
         {
-          if (def_aliases[i].alias == cmd)
+          int i;
+          for (i = 0; def_aliases[i].alias ; i++)
             {
-              original_cmd = def_aliases[i].command;
-              break;
+              if (def_aliases[i].alias == cmd)
+                {
+                  original_cmd = def_aliases[i].command;
+                  break;
+                }
             }
         }
-    }
 
-  xasprintf (&class, "first-%s", builtin_command_name (original_cmd));
-  add_string (class, classes);
-  free (class);
-
-  if (cmd != original_cmd)
-    {
-      xasprintf (&class, "first-%s-alias-first-%s", builtin_command_name (cmd),
-                         builtin_command_name (original_cmd));
+      xasprintf (&class, "first-%s", builtin_command_name (original_cmd));
       add_string (class, classes);
       free (class);
+
+      if (cmd != original_cmd)
+        {
+          xasprintf (&class, "first-%s-alias-first-%s",
+                             builtin_command_name (cmd),
+                             builtin_command_name (original_cmd));
+          add_string (class, classes);
+          free (class);
+        }
     }
+  else
+    add_string (builtin_command_name (cmd), classes);
 
   if (self->conf->DEF_TABLE.integer <= 0)
     {
diff --git a/tp/t/results/def/adjacent_defline.pl 
b/tp/t/results/def/adjacent_defline.pl
index 859abfa312..ccfe95ad08 100644
--- a/tp/t/results/def/adjacent_defline.pl
+++ b/tp/t/results/def/adjacent_defline.pl
@@ -302,7 +302,7 @@ strong.def-name {font-family: monospace; font-weight: bold; 
font-size: larger}
 </head>
 
 <body lang="en">
-<dl class="first-defblock">
+<dl class="defblock">
 <dt class="defline"><span class="category-def">Funoid: </span><strong 
class="def-name">foo</strong> <var class="def-var-arguments">(bar)</var></dt>
 <dt class="defline"><span class="category-def">Funnyoid: </span><strong 
class="def-name">foo2</strong> <var class="def-var-arguments">(bar2, 
baz2)</var></dt>
 <dd><p>description
diff --git a/tp/t/results/def/defblock_no_defline.pl 
b/tp/t/results/def/defblock_no_defline.pl
index 384b64cc7a..ec42cb3d2f 100644
--- a/tp/t/results/def/defblock_no_defline.pl
+++ b/tp/t/results/def/defblock_no_defline.pl
@@ -117,7 +117,7 @@ $result_converted{'html'}->{'defblock_no_defline'} = 
'<!DOCTYPE html>
 </head>
 
 <body lang="en">
-<dl class="first-defblock">
+<dl class="defblock">
 <dd><p>misc text inside
 </p></dd></dl>
 
diff --git a/tp/t/results/def/defline_no_params.pl 
b/tp/t/results/def/defline_no_params.pl
index a8e586939f..ca4761d109 100644
--- a/tp/t/results/def/defline_no_params.pl
+++ b/tp/t/results/def/defline_no_params.pl
@@ -175,7 +175,7 @@ strong.def-name {font-family: monospace; font-weight: bold; 
font-size: larger}
 </head>
 
 <body lang="en">
-<dl class="first-defblock">
+<dl class="defblock">
 <dt class="defline"><span class="category-def">Builtin: </span><strong 
class="def-name">truc</strong></dt>
 <dd><p>Description of truc
 </p></dd></dl>
diff --git a/tp/t/results/def/deftypeline.pl b/tp/t/results/def/deftypeline.pl
index 387f355b57..f82bd0d167 100644
--- a/tp/t/results/def/deftypeline.pl
+++ b/tp/t/results/def/deftypeline.pl
@@ -306,7 +306,7 @@ strong.def-name {font-family: monospace; font-weight: bold; 
font-size: larger}
 </head>
 
 <body lang="en">
-<dl class="first-defblock">
+<dl class="defblock">
 <dt class="deftypeline"><span class="category-def">Function: </span><code 
class="def-type">long int</code> <strong class="def-name">foo</strong> <code 
class="def-code-arguments">(int <var class="var">bar</var>, int <var 
class="var">baz</var>)</code></dt>
 <dd><p>&hellip;
 </p></dd></dl>
diff --git a/tp/t/results/def/multiple_defline.pl 
b/tp/t/results/def/multiple_defline.pl
index e940d6a851..82b348b27c 100644
--- a/tp/t/results/def/multiple_defline.pl
+++ b/tp/t/results/def/multiple_defline.pl
@@ -333,7 +333,7 @@ strong.def-name {font-family: monospace; font-weight: bold; 
font-size: larger}
 </head>
 
 <body lang="en">
-<dl class="first-defblock">
+<dl class="defblock">
 <dt class="defline"><span class="category-def">Funoid: </span><strong 
class="def-name">foo</strong> <var class="def-var-arguments">(bar)</var></dt>
 <dd><p>description1 description1 description1 description1 description1
 description1 description1 description1 description1 description1



reply via email to

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