X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=development%2Fautotests%2FlyxStatus.pm;h=99c1f6d29326293e2f895b07a2673a38eca43485;hb=cb3922093016875404aedc6d1fcf2e088944b5c9;hp=3fd5cef6210d55205d2c8af0c6651cacda4494a3;hpb=c9e62dec53aee97fff6dffcb6d8ef84331ba5c30;p=lyx.git diff --git a/development/autotests/lyxStatus.pm b/development/autotests/lyxStatus.pm index 3fd5cef621..99c1f6d293 100644 --- a/development/autotests/lyxStatus.pm +++ b/development/autotests/lyxStatus.pm @@ -26,17 +26,18 @@ sub getFileType($); sub getFileIdx($); sub getExt($); sub getResult($); -sub checkForHeader($); +sub checkForHeader($$); sub checkForPreamble($); sub checkForLayoutStart($); sub checkForInsetStart($); sub checkForLatexCommand($); -sub checkLyxLine($); +sub checkLyxLine($$); my @stack = (); # list of HASH-Arrays my $rFont = {}; my $useNonTexFont = "true"; my $inputEncoding = undef; +my $sysdir = undef; # The elements are: # type (layout, inset, header, preamble, ...) @@ -52,6 +53,8 @@ my $inputEncoding = undef; sub initLyxStack($$$) { + use Cwd 'abs_path'; + $rFont = $_[0]; if ($_[1] eq "systemF") { $useNonTexFont = "true"; @@ -64,6 +67,11 @@ sub initLyxStack($$$) $inputEncoding = $_[2]; } $stack[0] = { type => "Starting"}; + my $p = abs_path( __FILE__ ); + $p =~ s/\/development\/autotests\/.*$/\/lib/; + # Save the value to be used as replacement for systemlyxdir in \origin statements + $sysdir = $p; + # print "Sysdir set to $sysdir\n"; } sub diestack($) @@ -193,9 +201,9 @@ sub getResult($) return($m->{"result"}); } -sub checkForHeader($) +sub checkForHeader($$) { - my ($l) = @_; + my ($l, $sourcedir) = @_; if ($l =~ /^\\begin_header\s*$/) { my %selem = (); @@ -235,6 +243,14 @@ sub checkForHeader($) "result" => ["\\inputencoding " . $inputEncoding->{out}]); push(@rElems, $inputenc); } + my $origin = newMatch("search" => qr/^\\origin\s+(\/systemlyxdir)(.*)$/, + "filetype" => "replace_only", + "result" => ["\\origin $sysdir", "2"]); + push(@rElems, $origin); + my $originu = newMatch("search" => qr/^\\origin\s+unavailable/, + "filetype" => "replace_only", + "result" => ["\\origin $sourcedir"]); + push(@rElems, $originu); setMatching(\@rElems); return(1); } @@ -276,7 +292,8 @@ sub checkForLayoutStart($) $selem{name} = $1; unshift(@stack, \%selem); if ($selem{name} =~ /^(Picture|Photo)$/ ) { - my $rElem = newMatch("ext" => [".eps", ".png"], + my $rElem = newMatch("ext" => [".eps", ".png", ""], + "filetype" => "copy_only", "search" => qr/^(.+)/, "result" => ["", "", ""]); setMatching([$rElem]); @@ -356,11 +373,11 @@ sub checkForLatexCommand($) # separator: to be used while concatenating the filenames # filetype: prefix_only,replace_only,copy_only,interpret # 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 (checkForEndBlock($l)); return({"found" => 0}) if (checkForLayoutStart($l));