-
-
Save omega/51757ed709eae98aa751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
use ZeroMQ qw(ZMQ_REQ); | |
my ($host, $port); | |
$host ||= '127.0.0.1'; | |
$port ||= 5566; | |
my $ctxt = ZeroMQ::Context->new(); | |
my $sock = $ctxt->socket(ZMQ_REQ); | |
$sock->connect( "tcp://$host:$port" ); | |
sub startup { | |
my $self = shift; | |
$self->types->type(tex => 'text/tex'); | |
} | |
get '/' => 'index'; | |
get '/print' => sub { | |
my $self = shift; | |
my $issue = $self->param('issue'); | |
# now to make a PDF, yay! | |
$self->app->log->debug("OMG!! wanna print $issue"); | |
$self->stash(key => $issue, summary => $self->param('summary')); | |
$self->render(format => 'tex'); | |
my $tex = $self->res->body; | |
$self->app->log->debug("tex: " . $tex); | |
$sock->send($tex); | |
my $message = $sock->recv(); | |
my $res = $message->data . "\n"; | |
$self->render(text => 'ISSUE PRINTED (' . $issue . "): $res"); | |
$self->app->log->debug("result: " . $self->res->body); | |
}; | |
app->start; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'funky'; | |
We don't do much here, we print KANBAN cards for now! | |
@@ layouts/funky.html.ep | |
<!doctype html><html> | |
<head><title>JIRA Print-server, yay</title></head> | |
<body><%== content %></body> | |
</html> | |
@@ print.tex.ep | |
\documentclass[30pt, Screen4to3]{foils} | |
\usepackage{slidedesign} | |
\begin{document} | |
\foilhead{<%== key %>: <%== summary %>} | |
\foilhead{<%== key %>: <%== summary %>} | |
\end{document} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment