Skip to content

Commit

Permalink
fix problems with Kind not being set
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogamiz committed Aug 5, 2019
1 parent ec99e90 commit 41d9acc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Perl6/Documentable.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Perl6::Documentable {

has Str $.name;
has $.pod;
has $.kind;
has Kind $.kind;
has @.subkinds = [];
has @.categories = [];

Expand Down
6 changes: 3 additions & 3 deletions lib/Perl6/Documentable/File.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class Perl6::Documentable::File is Perl6::Documentable {
:$pod!
) {
# kind and url setting
my $kind = $pod.config<kind>;
die X::Documentable::MissingMetadata.new(:$filename, metadata => "kind") unless $kind;
my $kind = Kind(Kind.enums{ $pod.config<kind> });
die X::Documentable::MissingMetadata.new(:$filename, metadata => "kind") unless defined $kind;
my $url = "/{$kind.lc}/$filename";

# proper name from =TITLE
Expand All @@ -66,7 +66,7 @@ class Perl6::Documentable::File is Perl6::Documentable {
unless ($subtitle ~~ Pod::Block::Named and $subtitle.name eq "SUBTITLE");
my $summary = recurse-until-str($subtitle);

# type-graph sets the correct subkind and categories
# use metadata in pod config
my @subkinds = $pod.config<subkind>.List;
my @categories = $pod.config<category>.List;

Expand Down
8 changes: 5 additions & 3 deletions t/201-documentable-file.t
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,19 @@ subtest "Index X<> heading" => {

# check exceptions

=begin pod
=begin pod :kind("Type") :subkind(" ") :category(" ")
Test
=end pod

=begin pod
=begin pod :kind("Type") :subkind(" ") :category(" ")
=TITLE test
=end pod

=begin pod
=begin pod :kind("Type") :subkind(" ") :category(" ")
=SUBTITLE test
Expand Down

0 comments on commit 41d9acc

Please sign in to comment.