Changeset 10496


Ignore:
Timestamp:
2005-08-11T17:27:49+12:00 (19 years ago)
Author:
kjdon
Message:

added some sanity checks, renamed the checkout_toc option to delete_toc

Location:
trunk/gsdl/perllib/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/StructuredHTMLPlug.pm

    r10443 r10496  
    9696    my $body_text = join("<body", @head_and_body);
    9797   
    98     if (defined $self->{'extracted_word_metadata_fields'}) {
     98    if (defined $self->{'extracted_word_metadata_fields'} && $self->{'extracted_word_metadata_fields'}=~ /\S/) {
    9999    my @doc_properties = split(/<xml>/i,$head);
    100100    my $doc_heading = shift(@doc_properties);
     
    105105    }
    106106   
    107     # If checkout_toc is enables, it means to get rid of toc and tof contents.
     107    # If delete_toc is enables, it means to get rid of toc and tof contents.
    108108    # get rid of TOC and TOF sections and their title
    109     if (defined $self->{'checkout_toc'}){
     109    if ($self->{'delete_toc'} == 1){
    110110    #line-height:150%;mso-ansi-language:FR'>Contents<o:p></o:p></span></b></p>
    111111    # get rid of Table of Contents title and Table of Figures
     112    # these two lines don't work - how can we do this properlly??
    112113    #$body_text =~ s/<p[^>]*><b><span[^>]*>(Table of Content.|Content.)<o:p><\/o:p><\/span><\/b><\/p>//isg;
    113114    #$body_text =~ s/<p[^>]*><b><span[^>]*>(Table of Figure.|Figure.)<o:p><\/o:p><\/span><\/b><\/p>//isg;
    114     $body_text =~ s/<p class=(($self->{'toc_header'})[^>]*)>(.+?)<\/p>//isg;
    115     $body_text =~ s/<p class=(($self->{'tof_header'})[^>]*)>(.+?)<\/p>//isg;
    116     }
    117 
    118     if (defined $self->{'title_header'}){
     115    if (defined $self->{'toc_header'}&& $self->{'toc_header'} =~ /\S/){
     116        $body_text =~ s/<p class=(($self->{'toc_header'})[^>]*)>(.+?)<\/p>//isg;
     117    }
     118    if (defined $self->{'tof_header'}&& $self->{'tof_header'}=~ /\S/) {
     119        $body_text =~ s/<p class=(($self->{'tof_header'})[^>]*)>(.+?)<\/p>//isg;
     120    }
     121    }
     122
     123    if (defined $self->{'title_header'} && $self->{'title_header'}=~ /\S/){
    119124    $self->{'title_header'} =~ s/^(\()(.*)(\))/$2/is;
    120125    $body_text =~ s/<p class=(($self->{'title_header'})[^>]*)>(.+?)<\/p>/<p class=$1><title>$3<\/title><\/p>/isg;
     
    126131    }
    127132   
    128     if (defined $self->{'level2_header'}){
     133    if (defined $self->{'level2_header'} && $self->{'level2_header'}=~ /\S/){
    129134    $self->{'level2_header'} =~ s/^\((.*)\)/$1/i;
    130135    $body_text =~ s/<p class=(($self->{'level2_header'})[^>]*)>(.+?)<\/p>/<p class=$1><h2>$3<\/h2><\/p>/ig;
    131136    }
    132137   
    133     if (defined $self->{'level3_header'}&& $self->{'level3_header'}=~ /\S/ ){
     138    if (defined $self->{'level3_header'} && $self->{'level3_header'}=~ /\S/ ){
    134139    $self->{'level3_header'} =~ s/^\((.*)\)/$1/is;
    135140    $body_text =~ s/<p class=(($self->{'level3_header'})[^>]*)>(.+?)<\/p>/<p class=$1><h3>$3<\/h3><\/p>/isg;
  • trunk/gsdl/perllib/plugins/WordPlug.pm

    r10441 r10496  
    2828
    2929use ConvertToPlug;
    30 require StructuredHTMLPlug;
    3130use strict;
    3231no strict 'refs'; # allow filehandles to be variables and viceversa
    3332
    3433sub BEGIN {
    35     #@WordPlug::ISA = ('ConvertToPlug','StructuredHTMLPlug');
    3634    @WordPlug::ISA = ('ConvertToPlug');
    3735}
     
    6159             'type' => "flag",
    6260                 'reqd' => "no" },
    63                { 'name' => "checkout_toc",
    64              'desc' => "{WordPlug.checkout_toc}",
     61               { 'name' => "delete_toc",
     62             'desc' => "{WordPlug.delete_toc}",
    6563             'type' => "flag",
    6664             'reqd' => "no"},
     
    127125        push (@$structhtml_options , "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
    128126        push (@$structhtml_options, "-description_tags") if $self->{'windows_scripting'};
    129         push (@$structhtml_options, "-checkout_toc") if $self->{'checkout_toc'};
     127        push (@$structhtml_options, "-delete_toc") if $self->{'delete_toc'};
    130128        push (@$structhtml_options, "-toc_header", $self->{'toc_header'}) if $self->{'toc_header'};
    131129        push (@$structhtml_options, "-tof_header", $self->{'tof_header'}) if $self->{'tof_header'};
Note: See TracChangeset for help on using the changeset viewer.