Skip to content

Commit 8693f41

Browse files
committed
add support for copying lists in head3 sections
1 parent 9ca7f29 commit 8693f41

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

Porting/merge-deltas.pl

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,41 @@ ( $tree, $directive, $pos = 0 )
125125
->@[ 2 .. $delta->[$delta_list_pos]->$#* ];
126126
},
127127

128+
# =item entries inside a =head3
129+
item_head3 => sub ( $master, $title, $delta ) {
130+
131+
# find the section in the delta and master
132+
my ( $master_pos, $delta_pos ) =
133+
map header_pos( $_, 1, $title ),
134+
$master, $delta;
135+
136+
# loop over the =head2 in the section
137+
while ( $delta_pos = next_header_pos( $delta, 2, $delta_pos ) ) {
138+
139+
my $section_title = $delta->[$delta_pos][2];
140+
$master_pos = # find the same =head2 in the master
141+
header_pos( $master, 2, $section_title, $master_pos );
142+
143+
# loop over the =head3 in the section
144+
while ( $delta_pos = next_header_pos( $delta, 3, $delta_pos ) ) {
145+
$section_title = $delta->[$delta_pos][2];
146+
$master_pos = # find the same =head2 in the master
147+
header_pos( $master, 3, $section_title, $master_pos );
148+
149+
# find the =over in both
150+
my ( $master_list_pos, $delta_list_pos ) = (
151+
next_directive_pos( $master, 'over-bullet', $master_pos ),
152+
next_directive_pos( $delta, 'over-bullet', $delta_pos )
153+
);
154+
155+
# inject the list from delta into the master
156+
push $master->[$master_list_pos]->@*,
157+
$delta->[$delta_list_pos]
158+
->@[ 2 .. $delta->[$delta_list_pos]->$#* ];
159+
}
160+
}
161+
},
162+
128163
# copy the whole section content
129164
copy => sub ( $master, $title, $delta ) {
130165

@@ -193,7 +228,7 @@ ( $tree, $directive, $pos = 0 )
193228
'Performance Enhancements' => 'item',
194229
'Modules and Pragmata' => 'skip',
195230
'Documentation' => 'head3',
196-
'Diagnostics' => 'skip',
231+
'Diagnostics' => 'item_head3',
197232
'Utility Changes' => 'head2',
198233
'Configuration and Compilation' => 'item',
199234
'Testing' => 'item',

0 commit comments

Comments
 (0)