From 41d9acce7c9b054302d53c741461b5b87cf18a3a Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 5 Aug 2019 13:46:44 +0200 Subject: [PATCH] fix problems with Kind not being set --- lib/Perl6/Documentable.pm6 | 2 +- lib/Perl6/Documentable/File.pm6 | 6 +++--- t/201-documentable-file.t | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Perl6/Documentable.pm6 b/lib/Perl6/Documentable.pm6 index cb2ae67..87bc2d6 100644 --- a/lib/Perl6/Documentable.pm6 +++ b/lib/Perl6/Documentable.pm6 @@ -11,7 +11,7 @@ class Perl6::Documentable { has Str $.name; has $.pod; - has $.kind; + has Kind $.kind; has @.subkinds = []; has @.categories = []; diff --git a/lib/Perl6/Documentable/File.pm6 b/lib/Perl6/Documentable/File.pm6 index ca1ccbe..23db3d7 100644 --- a/lib/Perl6/Documentable/File.pm6 +++ b/lib/Perl6/Documentable/File.pm6 @@ -49,8 +49,8 @@ class Perl6::Documentable::File is Perl6::Documentable { :$pod! ) { # kind and url setting - my $kind = $pod.config; - die X::Documentable::MissingMetadata.new(:$filename, metadata => "kind") unless $kind; + my $kind = Kind(Kind.enums{ $pod.config }); + die X::Documentable::MissingMetadata.new(:$filename, metadata => "kind") unless defined $kind; my $url = "/{$kind.lc}/$filename"; # proper name from =TITLE @@ -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.List; my @categories = $pod.config.List; diff --git a/t/201-documentable-file.t b/t/201-documentable-file.t index 7e40c4e..28483e1 100644 --- a/t/201-documentable-file.t +++ b/t/201-documentable-file.t @@ -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