diff _doc/make.pl @ 65:2840c4c85db8

Application configuration improvements Documentation
author wizard
date Tue, 16 Mar 2010 17:36:13 +0300
parents 259cd3df6e53
children f47f93534005
line wrap: on
line diff
--- a/_doc/make.pl	Mon Mar 15 17:45:13 2010 +0300
+++ b/_doc/make.pl	Tue Mar 16 17:36:13 2010 +0300
@@ -7,6 +7,7 @@
 
 our $LibDir = '../Lib/IMPL';
 our $OutDir = 'html';
+our $level = 0;
 
 our $index = { name => 'root' };
 
@@ -35,6 +36,8 @@
     
     my $pom = $parser->parse_file($hPod);
     
+    $level = @path;
+    
     print $hOut PodViewHTML->print($pom);
 }
 
@@ -118,13 +121,51 @@
 }
 sub view_begin {
 	my ($self,$begin) = @_;
-	$begin->format =~ /code/i ? return "<pre>\n".join ("",$begin->text())."</pre>\n" : return $self->SUPER::view_begin($begin); 
+	$begin->format =~ /code/i ? return "<pre>\n".escape_html(join ("",$begin->text()))."</pre>\n" : return $self->SUPER::view_begin($begin); 
+}
+
+sub escape_html {
+	my %esc = (
+		'&' => '&amp;',
+		'>' => '&gt;',
+		'<' => '&lt;'
+	);
+	
+	(my $text = shift) =~ s/([&><])/$esc{$1}/gex;
+	
+	return $text;
 }
 
 sub view_seq_link {
 	my ($self,$text) = @_;
 	
-	$text->text =~ /(?:(\w+)\s+)(\w+(?:\:\:\w+)*)/;
+	if ($text =~ /^\s*(?:(\w+)\s+)?(\w+(?:\:\:\w+)+)\s*$/) {
 	
+		my ($keyword, $package) = ($1 || '',$2);
+		
+		my @path = split /::/, $package;
+		
+		pop @path if $keyword;		
+		shift @path if uc $path[0] eq 'IMPL';
+		
+		if (-f File::Spec->catfile($LibDir,@path).".pm") {
+			return '<code><a href="'. '../'x($level-1) . File::Spec->catfile(@path) .'.html">'.$text.'</a></code>';			
+		}
+		
+	} elsif ($text =~ /^\s*(\w+(?:\:\:\w+)+)\s*-&gt;\s*(\w+)\s*$/) {
+		my ($package,$member) = ($1,$2);
+		
+		my @path = split /::/, $package;
+		shift @path;
+		
+		if (-f File::Spec->catfile($LibDir,@path).".pm") {
+			return '<code><a href="'. '../'x($level-1) . File::Spec->catfile(@path) .'.html">'.$text.'</a></code>';			
+		}
+	}
 	
-}
\ No newline at end of file
+	return "<code>$text</code>";
+}
+
+sub view_seq_code {
+	goto &view_seq_link;
+}