-
Notifications
You must be signed in to change notification settings - Fork 0
/
md2html
executable file
·81 lines (67 loc) · 1.32 KB
/
md2html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/perl
use strict;
use warnings;
my $filename = shift;
my $md = `markdown $filename`;
$md =~ s{<h1>(.*?)</h1>}{};
my $title = $1;
my @slides = split(/^<hr \/>$/sm, $md);
my $html = <<HTML;
<!doctype html>
<html lang="en-us">
<head>
<title>$title</title>
<meta charset="utf-8"/>
<!--
<meta name="viewport" content="width=1274, user-scalable=no"/>
-->
<link rel="stylesheet" href="../ribbon/styles/screen.css"/>
<style>
.slide p {
margin-bottom: 25px;
-display: inline;
}
.slide li p {
display: inline;
}
.slide pre {
margin-bottom: 25px;
}
.slide>div {
padding-top: 60px;
}
.slide:after {
display: none;
}
.slide pre code {
-line-height: 1.7;
}
.slide pre code:before {
content: '';
}
/*
.slide section:before {
display: none;
}
*/
</style>
</head>
<body class="list">
<header class="caption">
<h1>$title</h1>
</header>
HTML
my $i = 0;
for my $slide (@slides) {
$i++;
$slide =~ s{(<h2>.*?</h2>)}{<header>$1</header>}gsm;
$html .= <<HTML
<div class="slide" id="slide-$i"><div><section>$slide</section></div></div>
HTML
}
$html .= <<HTML;
<script src="../core/shower.js"></script>
</body>
</html>
HTML
print $html;