Skip to content

Commit af29967

Browse files
committed
Look for {in,pre,...}fix operators in type docs
1 parent 0e7edc8 commit af29967

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed

htmlify.pl

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ (Bool :$debug, Bool :$typegraph = False)
110110
my $dr = Perl6::Documentable::Registry.new;
111111

112112
say 'Processing Pod files ...';
113-
for (0..* Z @source) -> $num, $_ {
113+
for @source.kv -> $num, $_ {
114114
my $podname = .key;
115115
my $file = .value;
116116
my $what = $podname ~~ /^<[A..Z]> | '::'/ ?? 'type' !! 'language';
@@ -247,37 +247,50 @@ (Bool :$debug, Bool :$typegraph = False)
247247
for @chunks -> $chunk {
248248
my $name = $chunk[0].content[0].content[0];
249249
say "$podname.$name" if $*DEBUG;
250-
next if $name ~~ /\s/;
251250
%methods-by-type{$podname}.push: $chunk;
252-
# determine whether it's a sub or method
253-
my Str $subkind;
254-
{
255-
my %counter;
256-
for first-code-block($chunk).lines {
257-
if ms/^ 'multi'? (sub|method)»/ {
258-
%counter{$0}++;
251+
# check if it's an operator
252+
if $name ~~ /\s/ {
253+
next unless $name ~~ / ^ [in | pre | post | circum | postcircum ] fix | listop /;
254+
my $what = ~$/;
255+
my $operator = $name.split(' ', 2)[1];
256+
$dr.add-new(
257+
:kind<operator>,
258+
:subkind($what),
259+
:name($operator),
260+
:pod($chunk),
261+
:!pod-is-complete,
262+
);
263+
} else {
264+
# determine whether it's a sub or method
265+
my Str $subkind;
266+
{
267+
my %counter;
268+
for first-code-block($chunk).lines {
269+
if ms/^ 'multi'? (sub|method)»/ {
270+
%counter{$0}++;
271+
}
272+
}
273+
if %counter == 1 {
274+
($subkind,) = %counter.keys;
275+
}
276+
if %counter<method> {
277+
write-qualified-method-call(
278+
:$name,
279+
:pod($chunk),
280+
:type($podname),
281+
);
259282
}
260283
}
261-
if %counter == 1 {
262-
($subkind,) = %counter.keys;
263-
}
264-
if %counter<method> {
265-
write-qualified-method-call(
266-
:$name,
267-
:pod($chunk),
268-
:type($podname),
269-
);
270-
}
271-
}
272284

273-
$dr.add-new(
274-
:kind<routine>,
275-
:$subkind,
276-
:$name,
277-
:pod($chunk),
278-
:!pod-is-complete,
279-
:origin($d),
280-
);
285+
$dr.add-new(
286+
:kind<routine>,
287+
:$subkind,
288+
:$name,
289+
:pod($chunk),
290+
:!pod-is-complete,
291+
:origin($d),
292+
);
293+
}
281294
}
282295

283296
spurt "html/$what/$podname.html", p2h($pod);

0 commit comments

Comments
 (0)