Commit | Line | Data |
---|---|---|
be24e9af MW |
1 | <&| SELF:wrapper, |
2 | title => Odin::escapify($m, $title) . " (odin.gg Paste Bin)" &> | |
3 | <h1><tt>odin.gg</tt> Paste Bin: <% $title %></h1> | |
4 | <div class="menu"> | |
5 | <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?op=raw" %>">Raw</a></span> | |
6 | % if (defined $edit) { | |
7 | <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit" %>">Edit</a></span> | |
8 | % } | |
9 | </div> | |
10 | <pre class="paste"> | |
11 | % if ($lang eq 'txt') { | |
12 | <% $content |h %>\ | |
13 | % } else { | |
14 | <%perl> | |
15 | my $kid = open my $fh, "-|" // die "fork: $!"; | |
16 | if ($kid == 0) { | |
17 | open my $hl, "|-", "highlight", "-Ohtml", "-f", "-t8", "-S$lang" | |
18 | or die "open highlight: $!"; | |
19 | syswrite $hl, $content // die "highlight write: $!"; | |
20 | close $hl or die "highlight kid: $!, $?"; | |
21 | exit 0; | |
22 | } else { | |
23 | while (sysread $fh, my $buf, 8192) { $m->print($buf); } | |
24 | close $fh and waitpid $kid, 0 | |
25 | or die "highlight parent: $!, $?"; | |
26 | } | |
27 | </%perl> | |
28 | % } | |
29 | </pre> | |
30 | </&> | |
31 | %# | |
32 | <%args> | |
33 | $content | |
34 | $title | |
35 | $lang | |
36 | $tag | |
73961354 | 37 | $edit |
be24e9af MW |
38 | </%args> |
39 | %# | |
40 | <%init> | |
41 | my $db = Odin::open_db; | |
42 | </%init> | |
43 | %# | |
44 | <%once> | |
45 | use utf8; | |
46 | </%once> |