~mdw
/
odin-cgi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bin/populate-lang-table, mason/pastebin/%show: Segregate `highlight' languages.
[odin-cgi]
/
mason
/
pastebin
/
%show
diff --git
a/mason/pastebin/%show
b/mason/pastebin/%show
index
6ec0bb2
..
9e6afab
100644
(file)
--- a/
mason/pastebin/%show
+++ b/
mason/pastebin/%show
@@
-19,14
+19,17
@@
"$Odin::PASTEBIN/$tag" |h %></a>
</div>
% }
"$Odin::PASTEBIN/$tag" |h %></a>
</div>
% }
-<pre class="paste">
% if ($lang eq 'txt') {
% if ($lang eq 'txt') {
+<pre class="paste">
<% $content |h %>\
<% $content |h %>\
-% } else {
+</pre>
+% } elsif ($lang =~ /^hl:(.*)$/) {
+<pre class="paste">
<%perl>
<%perl>
+ my $hl_lang = $1;
my $kid = open my $fh, "-|" // die "fork: $!";
if ($kid == 0) {
my $kid = open my $fh, "-|" // die "fork: $!";
if ($kid == 0) {
- open my $hl, "|-", "highlight", "-Ohtml", "-f", "-t8", "-S$lang"
+ open my $hl, "|-", "highlight", "-Ohtml", "-f", "-t8", "-S$
hl_
lang"
or die "open highlight: $!";
syswrite $hl, $content // die "highlight write: $!";
close $hl or die "highlight kid: $!, $?";
or die "open highlight: $!";
syswrite $hl, $content // die "highlight write: $!";
close $hl or die "highlight kid: $!, $?";
@@
-37,8
+40,17
@@
or die "highlight parent: $!, $?";
}
</%perl>
or die "highlight parent: $!, $?";
}
</%perl>
-% }
</pre>
</pre>
+% } else {
+<div class="note">
+<p>I don't know how to display content with language
+ ‘<% $lang |h %>’. This is a bug in the Pastebin program.
+ Here's the raw text, in case that's useful.
+</div>
+<pre class="paste">
+<% $content |h %>\
+</pre>
+% }
</&>
%#
<%args>
</&>
%#
<%args>