~ubuntu-branches/ubuntu/lucid/libxml-libxml-perl/lucid

« back to all changes in this revision

Viewing changes to example/xmllibxmldocs.pl

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2009-05-31 14:36:13 UTC
  • mfrom: (4.1.7 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090531143613-xxpnwmrz62kwtejq
Tags: 1.69.ds-2
* Remove Florian Ragwitz from Uploaders (closes: #523275).
* Set Standards-Version to 3.8.1 (no changes).
* Remove duplicate fields from debian/control.
* Minimize debian/rules, bump quilt and debhelper build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
299
299
        my ( $title ) = $chap->getChildrenByTagName( "title" );
300
300
        my ( $ttlabbr ) = $chap->getChildrenByTagName( "titleabbrev" );
301
301
        my $str =  $ttlabbr->string_value() . " - ".$title->string_value();
302
 
        $self->{OFILE}->print(  "=head1 NAME\n\n$str\n\n" );
 
302
        $str=~s/^\s+|\s+$//g;
 
303
        $self->{OFILE}->print(  "=head1 NAME\n\n$str\n" );
303
304
        my ($synopsis) = $chap->findnodes( "sect1[title='Synopsis']" );
304
305
        my @funcs = $chap->findnodes( ".//funcsynopsis" );
305
306
        if ($synopsis or scalar @funcs) {
306
 
            $self->{OFILE}->print( "=head1 SYNOPSIS\n\n" )
 
307
            $self->{OFILE}->print( "\n=head1 SYNOPSIS\n\n" )
307
308
        }
308
309
        if ($synopsis) {
309
310
          $self->dump_pod( $synopsis );
326
327
             /^(?:itemizedlist|orderedlist|variablelist|programlisting|funcsynopsis)/)
327
328
            ? 1 : 0;
328
329
        my $str = $node->data();
 
330
        $str=~s/(^|\n)[ \t]+($|\n)/$1$2/g;
329
331
        if ($str=~/\S/) {
330
332
          my $string = $str;
331
333
          my $space_before = ($string =~ s/^\s+//g) ? $prev_inline : 0;
409
411
            my ( $term ) = $node->findnodes( "term" );
410
412
            $self->{OFILE}->print( "=item " );
411
413
            if ( defined $term ) {
412
 
                $self->{OFILE}->print( "B<".$term->string_value().">" );
 
414
              $self->dump_pod( $term );
413
415
            }
414
416
            $self->{OFILE}->print( "\n\n" );
415
417
            my @nodes =$node->findnodes( "listitem" );
422
424
            my $str = $node->string_value();
423
425
            $str =~ s/^\s+|\s+$//g;
424
426
            $str =~ s/\n/\n  /g;
 
427
            $str=~s/(^|\n)[ \t]+($|\n)/$1$2/g;
425
428
            $self->{OFILE}->print( "\n\n" );
426
429
            $self->{OFILE}->print( "  ". $str );
427
430
            $self->{OFILE}->print( "\n\n" );
453
456
            my $str = $node->string_value() ;
454
457
            my $url = $node->getAttribute('url');
455
458
            $str =~ s/\n/ /g;
456
 
            $self->{OFILE}->print( "L<<<<<< $str|$url >>>>>>" );
 
459
            if ($str eq $url) {
 
460
              $self->{OFILE}->print( "L<<<<<< $url >>>>>>" );
 
461
            } else {
 
462
              $self->{OFILE}->print( "$str (L<<<<<< $url >>>>>>)" );
 
463
            }
457
464
        } elsif(  $node->nodeName() eq "xref" ) {
458
465
            my $linkend = $node->getAttribute('linkend');
459
 
            my ($target) = $node->findnodes(qq(//*[\@id="$linkend"]/title));
 
466
            my ($target) = $node->findnodes(qq(//*[\@id="$linkend"]/titleabbrev));
 
467
            ($target) = $node->findnodes(qq(//*[\@id="$linkend"]/title)) unless $target;
460
468
            if ($target) {
461
469
              my $str = $target->string_value() ;
462
470
              $str =~ s/\n/ /g;
463
 
              $self->{OFILE}->print( "L<<<<<< $str|$str >>>>>>" );
 
471
              $self->{OFILE}->print( "L<<<<<< $str >>>>>>" );
464
472
            } else {
465
473
              warn "WARNING: Didn't find any section with id='$linkend'\n";
466
474
              $self->{OFILE}->print( "$linkend" );
467
475
            }
468
476
        } elsif(  $node->nodeName() eq "olink" ) {
469
477
            my $str = $node->string_value() ;
470
 
            my $url = $node->getAttribute('target');
 
478
            my $url = $node->getAttribute('targetdoc');
 
479
            if (!defined $url) {
 
480
              warn $node->toString(1),"\n";
 
481
            }
471
482
            $str =~ s/\n/ /g;
472
 
            $self->{OFILE}->print( "L<<<<<< $str|$url >>>>>>" );
 
483
            if ($str eq $url) {
 
484
              $self->{OFILE}->print( "L<<<<<< $url >>>>>>" );
 
485
            } else {
 
486
              $self->{OFILE}->print( "$str (L<<<<<< $url >>>>>>)" );
 
487
            }
473
488
        } else {
474
489
          print STDERR "Ignoring ",$node->nodeName(),"\n";
475
490
          $self->dump_pod($node);