}
# Prototypes
-sub initLyxStack($$);
+sub initLyxStack($$$);
sub diestack($);
sub closeLyxStack();
sub setMatching($);
my @stack = (); # list of HASH-Arrays
my $rFont = {};
my $useNonTexFont = "true";
+my $inputEncoding = undef;
# The elements are:
# type (layout, inset, header, preamble, ...)
# but first set the modified value into $result->[$fileidx]
# numerical value will be replaced with appropriate matching group value
-sub initLyxStack($$)
+sub initLyxStack($$$)
{
$rFont = $_[0];
if ($_[1] eq "systemF") {
}
else {
$useNonTexFont = "false";
+ $inputEncoding = $_[2];
}
$stack[0] = { type => "Starting"};
}
"result" => ["\\master ", ""]);
if (keys %{$rFont}) {
for my $ff ( keys %{$rFont}) {
- my $elem = newMatch("search" => '^\\\\font_' . $ff . '\s+',
+ # fontentry of type '\font_roman default'
+ my $elem = newMatch("search" => '^\\\\font_' . $ff . '\s+[^"]*\s*$',
"filetype" => "replace_only",
"result" => ["\\font_$ff ", $rFont->{$ff}]);
- push(@rElems, $elem);
+ # fontentry of type '\font_roman "default"'
+ my $elem1 = newMatch("search" => '^\\\\font_' . $ff . '\s+"[^"]*"\s*$',
+ "filetype" => "replace_only",
+ "result" => ["\\font_$ff \"", $rFont->{$ff}, '"']);
+ # fontentry of type '\font_roman "default" "default"'
+ my $elem2 = newMatch("search" => '^\\\\font_' . $ff . '\s+"(.*)"\s+"(.*)"\s*$',
+ "filetype" => "replace_only",
+ "result" => ["\\font_$ff ", '"', "1", '" "', $rFont->{$ff}, '"']);
+ push(@rElems, $elem, $elem1, $elem2);
}
}
my $elemntf = newMatch("search" => '^\\\\use_non_tex_fonts\s+(false|true)',
"filetype" => "replace_only",
"result" => ["\\use_non_tex_fonts $useNonTexFont"]);
push(@rElems, $elemntf);
+ if (defined($inputEncoding)) {
+ my $inputenc = newMatch("search" => '^\\\\inputencoding\s+(' . $inputEncoding->{search} . ')',
+ "filetype" => "replace_only",
+ "result" => ["\\inputencoding " . $inputEncoding->{out}]);
+ push(@rElems, $inputenc);
+ }
setMatching(\@rElems);
return(1);
}