Broken shit
[semece.git] / lib / Semece / Temp.pm
blob4415e72f4c493264c27586ffe7a79890317aef55
1 package Semece::Temp;
3 # Copyright (c) 2010 Abel Abraham Camarillo Ojeda <acamari@the00z.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 use utf8;
18 use strict;
19 use warnings;
21 use Carp;
23 # opts:
24 # based => Base directory
25 # content => Text to put in #content
26 # mkurl => markdown source url
27 sub
28 temp
30 my %opts = @_;
32 my $html = undef;
34 croak "\$opts{'based'} doesn't exist!, stopped"
35 unless exists $opts{'based'};
36 croak "\$opts{'content'} doesn't exist!, stopped"
37 unless exists $opts{'content'};
38 croak "\$opts{'mkurl'} doesn't exist!, stopped"
39 unless exists $opts{'mkurl'};
41 $opts{'head'} = "" unless $opts{'head'};
42 $opts{'based'} = "" if $opts{based} eq '/';
44 $html = <<HTML;
45 <!DOCTYPE html>
46 <html lang="es">
47 <head>
48 <title>SeNTX</title>
49 <link rel="stylesheet" type="text/css" href="$opts{based}/static/css/semece.css" />
50 <script src="$opts{based}/static/js/Hyphenator.js" type="text/javascript">
51 </script>
52 <script type="text/javascript">
53 Hyphenator.run();
54 </script>
55 $opts{head}
56 </head>
57 <body class="hyphenate">
58 <div id="container">
59 <div id="banner">
60 <h1> #SeNTX </h1>
61 </div><!-- #banner -->
62 <div id="menu">
63 $opts{menu}
64 </div><!-- #menu -->
65 <div id="content">
66 $opts{content}
67 --<br />
68 <div id="footer">
69 Para ver el código fuente de esta página entre
70 <a href="$opts{mkurl}">aquí</a>.
71 </div><!-- #footer -->
72 </div><!-- #content -->
73 </div><!-- #container -->
74 </body>
75 </html>
76 HTML
78 return $html;