Skip to content

Commit eecc292

Browse files
committed
introduce Perl6::Documentable::Registry, and start to populate it. No way to retrieve those objects yet
1 parent 05d0485 commit eecc292

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

htmlify.pl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use lib 'lib';
1010
use Perl6::TypeGraph;
1111
use Perl6::TypeGraph::Viz;
12+
use Perl6::Documentable::Registry;
1213

1314
sub url-munge($_) {
1415
return $_ if m{^ <[a..z]>+ '://'};
@@ -88,6 +89,7 @@ (Bool :$debug, Bool :$typegraph = False)
8889
}
8990
say "... done";
9091

92+
my $dr = Perl6::Documentable::Registry.new;
9193

9294
for (@source) {
9395
my $podname = .key;
@@ -110,21 +112,35 @@ (Bool :$debug, Bool :$typegraph = False)
110112
next unless $heading ~~ / ^ [in | pre | post | circum | postcircum ] fix /;
111113
my $what = ~$/;
112114
my $operator = $heading.split(' ', 2)[1];
115+
$dr.add-new(
116+
:kind<operator>,
117+
:subkind($what),
118+
:pod($chunk),
119+
:!pod-is-complete,
120+
:name($operator),
121+
);
113122
%names{$operator}{$what} = "/language/operators#$what%20" ~ uri_escape($operator);
114123
if %operators{$what}{$operator} {
115124
die "Operator $what $operator defined twice in lib/operators.pod";
116125
}
117126
%operators{$what}{$operator} = $chunk;
118127
}
119128
}
129+
$dr.add-new(
130+
:kind<language>,
131+
:name($podname),
132+
:$pod,
133+
:pod-is-complete,
134+
);
135+
120136
next;
121137
}
122138
$pod = $pod[0];
123139

124140
say pod-gist($pod) if $*DEBUG;
125141
my @chunks = chunks-grep($pod.content,
126142
:from({ $_ ~~ Pod::Heading and .level == 2}),
127-
:to({ $^b ~~ Pod::Heading and $^b.level <= $^a.level}),
143+
:to({ $^b ~~ Pod::Heading and $^b.level <= $^a.level}),
128144
);
129145
for @chunks -> $chunk {
130146
my $name = $chunk[0].content[0].content[0];

lib/Perl6/Documentable.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class Perl6::Documentable {
1010
method human-kind() { # SCNR
1111
$.kind eq 'operator'
1212
?? "$.subkind operator"
13+
!! $.kind eq 'language'
14+
?? 'language documentation'
1315
!! $.subkind // $.kind;
1416
}
1517

lib/Perl6/Documentable/Registry.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use v6;
2+
use Perl6::Documentable;
3+
4+
class Perl6::Documentable::Registry {
5+
has @!documentables;
6+
method add-new(*%args) {
7+
@!documentables.push: Perl6::Documentable.new(|%args);
8+
1;
9+
}
10+
}

0 commit comments

Comments
 (0)