mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Cmake export tests: Set \origin also for unavailable
This is important for lyx-files not under the lyxsystemdir. Since the exports are done from a copied lyx-file, some referenced data may be available only relative to the source of the original.
This commit is contained in:
parent
18ee587a1e
commit
1d90561675
@ -26,12 +26,12 @@ sub getFileType($);
|
|||||||
sub getFileIdx($);
|
sub getFileIdx($);
|
||||||
sub getExt($);
|
sub getExt($);
|
||||||
sub getResult($);
|
sub getResult($);
|
||||||
sub checkForHeader($);
|
sub checkForHeader($$);
|
||||||
sub checkForPreamble($);
|
sub checkForPreamble($);
|
||||||
sub checkForLayoutStart($);
|
sub checkForLayoutStart($);
|
||||||
sub checkForInsetStart($);
|
sub checkForInsetStart($);
|
||||||
sub checkForLatexCommand($);
|
sub checkForLatexCommand($);
|
||||||
sub checkLyxLine($);
|
sub checkLyxLine($$);
|
||||||
|
|
||||||
my @stack = (); # list of HASH-Arrays
|
my @stack = (); # list of HASH-Arrays
|
||||||
my $rFont = {};
|
my $rFont = {};
|
||||||
@ -201,9 +201,9 @@ sub getResult($)
|
|||||||
return($m->{"result"});
|
return($m->{"result"});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub checkForHeader($)
|
sub checkForHeader($$)
|
||||||
{
|
{
|
||||||
my ($l) = @_;
|
my ($l, $sourcedir) = @_;
|
||||||
|
|
||||||
if ($l =~ /^\\begin_header\s*$/) {
|
if ($l =~ /^\\begin_header\s*$/) {
|
||||||
my %selem = ();
|
my %selem = ();
|
||||||
@ -247,6 +247,10 @@ sub checkForHeader($)
|
|||||||
"filetype" => "replace_only",
|
"filetype" => "replace_only",
|
||||||
"result" => ["\\origin $sysdir", "2"]);
|
"result" => ["\\origin $sysdir", "2"]);
|
||||||
push(@rElems, $origin);
|
push(@rElems, $origin);
|
||||||
|
my $originu = newMatch("search" => qr/^\\origin\s+unavailable/,
|
||||||
|
"filetype" => "replace_only",
|
||||||
|
"result" => ["\\origin $sourcedir"]);
|
||||||
|
push(@rElems, $originu);
|
||||||
setMatching(\@rElems);
|
setMatching(\@rElems);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -369,11 +373,11 @@ sub checkForLatexCommand($)
|
|||||||
# separator: to be used while concatenating the filenames
|
# separator: to be used while concatenating the filenames
|
||||||
# filetype: prefix_only,replace_only,copy_only,interpret
|
# filetype: prefix_only,replace_only,copy_only,interpret
|
||||||
# same as before, but without 'prefix_for_list'
|
# same as before, but without 'prefix_for_list'
|
||||||
sub checkLyxLine($)
|
sub checkLyxLine($$)
|
||||||
{
|
{
|
||||||
my ($l) = @_;
|
my ($l, $sourcedir) = @_;
|
||||||
|
|
||||||
return({"found" => 0}) if (checkForHeader($l));
|
return({"found" => 0}) if (checkForHeader($l, $sourcedir));
|
||||||
return({"found" => 0}) if (checkForPreamble($l));
|
return({"found" => 0}) if (checkForPreamble($l));
|
||||||
return({"found" => 0}) if (checkForEndBlock($l));
|
return({"found" => 0}) if (checkForEndBlock($l));
|
||||||
return({"found" => 0}) if (checkForLayoutStart($l));
|
return({"found" => 0}) if (checkForLayoutStart($l));
|
||||||
|
@ -182,7 +182,7 @@ sub interpretedCopy($$$$)
|
|||||||
$fi_line_no += 1;
|
$fi_line_no += 1;
|
||||||
$l =~ s/[\n\r]+$//;
|
$l =~ s/[\n\r]+$//;
|
||||||
#chomp($l);
|
#chomp($l);
|
||||||
my $rStatus = checkLyxLine($l);
|
my $rStatus = checkLyxLine($l, $sourcedir);
|
||||||
if ($rStatus->{found}) {
|
if ($rStatus->{found}) {
|
||||||
my $rF = $rStatus->{result};
|
my $rF = $rStatus->{result};
|
||||||
if ($rStatus->{"filetype"} eq "replace_only") {
|
if ($rStatus->{"filetype"} eq "replace_only") {
|
||||||
@ -258,7 +258,7 @@ sub interpretedCopy($$$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($foundrelative && $rStatus->{"filetype"} ne "prefix_for_list") {
|
if ($foundrelative && $rStatus->{"filetype"} !~ /^(prefix_for_list|prefix_only)$/) {
|
||||||
# The result can be relative too
|
# The result can be relative too
|
||||||
# but, since prefix_for_list does no copy, we have to use absolute paths
|
# but, since prefix_for_list does no copy, we have to use absolute paths
|
||||||
# to address files inside the source dir
|
# to address files inside the source dir
|
||||||
|
Loading…
Reference in New Issue
Block a user