Skip Menu |
 

This queue is for tickets about the HTML-Format CPAN distribution.

Report information
The Basics
Id: 18125
Status: open
Priority: 0/
Queue: HTML-Format

People
Owner: nigel.metheringham [...] gmail.com
Requestors: william [...] knowmad.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.04
Fixed in: (no value)

Attachments


Subject: PATCH - Add centering support for p and h# tags
Download (untitled) / with headers
text/plain 203b
Hi Sean, I've attached a patch against v2.04 of FormatRTF.pm which adds support for centering to header and paragraph tags. Thanks for creating an excellent tool for doing HTML-RTF conversion. William
Subject: FormatRTF.pm.diff
Download FormatRTF.pm.diff
text/x-diff 1.5k
--- HTML-Format-2.04/lib/HTML/FormatRTF.pm 2004-06-02 03:47:44.000000000 -0400 +++ HTML/FormatRTF.pm 2006-03-11 13:24:34.000000000 -0500 @@ -304,14 +304,23 @@ # This really should have been called heading_start, but it's too late # to change now. - my($self, $level) = @_; + my($self, $level, $node) = @_; DEBUG > 1 and print " Heading of level $level\n"; #$self->adjust_lm(0); # assert new paragraph $self->vspace(1.5); - $self->out( \( sprintf '\s3%s\ql\keepn\f2\fs%s\ul'."\n", + my $align = $node->attr('align'); + if (defined($align) && lc($align) eq 'center') { + $align = 'qc'; + } + else { + $align = 'ql'; + } + + $self->out( \( sprintf '\s3%s\%s\keepn\f2\fs%s\ul'."\n", $level, + $align, $self->{'head' . $level .'_halfpoint_size'}, $level, )); @@ -378,6 +387,32 @@ sub strike_start { shift->out( \'{\strike ') } sub strike_end { shift->out( \'}' ) } +sub p_start +{ + my ($self, $node) = @_; + + my $align = $node->attr('align'); + if (defined($align) && lc($align) eq 'center') { + $self->{center}++; + } + #$self->adjust_lm(0); # assert new paragraph + $self->vspace(1); + # assert one line's worth of vertical space at para-start + $self->out(''); + 1; +} + +sub p_end +{ + my ($self, $node) = @_; + $self->vspace(1); + # assert one line's worth of vertical space at para-end + my $align = $node->attr('align'); + if (defined($align) && lc($align) eq 'center') { + $self->{center}--; + } +} + sub q_start { my $self = $_[0]; $self->out(
Download (untitled) / with headers
text/plain 300b
I am picking up maintenance for this module. Although I haven't included this ticket in the set I am dealing with for 2.05, if you have any other current modifications then pelase let me know and I'll look at for the next release. See GitHub repo at https://github.com/nigelm/HTML-Format/ Nigel.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.