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"> | |
7e455e62 | 5 | <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?op=raw" |h %>">Raw</a></span> |
be24e9af | 6 | % if (defined $edit) { |
7e455e62 | 7 | <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit" |h %>">Edit</a></span> |
be24e9af | 8 | % } |
7f77ead8 | 9 | <span class="item"><a href="<% "$Odin::PASTEBIN/" |h %>">New</a></span> |
be24e9af | 10 | </div> |
7e455e62 MW |
11 | % if (defined $honc) { |
12 | <div class="note"> | |
13 | <p>Your browser doesn't appear to be accepting my cookies. | |
14 | <p>Don't share the link to this page with other people. <b>If you do, | |
15 | they'll be able to edit this paste just as you can</b>, using the | |
16 | <b>Edit</b> link at the top of the page. | |
17 | <p>Instead, share this link: | |
18 | <a href="<% "$Odin::PASTEBIN/$tag" |h %>"><% | |
19 | "$Odin::PASTEBIN/$tag" |h %></a> | |
20 | </div> | |
21 | % } | |
be24e9af | 22 | % if ($lang eq 'txt') { |
969db1ef | 23 | <pre class="paste"> |
be24e9af | 24 | <% $content |h %>\ |
969db1ef MW |
25 | </pre> |
26 | % } elsif ($lang =~ /^hl:(.*)$/) { | |
27 | <pre class="paste"> | |
be24e9af | 28 | <%perl> |
969db1ef | 29 | my $hl_lang = $1; |
be24e9af MW |
30 | my $kid = open my $fh, "-|" // die "fork: $!"; |
31 | if ($kid == 0) { | |
969db1ef | 32 | open my $hl, "|-", "highlight", "-Ohtml", "-f", "-t8", "-S$hl_lang" |
be24e9af MW |
33 | or die "open highlight: $!"; |
34 | syswrite $hl, $content // die "highlight write: $!"; | |
35 | close $hl or die "highlight kid: $!, $?"; | |
36 | exit 0; | |
37 | } else { | |
38 | while (sysread $fh, my $buf, 8192) { $m->print($buf); } | |
39 | close $fh and waitpid $kid, 0 | |
40 | or die "highlight parent: $!, $?"; | |
41 | } | |
42 | </%perl> | |
be24e9af | 43 | </pre> |
969db1ef MW |
44 | % } else { |
45 | <div class="note"> | |
46 | <p>I don't know how to display content with language | |
47 | ‘<% $lang |h %>’. This is a bug in the Pastebin program. | |
48 | Here's the raw text, in case that's useful. | |
49 | </div> | |
50 | <pre class="paste"> | |
51 | <% $content |h %>\ | |
52 | </pre> | |
53 | % } | |
be24e9af MW |
54 | </&> |
55 | %# | |
56 | <%args> | |
57 | $content | |
58 | $title | |
59 | $lang | |
60 | $tag | |
7e455e62 | 61 | $honc |
73961354 | 62 | $edit |
be24e9af MW |
63 | </%args> |
64 | %# | |
65 | <%init> | |
66 | my $db = Odin::open_db; | |
67 | </%init> | |
68 | %# | |
69 | <%once> | |
70 | use utf8; | |
71 | </%once> |