Skip to content

Commit

Permalink
Item14237: Change of class/package topics handling
Browse files Browse the repository at this point in the history
They're now accepted as level 1 topics only.

Additionally added experimental readable anchor generation. For a topic
like 'ObjectMethod someMethod( ... )' anchor name
'ObjectMethodsomeMethod' will be generated. Experimental.
  • Loading branch information
vrurg committed Jun 4, 2017
1 parent 47dc0ef commit 35312cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/lib/Foswiki/IncludeHandlers/doc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ sub INCLUDE {
$secLine,
{
_package =>
'^(?:---\++)(?:!!)?\h+(?<pkgType>(?i:package|class|role))\h+(?<pkgName>.+?)\h*?$',
'^(?:---\+)(?:!!)?\h+(?<pkgType>(?i:package|class|role))\h+(?<pkgName>.+?)\h*?$',
_method =>
'^(---\++\h+(?<methodAccess>Object|Static|Class)(?<methodType>Method|Attribute)\h+(?<methodText>(?<methodPriv>_?).+?))\h*?$',
},
Expand Down Expand Up @@ -229,6 +229,7 @@ sub INCLUDE {
)
= @{ $ctxSection->{lexemes} }
{qw(methodAccess methodType methodText methodPriv)};
my $anchor;
my $methodTextEncoded =
Foswiki::entityEncode($methodText);
if ( $publicOnly && $methodPriv ) {
Expand All @@ -246,9 +247,14 @@ sub INCLUDE {
$pluggable =
$Foswiki::ExtManager::pluggables{$class}
{ $+{methodName} } ? "Pluggable " : "";

$anchor = "#"
. $methodAccess
. $methodType
. $+{methodName} . "\n";
}
$pod .=
"\n$secDef =${pluggable}[[$methodAccess$methodType]]= ==$methodTextEncoded==\n";
"\n$anchor$secDef =${pluggable}[[$methodAccess$methodType]]= ==$methodTextEncoded==\n";
}
}
else { # Just plain simple heading.
Expand Down

0 comments on commit 35312cd

Please sign in to comment.