return 1;
}
+sub _parse_config_option {
+ my $self = shift;
+ my $line = shift;
+
+ $line =~ s/^\s*//;
+ $line =~ s/\s*$//;
+
+ my ($key, $value) = split m/\s*=\s*/, $line, 2;
+
+ if ($key eq 'tag-style') {
+ $self->set_tag_style(split(m/\s+/, $value, 2));
+ }
+}
+
+sub _parse_config_lines {
+ my $self = shift;
+ my $lines = shift;
+
+ my ($comment_start, $comment_end) = ("", "");
+
+ if (ref $self eq 'LaTeXTemplate') {
+ $comment_start = '\s*%';
+ } elsif (ref $self eq 'HTMLTemplate') {
+ $comment_start = '\s*<!--';
+ $comment_end = '>\s*';
+ } else {
+ $comment_start = '\s*\#';
+ }
+
+ my $num_lines = scalar @{ $lines };
+ my $i = 0;
+
+ while ($i < $num_lines) {
+ my $line = $lines->[$i];
+
+ if ($line !~ m/^${comment_start}\s*config\s*:(.*)${comment_end}$/i) {
+ $i++;
+ next;
+ }
+
+ $self->_parse_config_option($1);
+ splice @{ $lines }, $i, 1;
+ $num_lines--;
+ }
+}
+
sub parse {
my $self = $_[0];
local *OUT = $_[1];
my @lines = <IN>;
close(IN);
- return 0 if (!$self->parse_first_line($lines[0]));
+ $self->_parse_config_lines(\@lines);
my $contents = join("", @lines);
return 0;
}
- $form->{tmpfile} =~ s/$userspath\///g;
+ $form->{tmpfile} =~ s/\Q$userspath\E\///g;
for (my $run = 1; $run <= 2; $run++) {
system("latex --interaction=nonstopmode $form->{tmpfile} " .
return 0;
}
- $form->{tmpfile} =~ s/$userspath\///g;
+ $form->{tmpfile} =~ s/\Q$userspath\E\///g;
for (my $run = 1; $run <= 2; $run++) {
system("pdflatex --interaction=nonstopmode $form->{tmpfile} " .
return 0;
}
- $form->{"tmpfile"} =~ s/$userspath\///g;
+ $form->{"tmpfile"} =~ s/\Q$userspath\E\///g;
my $psfile = $form->{"tmpfile"};
$psfile =~ s/.html/.ps/;
if ($psfile eq $form->{"tmpfile"}) {
return 0;
}
- $form->{"tmpfile"} =~ s/$userspath\///g;
+ $form->{"tmpfile"} =~ s/\Q$userspath\E\///g;
my $pdffile = $form->{"tmpfile"};
$pdffile =~ s/.html/.pdf/;
if ($pdffile eq $form->{"tmpfile"}) {
foreach my $key (keys(%markup_replace)) {
my $value = $markup_replace{$key};
- $variable =~ s|\<${key}\>|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi;
+ $variable =~ s|\<${key}\>|<text:span text:style-name=\"TLXO${rnd}${value}\">|gi; #"
$variable =~ s|\</${key}\>|</text:span>|gi;
}