Changeset 920 for trunk/core/lib/Foswiki.pm
- Timestamp:
- 11/24/08 14:27:56 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki.pm
r840 r920 193 193 ATTACHURL => \&ATTACHURL, 194 194 ATTACHURLPATH => \&ATTACHURLPATH, 195 COREPOD => \&COREPOD, 195 196 DATE => \&DATE, 196 197 DISPLAYTIME => \&DISPLAYTIME, … … 3553 3554 || $this->{prefs}->getPreferencesValue('INCLUDEWARNING'); 3554 3555 3555 if ( $path =~ /^https? \:/ ) {3556 if ( $path =~ /^https?:/ ) { 3556 3557 3557 3558 # include web page 3558 return _includeUrl( $this,$path, $pattern, $includingWeb,3559 return $this->_includeUrl( $path, $pattern, $includingWeb, 3559 3560 $includingTopic, $raw, $params, $warn ); 3561 } 3562 3563 if ( $path =~ s/^doc:// ) { 3564 3565 # include web page 3566 return $this->_includeCodeDoc( $path, $pattern, $params ); 3560 3567 } 3561 3568 … … 4505 4512 4506 4513 return '| *Group* | *Members* |' . "\n" . join( "\n", sort @table ); 4514 } 4515 4516 # Include embedded doc in a core module 4517 sub _includeCodeDoc { 4518 my ( $this, $class, $pattern, $params ) = @_; 4519 4520 return '' unless $class && $class =~ /^Foswiki/; 4521 $class =~ s/[^\w:]//g; 4522 4523 my $pmfile; 4524 $class =~ s#::#/#g; 4525 foreach my $inc (@INC) { 4526 if ( -f "$inc/$class.pm" ) { 4527 $pmfile = "$inc/$class.pm"; 4528 last; 4529 } 4530 } 4531 return '' unless $pmfile; 4532 4533 open( PMFILE, '<', $pmfile ) || return ''; 4534 my $inPod = 0; 4535 my $pod = ''; 4536 local $/ = "\n"; 4537 while ( my $line = <PMFILE> ) { 4538 if ( $line =~ /^=(begin|pod)/ ) { 4539 $inPod = 1; 4540 } 4541 elsif ( $line =~ /^=cut/ ) { 4542 $inPod = 0; 4543 } 4544 elsif ($inPod) { 4545 $pod .= $line; 4546 } 4547 } 4548 close(PMFILE); 4549 4550 $pod =~ s/.*?%STARTINCLUDE%//s; 4551 $pod =~ s/%STOPINCLUDE%.*//s; 4552 4553 $pod = applyPatternToIncludedText( $pod, $pattern ) if ($pattern); 4554 4555 # Adjust the root heading level 4556 if ( $params->{level} ) { 4557 my $minhead = '+' x 100; 4558 $pod =~ s/^---(\++)/ 4559 $minhead = $1 if length($1) < length($minhead); "---$1"/gem; 4560 return $pod if length($minhead) == 100; 4561 my $newroot = '+' x $params->{level}; 4562 $minhead =~ s/\+/\\+/g; 4563 $pod =~ s/^---$minhead/---$newroot/gm; 4564 } 4565 return $pod; 4507 4566 } 4508 4567
Note: See TracChangeset
for help on using the changeset viewer.
