]> git.lyx.org Git - lyx.git/commitdiff
Cmake tests: Amend 6e05409d
authorKornel Benko <kornel@lyx.org>
Sun, 22 Sep 2024 09:40:28 +0000 (11:40 +0200)
committerKornel Benko <kornel@lyx.org>
Sun, 22 Sep 2024 09:40:28 +0000 (11:40 +0200)
Use with a slightly better thought out selection of possible exports to tex-source.

development/autotests/export.cmake
development/autotests/invertedTests
development/autotests/readDefaultOutputFormat.pl

index 40bc0f0cb5a787fc6b543364a522908630ef466e..6053e5b827f6a718857390b1751900e729810b56 100755 (executable)
@@ -230,19 +230,11 @@ if (extension MATCHES "\\.lyx$")
   message(STATUS "Executing ${PERL_EXECUTABLE} ${readDefaultOutputFormat} ${LYX_SOURCE}")
   execute_process(
     COMMAND ${PERL_EXECUTABLE} ${readDefaultOutputFormat} "${LYX_SOURCE}"
-    OUTPUT_VARIABLE _export_format)
-  message(STATUS "readDefaultOutputFormat = ${_export_format}")
-  if (${_export_format} MATCHES "pdf2")
-    set(_texformat "pdflatex")
-  elseif(${_export_format} MATCHES "pdf3")
-    # Ideally we would set to "platex" if Japanese, and "latex" if not Japanese.
-    # For example, currently we invert export/examples/Articles/Chess/Game_1_lyx because
-    # it should be exported to "latex" instead of "platex".
-    set(_texformat "platex")
-  elseif(${_export_format} MATCHES "pdf4")
-    set(_texformat "xetex")
-  elseif(${_export_format} MATCHES "pdf5")
-    set(_texformat "luatex")
+    OUTPUT_VARIABLE _formats)
+  message(STATUS "readDefaultOutputFormat = ${_formats}")
+  if (${_formats} MATCHES "^([a-z]+)/(pdf[2345]?)$")
+    set(_texformat ${CMAKE_MATCH_1})
+    set(_export_format ${CMAKE_MATCH_2})
   else()
     set(_texformat "empty")
   endif()
index 88afdc0cbd038cb96cf16769c5eb98f2ad55572e..8b314b64c7ddc7bc4cc9d0dfe37f04fbd7853716 100644 (file)
@@ -57,10 +57,6 @@ export/export/lyx2lyx/lyx_2_3_test2_lyx(16|20)
 # clear it is worth the time to try to fix the issue.
 export/doc/ja/UserGuide_lyx(16|20)
 export/examples/ja/Modules/LilyPond_Book_lyx(16|20)
-# in export.cmake, if output format is pdf3, we try to export to "platex" which
-# makes sense for all other tests except this one (which should be exported to
-# "latex" instead).
-export/examples/Articles/Chess/Game_1_lyx.*
 
 # nonstandard tests failing for unknown reason:
 export/templates/Articles/R_Journal_(dvi3|pdf[45])_systemF
index 496cfeeaa5dee089bae88bea70e6ddb5a1c49788..fbc06fc5254b4c6124aed7f91e22ae4da4a86b09 100644 (file)
@@ -6,7 +6,7 @@ use strict;
 
 my $useNonTexFonts = undef;
 my $outputFormat = undef;
-my $outputFormat = undef;
+my $texFormat = undef;
 my $language = undef;
 if (-e "$ARGV[0]") {
   if (open(FI, "$ARGV[0]")) {
@@ -24,34 +24,75 @@ if (-e "$ARGV[0]") {
       last if (defined($useNonTexFonts) && defined($outputFormat) && defined($language));
     }
     close(FI);
+    if (defined($ARGV[1])) {
+      print "outputformat = \"$outputFormat\"\n";
+      print "useNonTexFonts = \"$useNonTexFonts\"\n";
+      print "language = \"$language\"\n";
+    }
   }
 }
-if (defined($useNonTexFonts) && defined($outputFormat)) {
+if ($language eq "japanese") {
   if ($useNonTexFonts) {
-    if ($outputFormat eq "default") {
-      if ($language eq "japanese") {
-        $outputFormat = "pdf4";
+    if ($outputFormat =~ /^(default|pdf4)$/) {
+      $outputFormat = "pdf4";
+      $texFormat = "xetex";
+    }
+    elsif ($outputFormat =~ /^pdf[35]?$/) {
+      if ($outputFormat =~ /^pdf3?$/) {
+        $texFormat = "platex";
       }
       else {
-        $outputFormat = "pdf5";
+        $texFormat = "luatex";
       }
     }
+    else {
+      $outputFormat = undef;
+    }
   }
-  elsif ($outputFormat eq "default") {
-    if ($language eq "japanese") {
+  else { # using tex font
+    if ($outputFormat =~ /^(default|pdf3)$/) {
       $outputFormat = "pdf3";
+      $texFormat = "platex";
+    }
+    elsif ($outputFormat =~ /^pdf5$/) {
+      $texFormat = "luatex";
     }
     else {
-      $outputFormat = "pdf2";
+      $outputFormat = undef;
+    }
+  }
+}
+else { # not a japanese language
+  if ($useNonTexFonts) {
+    if ($outputFormat =~ /^(default|pdf4)$/) {
+      $texFormat = "xetex";
+    }
+    elsif ($outputFormat eq "pdf5") {
+      $texFormat = "luatex";
+    }
+    else {
+      $outputFormat = undef;
     }
   }
-  if ($outputFormat !~ /^pdf/) {
-    $outputFormat = undef;
+  else { # using tex fonts
+    if ($outputFormat =~ /^(default|pdf2)$/) {
+      $outputFormat = "pdf2";
+      $texFormat = "pdflatex";
+    }
+    elsif ($outputFormat eq "pdf5") {
+      $texFormat = "luatex";
+    }
+    elsif ($outputFormat eq "pdf3") {
+      $texFormat = "latex";
+    }
+    else {
+      $outputFormat = undef;
+    }
   }
 }
 
 if (defined($outputFormat)) {
-  print "$outputFormat";
+  print "$texFormat/$outputFormat";
 }
 else {
   print "undefined_output_format";