# convert lyx file to be compilable with xetex
-my ($source, $dest, $format, $fontT, $languageFile, $rest) = @ARGV;
+my ($source, $dest, $format, $fontT, $encodingT, $languageFile, $rest) = @ARGV;
my %encodings = (); # Encoding with TeX fonts, depending on language tag
diestack("Too many arguments") if (defined($rest));
diestack("Destfilename not defined") if (! defined($dest));
diestack("Format (e.g. pdf4) not defined") if (! defined($format));
diestack("Font type (e.g. texF) not defined") if (! defined($fontT));
+diestack("Encoding (e.g. ascii) not defined") if (! defined($encodingT));
$source = File::Spec->rel2abs($source);
$dest = File::Spec->rel2abs($dest);
$font{sans} = "DejaVu Sans";
$font{typewriter} = "DejaVu Sans Mono";
}
- elsif ($lang =~ /^(he|el|main)$/) {
+ elsif ($lang =~ /^(he)$/) {
$font{roman} = "FreeSans";
$font{sans} = "FreeSans";
$font{typewriter} = "FreeSans";
$font{typewriter} = "FreeMono";
}
}
+elsif ($encodingT ne "default") {
+ # set input encoding to the requested value
+ $inputEncoding = {
+ "search" => '.*', # this will be substituted from '\inputencoding'-line
+ "out" => $encodingT,
+ };
+}
elsif (0) { # set to '1' to enable setting of inputencoding
# use tex font here
my %encoding = ();
my $sourcedir = dirname($source);
my $destdir = dirname($dest);
if (! -d $destdir) {
- diestack("could not make dir \"$destdir\"") if (! mkdir $destdir);
+ diestack("could not make dir \"$destdir\"") if (! mkpath $destdir);
}
my $destdirOfSubdocuments;
if(-d $destdirOfSubdocuments) {
rmtree($destdirOfSubdocuments);
}
-mkdir($destdirOfSubdocuments); # for possibly included files
+mkpath($destdirOfSubdocuments); # for possibly included files
my %IncludedFiles = ();
my %type2hash = (
initLyxStack(\%font, $fontT, $inputEncoding);
while (my $l = <FI>) {
- chomp($l);
+ $l =~ s/[\n\r]+$//;
+ #chomp($l);
my $rStatus = checkLyxLine($l);
if ($rStatus->{found}) {
my $rF = $rStatus->{result};