Skip to content

Commit 10be05c

Browse files
committed
Attempt to process all pod files
Unsure if the right move here is to convert everything to string when needed, or if we should have converted it to string when trying to save it.
1 parent 57d5109 commit 10be05c

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

htmlify.p6

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,9 @@ sub process-pod-dir($dir, :&sorted-by = &[cmp]) {
207207
my $total = +@pod-sources;
208208
my $kind = $dir.lc;
209209
for @pod-sources.kv -> $num, (:key($filename), :value($file)) {
210-
try {
211-
printf "% 4d/%d: % -40s => %s\n", $num+1, $total, $file.path, "$kind/$filename";
212-
my $pod = extract-pod($file.path);
213-
process-pod-source :$kind, :$pod, :$filename, :pod-is-complete;
214-
CATCH {
215-
note "Error Processing: $filename";
216-
.resume;
217-
}
218-
}
210+
printf "% 4d/%d: % -40s => %s\n", $num+1, $total, $file.path, "$kind/$filename";
211+
my $pod = extract-pod($file.path);
212+
process-pod-source :$kind, :$pod, :$filename, :pod-is-complete;
219213
}
220214
}
221215

@@ -565,7 +559,7 @@ sub find-definitions(:$pod, :$origin, :$min-level = -1, :$url) {
565559

566560
my $new-head = Pod::Heading.new(
567561
:level(@pod-section[$i].level),
568-
:contents[pod-link "($origin.name()) $subkinds $name",
562+
:contents[pod-link "($origin.name()) $subkinds {$name.gist}",
569563
$created.url ~ "#$origin.human-kind() $origin.name()".subst(:g, /\s+/, '_')
570564
]
571565
);
@@ -674,7 +668,7 @@ sub write-search-file() {
674668
$s.trans([</ \\ ">] => [<\\/ \\\\ \\">]);
675669
}
676670
my @items = $*DR.get-kinds.map(-> $kind {
677-
$*DR.lookup($kind, :by<kind>).categorize({escape .name})\
671+
$*DR.lookup($kind, :by<kind>).categorize({escape .name.gist})\
678672
.pairs.sort({.key}).map: -> (:key($name), :value(@docs)) {
679673
qq[[\{ category: "{
680674
( @docs > 1 ?? $kind !! @docs.[0].subkinds[0] ).wordcase
@@ -868,7 +862,7 @@ sub write-kind($kind) {
868862
}
869863
.pod[0].contents[0].contents.Str.split(' ')[1] ~ '_';
870864
}
871-
) ~ .name.subst(' ', '_')),
865+
) ~ .name.gist.subst(' ', '_')),
872866
),
873867
.pod.list,
874868
})

lib/Perl6/Documentable.pm6

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use URI::Escape;
22
class Perl6::Documentable {
3-
has Str $.kind; # type, language doc, routine, module
4-
has Str @.subkinds; # class/role/enum, sub/method, prefix/infix/...
5-
has Str @.categories; # basic type, exception, operator...
3+
has $.kind; # type, language doc, routine, module
4+
has @.subkinds; # class/role/enum, sub/method, prefix/infix/...
5+
has @.categories; # basic type, exception, operator...
66

7-
has Str $.name;
8-
has Str $.url;
7+
has $.name;
8+
has $.url;
99
has $.pod;
10-
has Bool $.pod-is-complete;
11-
has Str $.summary = '';
10+
has $.pod-is-complete;
11+
has $.summary = '';
1212

1313
# the Documentable that this one was extracted from, if any
1414
has $.origin;
@@ -33,8 +33,8 @@ class Perl6::Documentable {
3333

3434
method url() {
3535
$!url //= $.kind eq 'operator'
36-
?? "/language/operators#" ~ uri_escape("@.subkinds[] $.name".subst(/\s+/, '_', :g))
37-
!! ("", $.kind, $.name).map(&uri_escape).join('/')
36+
?? "/language/operators#" ~ uri_escape("@.subkinds[] {$.name.gist}".subst(/\s+/, '_', :g))
37+
!! ("", $.kind, $.name.gist).map(&uri_escape).join('/')
3838
;
3939
}
4040
method categories() {

lib/Pod/Htmlify.pm6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ my \length = @badchars.elems;
2525
sub replace-badchars-with-goodnames($s is copy) is export {
2626
# return $s if $s ~~ m{^ <[a..z]>+ '://'}; # bail on external links
2727

28+
return "" unless $s; # Avoid issues with Any being passed in. TODO avoid passing it in!
2829
loop (my int $i = 0; $i < length; $i++) {
29-
$s = $s.subst(@badchars[$i], goodnames[$i], :g)
30+
$s = $s.gist.subst(@badchars[$i], goodnames[$i], :g)
3031
}
3132

3233
$s

0 commit comments

Comments
 (0)