]>
Commit | Line | Data |
---|---|---|
151d4dc9 JH |
1 | #!/usr/bin/perl -w |
2 | ||
3 | print <<'EOF' ; | |
d3c2832a | 4 | <a href="http://3.bp.blogspot.com/-zbY2zfS4fKE/TlgfTSTK-oI/AAAAAAAACOQ/E_0Y4408QRE/s1600/GprofileSmall.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://3.bp.blogspot.com/-zbY2zfS4fKE/TlgfTSTK-oI/AAAAAAAACOQ/E_0Y4408QRE/s1600/GprofileSmall.png"></a> |
151d4dc9 JH |
5 | <style> |
6 | div.inset { | |
7 | background: #aff; | |
8 | color: #888; | |
9 | margin-left: 10%; | |
10 | margin-top: 2em; | |
11 | margin-bottom: 2em; | |
12 | width: 60%; | |
13 | padding: 1.2em; | |
14 | } | |
15 | div.inset { | |
16 | color: #444; | |
17 | } | |
18 | div.inset a { | |
19 | color: #444; | |
20 | } | |
21 | div.inset a:hover { | |
22 | color: #00f; | |
23 | } | |
24 | h2 { | |
25 | text-decoration: underline; | |
26 | color: #888; | |
27 | } | |
28 | span.tt { | |
29 | font-family: monospace; | |
30 | } | |
31 | img#ohloh-badge, img#git { | |
32 | border: none; | |
33 | float: right; | |
34 | } | |
35 | </style> | |
151d4dc9 JH |
36 | EOF |
37 | ||
38 | sub show_links { | |
39 | local ($_) = @_; | |
40 | my $br = ''; | |
41 | for (split(/\n/, $_)) { | |
42 | s/^\s*//; | |
43 | s/\s*\Z//; | |
44 | my $url = $_; | |
45 | my $comment = $_; | |
46 | $url =~ s/ .*//; | |
47 | if ($url =~ /^http:/) { | |
48 | print "$br<a href=\"$url\"\n>$comment</a>"; | |
49 | } else { | |
50 | print "$br$comment"; | |
51 | } | |
52 | $br = "<br />\n"; | |
53 | } | |
54 | print "\n"; | |
55 | } | |
56 | ||
57 | sub show_commands { | |
58 | local ($_) = @_; | |
59 | my $br = ''; | |
60 | for (split(/\n/, $_)) { | |
61 | s/^\s*//; | |
62 | s/\s*\Z//; | |
63 | print "$br<span class=\"tt\">$_</span>"; | |
64 | $br = "<br />\n"; | |
65 | } | |
66 | print "\n"; | |
67 | } | |
68 | ||
69 | my $in_ul; | |
70 | $/ = ""; | |
71 | while (<>) { | |
72 | $_ =~ s/\n+$//s; | |
73 | ||
74 | if (/^ - /) { | |
75 | if (!$in_ul) { | |
76 | $in_ul = 1; | |
77 | print "<ul>\n"; | |
78 | } | |
79 | s/^ - //; | |
80 | print "<li>$_</li>\n"; | |
81 | next; | |
82 | } | |
83 | ||
84 | if ($in_ul) { | |
85 | $in_ul = undef; | |
86 | print "</ul>\n\n"; | |
87 | } | |
88 | ||
89 | if (s/^\*\s*//) { | |
90 | print "<h2>$_</h2>\n\n"; | |
91 | } elsif (s/^ {4,}//) { | |
92 | print "<div class=\"inset\">\n"; | |
93 | if (/^(http|git|nntp):\/\//) { | |
94 | show_links($_); | |
95 | } else { | |
96 | show_commands($_); | |
97 | } | |
98 | print "</div>\n\n"; | |
99 | } else { | |
100 | print "<p>$_</p>\n\n"; | |
101 | } | |
102 | } |