From c549c5b6e651f3ee2236b4644f02d6bfe6aec3c3 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Fri, 4 Sep 2015 12:25:12 +1000 Subject: [PATCH] * add support of plaintext/markdown to zerobin --- public/css/zerobin.css | 5 +++++ templates/zerobin/view.html.ep | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/public/css/zerobin.css b/public/css/zerobin.css index 12de338..c950707 100644 --- a/public/css/zerobin.css +++ b/public/css/zerobin.css @@ -15,6 +15,11 @@ pre code { background-color: #777777; } +div.paste { + padding: 20px; + border: 1px dotted #777777; +} + /* imgbin */ div.img-preview { margin: 5px; diff --git a/templates/zerobin/view.html.ep b/templates/zerobin/view.html.ep index 44b1073..50e383d 100644 --- a/templates/zerobin/view.html.ep +++ b/templates/zerobin/view.html.ep @@ -10,10 +10,14 @@
+
% my $paste = (stash 'paste') || {}; -% my $syntax = $paste->{syntax}; -% my @opts = ($syntax and $syntax ne 'auto') ? (class => $syntax) : (); -
-
<%= tag 'code' => (@opts) => $paste->{data}; %>
+% if (not $paste->{syntax} or $paste->{syntax} eq 'plaintext') { +%= b(plaintext($paste->{data})); +% } elsif ($paste->{syntax} eq 'markdown') { +%= b(markdown($paste->{data})); +% } else { +
<%= tag 'code' => (class => $paste->{syntax}) => $paste->{data}; %>
+% }