rjbs / Pod-Weaver

recombine pod documents into awesomer pod documents
26 stars 28 forks source link

Pod::Weaver::Section::Collect should gather up and include any existing section of the same name #22

Closed karenetheridge closed 9 years ago

karenetheridge commented 10 years ago

I've got this in my weaver.ini:

[Collect / TYPES]
command = type

and this in my pod:

=head1 DESCRIPTION

...

=head1 TYPES

Multiple types are available, blah blah blah...

=type Foo

...

=type Bar

...

Which results in this woven pod:

=head1 DESCRIPTION

...

=head1 TYPES

=head2 Foo

...

=head2 Bar

...

=head1 TYPES

Multiple types are available, blah blah blah...

Is it possible to combine the existing 'TYPES' section in the original with the generated =head1 TYPES section?

I'd patch, but I don't know where to start.

rjbs commented 10 years ago

I have meant to include this behavior from the start, but I knew I could get by without it indefinitely, and was just waiting for some sucker to offer to write a patch.

I'd patch, but I don't know where to start.

Did I say sucker? I meant hero.

The new "=head1 TYPES" is created by this code:

my $container = Pod::Elemental::Element::Nested->new({
  command => $self->header_command,
  content => $self->header,
});

$self->__used_container($container);

You should make that code first look for any existing element like that (Pod::Elemental::Selectors may help?) and remove it from the document, making it the container instead.

Be considerate of what happens if it has children already.

rjbs

rjbs commented 9 years ago

fixed by #28!

karenetheridge commented 9 years ago

@wchristian my hero!