Cmake tests: Amend 6e05409d

Use with a slightly better thought out selection of possible exports to tex-source.
This commit is contained in:
Kornel Benko 2024-09-22 11:40:28 +02:00
parent 7f970b11b3
commit 3add2204d4
3 changed files with 58 additions and 29 deletions

View File

@ -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()

View 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

View 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;
}
}
if ($outputFormat !~ /^pdf/) {
$outputFormat = undef;
}
else { # not a japanese language
if ($useNonTexFonts) {
if ($outputFormat =~ /^(default|pdf4)$/) {
$texFormat = "xetex";
}
elsif ($outputFormat eq "pdf5") {
$texFormat = "luatex";
}
else {
$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";