From: Kornel Benko Date: Sun, 22 Sep 2024 09:40:28 +0000 (+0200) Subject: Cmake tests: Amend 6e05409d X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3add2204;p=lyx.git Cmake tests: Amend 6e05409d Use with a slightly better thought out selection of possible exports to tex-source. --- diff --git a/development/autotests/export.cmake b/development/autotests/export.cmake index 40bc0f0cb5..6053e5b827 100755 --- a/development/autotests/export.cmake +++ b/development/autotests/export.cmake @@ -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() diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index 88afdc0cbd..8b314b64c7 100644 --- a/development/autotests/invertedTests +++ b/development/autotests/invertedTests @@ -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 diff --git a/development/autotests/readDefaultOutputFormat.pl b/development/autotests/readDefaultOutputFormat.pl index 496cfeeaa5..fbc06fc525 100644 --- a/development/autotests/readDefaultOutputFormat.pl +++ b/development/autotests/readDefaultOutputFormat.pl @@ -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";