From 35312cda42884366b54cc683cc9f3ffd9b609e17 Mon Sep 17 00:00:00 2001 From: Vadim Belman Date: Sat, 3 Jun 2017 22:10:19 -0400 Subject: [PATCH] Item14237: Change of class/package topics handling 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. --- core/lib/Foswiki/IncludeHandlers/doc.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/lib/Foswiki/IncludeHandlers/doc.pm b/core/lib/Foswiki/IncludeHandlers/doc.pm index 079ecfb5e2..25ea73e913 100644 --- a/core/lib/Foswiki/IncludeHandlers/doc.pm +++ b/core/lib/Foswiki/IncludeHandlers/doc.pm @@ -177,7 +177,7 @@ sub INCLUDE { $secLine, { _package => -'^(?:---\++)(?:!!)?\h+(?(?i:package|class|role))\h+(?.+?)\h*?$', +'^(?:---\+)(?:!!)?\h+(?(?i:package|class|role))\h+(?.+?)\h*?$', _method => '^(---\++\h+(?Object|Static|Class)(?Method|Attribute)\h+(?(?_?).+?))\h*?$', }, @@ -229,6 +229,7 @@ sub INCLUDE { ) = @{ $ctxSection->{lexemes} } {qw(methodAccess methodType methodText methodPriv)}; + my $anchor; my $methodTextEncoded = Foswiki::entityEncode($methodText); if ( $publicOnly && $methodPriv ) { @@ -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.