Leser: 2
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Template;
use HTML::Entities;
use PPI;
use PPI::HTML;
use Data::Dumper;
die "script needs at least one file to process!\n" unless @ARGV;
my @content;
my $template = HTML::Template->new(filename => "container2.html");
foreach my $source (@ARGV) {
my ($type) = $source =~ /\.(.*)$/;
my $part;
open(FILE, '<', $source) or
die "dieing while trying to open $source cause of: $!\n";
my $native = join '', (<FILE>);
if ($type eq 'pl') {
my $perldoc = PPI::Document->new( \$native );
my $highlight = PPI::HTML->new();
$part = $highlight->html( $perldoc );
} else {
$part = encode_entities($native);
}
close(FILE);
push @content, {
source => $source,
content => $part,
type => $type,
};
}
$template->param( content => \@content, );
print generate_links($template->output());
sub generate_links {
my $raw = shift;
my @keywords = qw(
bless close closedir die shift eval exit grep map open opendir print
splice split sysopen warn each values atan2 bind binmode caller chdir
chmod chomp chop chown chr chroot cmp connect continue cos crypt
dbmclose dbmopen defined delete dump endgrent endhostent endnetent
endprotoent endpwent endservent eof eq exec exists exp fcntl fileno
flock fork format formline getc getgrent getgrgid getgrnam
gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr
getnetbyname getnetent getpeername getpgrp getppid getpriority
getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid
getservbyname getservbyport getservent getsockname getsockopt glob
gmtime goto ge hex import index int ioctl join keys kill last lc
lcfirst length le link listen localtime log lstat mkdir msgctl msgget
msgrcv msgsnd next ne no no oct or ord pack pipe pop pos q qq quotemeta
qw qx read readdir readlink readpipe recv redo ref rename reset reverse
rewinddir rindex rmdir scalar seek seekdir select semctl semget semop
send setgrent sethostent setnetent setpgrp setpriority setprotoent
setpwent setservent setsockopt shift shmctl shmget shmread shmwrite
shutdown sin sleep socket socketpair sort split sprintf printf sqrt
srand rand stat shift study substr switch symlink syscall sysread
system syswrite tell telldir time times tr truncate uc ucfirst umask
undef unlink unpack unshift untie utime vec wait waitpid wantarray
write xor
);
for my $keyword (@keywords) {
$raw =~ s/\<span class=\"word\"\>$keyword\<\/span\>/\<span class=\"word\"\>\<a href=\"http:\/\/perldoc.perl.org\/functions\/$keyword.html\"\>$keyword\<\/a\>\<\/span\>/;
}
return $raw;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="perl script: project_to_html.pl" />
<title>Documentation</title>
<style type="text/css" media="screen">
/* <![CDATA[ */
h1 { color: #ff9; }
a { color: #99f; }
pre {
border-width: 1px;
border-style: solid;
padding: 4px;
background-color:
color: #ddd;
}
strong { color: #f99; }
.default {
color: #fff;
background-color: Ƽ
font-family: Arial, Helvectia;
margin: 8px;
}
.comment { color: #6600dd; }
.keyword { color: #ff9900; }
.pragma { text-style: italic; }
.substitute { color: #eeee00; }
.operator { color: #6666ff; }
.single { color: #0c0; }
.double { color: #3c3; }
.symbol { color: #d66; }
.structure {color: #ccc;}
.word {color: #fff;}
/* ]]> */
</style>
</head>
<body class="default">
<TMPL_LOOP NAME="content">
<h1><TMPL_VAR NAME="source"></h1>
Type of file is <strong><TMPL_VAR NAME="type"></strong><br />
<pre><TMPL_VAR NAME="content"></pre><br />
<hr />
</TMPL_LOOP>
</body>
</html>
|< 1 2 >| | 18 Einträge, 2 Seiten |