File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 9
9
use lib ' lib' ;
10
10
use Perl6::TypeGraph;
11
11
use Perl6::TypeGraph::Viz;
12
+ use Perl6::Documentable::Registry;
12
13
13
14
sub url-munge ($ _ ) {
14
15
return $ _ if m {^ <[ a..z ] >+ '://' };
@@ -88,6 +89,7 @@ (Bool :$debug, Bool :$typegraph = False)
88
89
}
89
90
say " ... done" ;
90
91
92
+ my $ dr = Perl6::Documentable::Registry. new ;
91
93
92
94
for (@ source ) {
93
95
my $ podname = . key ;
@@ -110,21 +112,35 @@ (Bool :$debug, Bool :$typegraph = False)
110
112
next unless $ heading ~~ / ^ [in | pre | post | circum | postcircum ] fix /;
111
113
my $ what = ~ $/ ;
112
114
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
+ );
113
122
% names {$ operator }{$ what } = " /language/operators#$ what %20" ~ uri_escape($ operator );
114
123
if % operators {$ what }{$ operator } {
115
124
die " Operator $ what $ operator defined twice in lib/operators.pod" ;
116
125
}
117
126
% operators {$ what }{$ operator } = $ chunk ;
118
127
}
119
128
}
129
+ $ dr . add-new(
130
+ : kind<language >,
131
+ : name($ podname ),
132
+ : $ pod ,
133
+ : pod-is-complete,
134
+ );
135
+
120
136
next ;
121
137
}
122
138
$ pod = $ pod [0 ];
123
139
124
140
say pod-gist($ pod ) if $ * DEBUG ;
125
141
my @ chunks = chunks-grep($ pod . content,
126
142
: 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}),
128
144
);
129
145
for @ chunks -> $ chunk {
130
146
my $ name = $ chunk [0 ]. content[0 ]. content[0 ];
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class Perl6::Documentable {
10
10
method human-kind () { # SCNR
11
11
$ . kind eq ' operator'
12
12
?? " $ . subkind operator"
13
+ !! $ . kind eq ' language'
14
+ ?? ' language documentation'
13
15
!! $ . subkind // $ . kind ;
14
16
}
15
17
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments