Ignore:
Timestamp:
2008-02-27T17:07:17+13:00 (16 years ago)
Author:
davidb
Message:

Marc mapping upgraded to support richer set of operations, including subfields, multiple fields in one line (separated by comma), and the removal of rules, e.g. -245 at the start of a line. A Marc to Qualified Dublin Core crosswalk from the Library of congress has been added as "etc/marc2qdc.txt". A collection can then choose to, for example, top up the mapping with its own version of the file stored in its local "etc" folder, specifying only the rules that are different. This is where a rule like "-245" might be used to override a more general rule from the main file that has all subfields in 245 mapping to one metadata item (Title). If the user specifies a different different filename -- through a plugin option -- then they are free to divise a mapping from scratch and store it in the collections local "etc" folder.

File:
1 edited

Legend:

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

    r14661 r15018  
    7171#<PagedDocument>
    7272#<Metadata name="Title">The Title of the entire document</Metadata>
    73 #<Page pagenum="1" imgfile="xxx.jpg" txtfile="yyy.jpg">
     73#<Page pagenum="1" imgfile="xxx.jpg" txtfile="yyy.txt">
    7474#<Metadata name="Title">The Title of this page</Metadata>
    7575#</Page>
     
    257257    my $self = shift (@_);
    258258   
    259     return q^(?i)(\.jpe?g|\.gif|\.png|\.tif?f|\.te?xt|~)$^
     259    return q^(?i)(\.jpe?g|\.gif|\.png|\.tif?f|\.te?xt|\.html?|~)$^
    260260}
    261261
     
    937937    $text =~ s/\\/\\\\/g; # macro language
    938938    $text =~ s/_/\\_/g; # macro language
    939     $text =~ s/</&lt;/g;
    940     $text =~ s/>/&gt;/g;
    941  
    942     # insert preformat tags and add text to document object
    943     $doc_obj->add_utf8_text($cursection, "<pre>\n$text\n</pre>");
     939
     940
     941    if ($text =~ m/<html.*?>\s*<head.*?>.*<\/head>\s*<body.*?>(.*)<\/body>\s*<\/html>\s*$/s) {
     942    # looks like HTML input
     943    # no need to escape < and > or put in <pre> tags
     944
     945    $text = $1;
     946
     947    # insert preformat tags and add text to document object
     948    $doc_obj->add_utf8_text($cursection, "$text");
     949    }
     950    else {
     951    $text =~ s/</&lt;/g;
     952    $text =~ s/>/&gt;/g;
     953
     954    # insert preformat tags and add text to document object
     955    $doc_obj->add_utf8_text($cursection, "<pre>\n$text\n</pre>");
     956    }
     957
    944958   
    945959    return 1;
Note: See TracChangeset for help on using the changeset viewer.