Subject: | FormatRTF::format_string($string, <options>) ignores options |
Date: | Sun, 4 Apr 2010 10:40:13 +0100 |
To: | bug-HTML-Format [...] rt.cpan.org |
From: | Allan Kelly <allankelly [...] gmail.com> |
Hi, many thanks for this very useful utility. I am using it to
auto-publish Drafts of my MSc dissertation.
I have found that options passed to format_string are not used.
Documentation says that various options can be passed.
$HTML::FormatRTF::VERSION == 2.04
The simplest code to reproduce this (unix command-line):
$ echo "<html><body><H1>Hello</H1><p>world</p>" | perl -MHTML::FormatRTF -e '
print HTML::FormatRTF->format_string(<STDIN>,
"fontname_body"=>"Verdana")'
... and you will see that the font-table specifies the default of Times:
{\fonttbl
{\f0\froman Times;}
{\f1\fmodern Courier New;}
{\f2\fswiss Arial;}
}
The patch below fixes this:
diff -Naur 2.04/FormatRTF.pm patch/FormatRTF.pm
--- 2.04/FormatRTF.pm 2010-04-04 10:21:58.000000000 +0100
+++ patch/FormatRTF.pm 2010-04-04 10:22:51.000000000 +0100
@@ -34,6 +34,10 @@
my($self,$hash) = @_;
$self->{lm} = 0;
$self->{rm} = 0;
+# 20100404 AllanKelly@gmail.com
+# This sub does NOTHING with the args hash!
+# The map below fixes that.
+ map {$self->{$_} = $hash->{$_}} keys %$hash if(ref($hash));
$self;
}
I hope that is of assistance.
Cheers, al.