texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/ext/highlight_syntax.pm: show warning if HIG


From: Gavin D. Smith
Subject: branch master updated: * tp/ext/highlight_syntax.pm: show warning if HIGHLIGHT_SYNTAX is set to unknown value. * tp/tests/other/list-of-tests: set HIGHLIGHT_SYNTAX=source-highlight
Date: Thu, 12 Dec 2024 15:09:39 -0500

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 ccda9adf19 * tp/ext/highlight_syntax.pm: show warning if 
HIGHLIGHT_SYNTAX is set to unknown value. * tp/tests/other/list-of-tests: set 
HIGHLIGHT_SYNTAX=source-highlight
ccda9adf19 is described below

commit ccda9adf193c214fe15defac21d07cf6049a6f6f
Author: Carlos Maniero <carlos@maniero.me>
AuthorDate: Thu Dec 12 20:06:35 2024 +0000

    * tp/ext/highlight_syntax.pm: show warning if HIGHLIGHT_SYNTAX is
    set to unknown value.
    * tp/tests/other/list-of-tests: set HIGHLIGHT_SYNTAX=source-highlight
---
 ChangeLog                    |  6 ++++++
 tp/ext/highlight_syntax.pm   | 14 ++++++++++----
 tp/tests/other/list-of-tests |  4 ++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71213419d2..fc92fc3fd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-12-12  Carlos Maniero  <carlos@maniero.me>  (tiny change)
+
+       * tp/ext/highlight_syntax.pm: show warning if HIGHLIGHT_SYNTAX is
+       set to unknown value.
+       * tp/tests/other/list-of-tests: set HIGHLIGHT_SYNTAX=source-highlight
+
 2024-12-11  Gavin Smith <gavinsmith0123@gmail.com>
 
        * configure.ac: remove reference to gnulib/po subdirectory
diff --git a/tp/ext/highlight_syntax.pm b/tp/ext/highlight_syntax.pm
index 953f5c10eb..67210df5fc 100644
--- a/tp/ext/highlight_syntax.pm
+++ b/tp/ext/highlight_syntax.pm
@@ -74,15 +74,21 @@ sub highlight_setup($$)
 
   my $highlight_type = $self->get_conf('HIGHLIGHT_SYNTAX');
 
+  return 1 if !defined($highlight_type);
+
   my $cmd;
-  if (defined($highlight_type) and $highlight_type eq 'highlight') {
+  if ($highlight_type eq 'highlight') {
     $cmd = 'highlight --list-scripts=lang';
-  } elsif (defined($highlight_type) and $highlight_type eq 'pygments') {
+  } elsif ($highlight_type eq 'pygments') {
     $cmd = 'pygmentize -L lexers';
-  } else {
-    $highlight_type = 'source-highlight';
+  } elsif ($highlight_type eq 'source-highlight') {
     $cmd = 'source-highlight --lang-list';
+  } else {
+    $self->converter_document_warn(sprintf(__(
+      "`%s' is not valid for HIGHLIGHT_SYNTAX"), $highlight_type));
+    return 1;
   }
+
   if ($highlight_type_languages_name_mappings{$highlight_type}) {
     %languages_name_mapping
       = %{$highlight_type_languages_name_mappings{$highlight_type}};
diff --git a/tp/tests/other/list-of-tests b/tp/tests/other/list-of-tests
index 963befe46b..1a79af0e05 100644
--- a/tp/tests/other/list-of-tests
+++ b/tp/tests/other/list-of-tests
@@ -1,10 +1,10 @@
 
 # syntax highlighting in examples
-highlight_syntax_example highlight_example.texi --html -c HIGHLIGHT_SYNTAX=1
+highlight_syntax_example highlight_example.texi --html -c 
HIGHLIGHT_SYNTAX=source-highlight
 highlight_syntax_example_pygments highlight_example.texi --html -c 
HIGHLIGHT_SYNTAX=pygments
 highlight_syntax_example_highlight highlight_example.texi --html -c 
HIGHLIGHT_SYNTAX=highlight
 
-highlight_syntax_example_default_language highlight_example.texi --html -c 
HIGHLIGHT_SYNTAX=1 -c HIGHLIGHT_SYNTAX_DEFAULT_LANGUAGE=Perl
+highlight_syntax_example_default_language highlight_example.texi --html -c 
HIGHLIGHT_SYNTAX=source-highlight -c HIGHLIGHT_SYNTAX_DEFAULT_LANGUAGE=Perl
 
 highlight_syntax_example_latin9 highlight_example.texi --html 
--init=highlight_syntax.pm -c 'OUTPUT_ENCODING_NAME=ISO-8859-15'
 



reply via email to

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