]> git.sur5r.net Git - i3/i3/blob - docs/i3-pod2html
Merge pull request #3144 from DebianWall/guaketilda
[i3/i3] / docs / i3-pod2html
1 #!/usr/bin/env perl
2 # vim:ts=4:sw=4:expandtab
3
4 use strict;
5 use warnings;
6 use Pod::Simple::HTML;
7 use v5.10;
8
9 $Pod::Simple::HTML::Tagmap{'Verbatim'} = '<pre><tt>';
10 $Pod::Simple::HTML::Tagmap{'VerbatimFormatted'} = '<pre><tt>';
11 $Pod::Simple::HTML::Tagmap{'/Verbatim'} = '</tt></pre>';
12 $Pod::Simple::HTML::Tagmap{'/VerbatimFormatted'} = '</tt></pre>';
13
14 if (@ARGV < 2) {
15     say STDERR "Syntax: i3-pod2html <pod-input-path> <html-output-path>";
16     exit 1;
17 }
18
19 open(my $in, '<', $ARGV[0]) or die "Couldn’t open $ARGV[0] for reading: $!\n";
20 open(my $out, '>', $ARGV[1]) or die "Couldn’t open $ARGV[1] for writing: $!\n";
21
22 my $parser = Pod::Simple::HTML->new();
23
24 $parser->index(1);
25 $parser->html_header_before_title(
26 <<'EOF'
27 <!doctype html>
28 <html lang="en">
29 <head>
30 <link rel="icon" type="image/png" href="/favicon.png">
31 <meta charset="utf-8">
32 <meta name="generator" content="Pod::Simple::HTML">
33 <meta name="description" content="i3 Perl documentation">
34 <link rel="stylesheet" href="https://i3wm.org/css/style.css" type="text/css" />
35 <style type="text/css">
36 .pod pre {
37     background: #333;
38     border: 1px solid #555;
39     border-left: 5px solid #555;
40     padding: 0.5em;
41     padding-left: 0;
42     padding-right: 0.5em;
43     white-space: pre;
44     color: white;
45 }
46
47 .pod ul {
48     list-style-type: none;
49 }
50 .pod li {
51     margin-bottom: 0 !important;
52 }
53
54 tt {
55     font-family: 'Droid Sans Mono', sans-serif;
56     font-size: inherit;
57 }
58
59 .pod h1 a, .pod h2 a, .pod h3 a, .pod h4 a {
60     text-decoration: none;
61     color: white;
62 }
63 </style>
64 <title>
65 EOF
66 );
67 $parser->html_header_after_title(
68 <<'EOF'
69 </title>
70 </head>
71 <body>
72
73         <div id="main">
74             <a href="/"><h1 id="title">i3 - improved tiling WM</h1></a>
75                         <ul id="nav">
76                                 <li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>
77                                 <li><a href="/screenshots">Screens</a></li>
78                                 <li><a href="https://www.reddit.com/r/i3wm/">FAQ</a></li>
79                                 <li><a href="/contact">Contact</a></li>
80                                 <li><a href="https://bugs.i3wm.org/">Bugs</a></li>
81                         </ul>
82         <br style="clear: both">
83 <div id="content" class="pod">
84 <h1>i3 Perl documentation</h1>
85
86 EOF
87 );
88
89 $parser->output_fh($out);
90 $parser->parse_file($in);