mdpress 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/mdpress +93 -6
- data/lib/css/prettify.css +27 -0
- data/lib/css/reset.css +22 -0
- data/lib/impress_css/default.css +99 -0
- data/lib/impress_renderer.rb +28 -5
- data/lib/js/impress.js +426 -0
- data/lib/js/prettify.js +47 -0
- metadata +22 -3
data/bin/mdpress
CHANGED
@@ -1,16 +1,103 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
3
|
require 'redcarpet'
|
4
|
+
require 'fileutils'
|
4
5
|
require 'impress_renderer'
|
6
|
+
require 'trollop'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
def log(x)
|
9
|
+
puts "\033[94m" + x + "\033[0m"
|
10
|
+
end
|
11
|
+
|
12
|
+
def base_dir
|
13
|
+
File.dirname(__FILE__) + "/../lib/"
|
14
|
+
end
|
15
|
+
|
16
|
+
opts = Trollop::options do
|
17
|
+
banner <<-EOS
|
18
|
+
Usage: mdpress [filename] [options]
|
19
|
+
where [options] are:
|
20
|
+
EOS
|
21
|
+
opt :automatic, "Keeps running and automatically updates the presentation to reflect changes to markdown file."
|
22
|
+
opt :stylesheet, "Specify what stylesheet to use.", :default => "default"
|
23
|
+
opt :list, "List all available stylesheets."
|
24
|
+
end
|
25
|
+
|
26
|
+
if opts[:list]
|
27
|
+
log "Available stylesheets:"
|
28
|
+
Dir.glob(base_dir + "impress_css/*").each do |file|
|
29
|
+
puts File.basename(file, ".css")
|
30
|
+
end
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
def render
|
35
|
+
text = File.read(FILENAME)
|
36
|
+
# ugly hack to get attributes for impress.js
|
37
|
+
# TODO make this pretty
|
38
|
+
lines = text.split("\n")
|
39
|
+
lines.drop_while { |l| l =~ /^\s*$/ }
|
40
|
+
|
41
|
+
attrs = [""]
|
42
|
+
|
43
|
+
new_lines = []
|
44
|
+
lines.each_with_index do |line, i|
|
45
|
+
if line =~ /^=(.*)$/ && (i == 0 || lines[i-1] =~ /^(-\s*){3,}$/)
|
46
|
+
line =~ /^=(.*)$/
|
47
|
+
attrs[attrs.size-1] = $~.to_a[1]
|
48
|
+
next
|
49
|
+
elsif line =~ /^(-\s*){3,}$/
|
50
|
+
attrs << ""
|
51
|
+
end
|
52
|
+
new_lines << line
|
53
|
+
end
|
8
54
|
|
9
|
-
|
10
|
-
|
55
|
+
text = new_lines.join("\n")
|
56
|
+
|
57
|
+
# now use those attributes and render the file
|
58
|
+
include Redcarpet
|
59
|
+
ImpressRenderer.init_with_attrs attrs
|
60
|
+
m = Markdown.new(ImpressRenderer, :autolink => true)
|
61
|
+
log "rendering presentation"
|
62
|
+
f = File.open(DIRNAME + "/index.html", "w+")
|
63
|
+
f.write(m.render(text))
|
64
|
+
f.close
|
65
|
+
end
|
66
|
+
|
67
|
+
STYLESHEET = base_dir + "impress_css/#{opts[:stylesheet]}.css"
|
68
|
+
|
69
|
+
raise Trollop::HelpNeeded if ARGV.empty? # show help screen
|
70
|
+
unless File.exist?(STYLESHEET)
|
71
|
+
puts opts[:stylesheet] + " is not a valid stylesheet. See available stylesheets with `mdpress -l`."
|
11
72
|
exit
|
12
73
|
end
|
13
74
|
|
14
|
-
|
75
|
+
FILENAME = ARGV[0]
|
76
|
+
|
77
|
+
log "making directory"
|
78
|
+
DIRNAME = File.basename(FILENAME, File.extname(FILENAME))
|
79
|
+
Dir.mkdir(DIRNAME)
|
15
80
|
|
16
|
-
|
81
|
+
render
|
82
|
+
|
83
|
+
log "copying files"
|
84
|
+
FileUtils.cp_r(base_dir + "js", DIRNAME)
|
85
|
+
FileUtils.cp_r(base_dir + "css", DIRNAME)
|
86
|
+
FileUtils.cp(STYLESHEET, DIRNAME + "/css/style.css")
|
87
|
+
|
88
|
+
def auto
|
89
|
+
while true
|
90
|
+
sleep 2
|
91
|
+
if FileUtils.uptodate?(FILENAME, DIRNAME + "/index.html")
|
92
|
+
log "updating from #{FILENAME}"
|
93
|
+
render
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if opts[:automatic]
|
99
|
+
log "waiting for updates..."
|
100
|
+
auto
|
101
|
+
else
|
102
|
+
log "done."
|
103
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/* prettify.css */
|
2
|
+
.str,.atv{color:#F47A3B}
|
3
|
+
.kwd,.tag{color:#F05D77}
|
4
|
+
.com{color:#6EE18F}
|
5
|
+
.typ,.atn,.dec{color:#B47AAB}
|
6
|
+
.lit{color:#C2A8A9}
|
7
|
+
.pun{color:#A4AC9D;}
|
8
|
+
.pln{color:#FFF}
|
9
|
+
pre.prettyprint{padding:2px;border:1px solid #888}
|
10
|
+
code.prettyprint{
|
11
|
+
padding:3px 5px;
|
12
|
+
background-color: #222;
|
13
|
+
-moz-border-radius: 15px;
|
14
|
+
border-radius: 15px;
|
15
|
+
margin:10px 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
@media print{
|
19
|
+
.str{color:#060}
|
20
|
+
.kwd,.tag{color:#006;font-weight:bold}
|
21
|
+
.com{color:#600;font-style:italic}
|
22
|
+
.typ{font-weight:bold}
|
23
|
+
.lit{color:#044}
|
24
|
+
.pun{color:#440}
|
25
|
+
.atn,.typ{color:#404}
|
26
|
+
.atv{color:#060}
|
27
|
+
}
|
data/lib/css/reset.css
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
b, u, i, center,
|
7
|
+
dl, dt, dd, ol, ul, li,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
10
|
+
article, aside, canvas, details, embed,
|
11
|
+
figure, figcaption, footer, header, hgroup,
|
12
|
+
menu, nav, output, ruby, section, summary,
|
13
|
+
time, mark, audio, video {
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
border: 0;
|
17
|
+
font-size: 100%;
|
18
|
+
font: inherit;
|
19
|
+
vertical-align: baseline;
|
20
|
+
}
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
html { overflow: hidden; }
|
2
|
+
body { font-family: 'Open Sans', sans-serif; line-height: .8; font-size: 45px; }
|
3
|
+
|
4
|
+
body {
|
5
|
+
background: -moz-radial-gradient(50% 50%, farthest-side, #fff, #efefef);
|
6
|
+
background: -webkit-gradient(radial, 50% 50%, 250, 50% 50%, 750, from(#fff), to(#efefef));
|
7
|
+
}
|
8
|
+
|
9
|
+
.step {
|
10
|
+
width: 1100px;
|
11
|
+
height: 700px;
|
12
|
+
|
13
|
+
-webkit-box-sizing: border-box;
|
14
|
+
-moz-box-sizing: border-box;
|
15
|
+
-ms-box-sizing: border-box;
|
16
|
+
-o-box-sizing: border-box;
|
17
|
+
box-sizing: border-box;
|
18
|
+
|
19
|
+
-webkit-transition: opacity 1s;
|
20
|
+
-moz-transition: opacity 1s;
|
21
|
+
-ms-transition: opacity 1s;
|
22
|
+
-o-transition: opacity 1s;
|
23
|
+
transition: opacity 1s;
|
24
|
+
text-shadow: rgba(0,0,0,.01) 0 0 1px; /* Chrome @font-face anti-aliasing fix */
|
25
|
+
}
|
26
|
+
|
27
|
+
.step:not(.active) { opacity: 0.0; }
|
28
|
+
|
29
|
+
h1, h2 {
|
30
|
+
//font-family: 'Raleway', serif;
|
31
|
+
font-weight: normal;
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 120px;
|
36
|
+
margin: 40px 0;
|
37
|
+
line-height: 130px;
|
38
|
+
}
|
39
|
+
|
40
|
+
h2 {
|
41
|
+
font-weight: 300;
|
42
|
+
letter-spacing: .1em;
|
43
|
+
text-transform: uppercase;
|
44
|
+
line-height: 72px;
|
45
|
+
margin: 20px 0 40px 0;
|
46
|
+
}
|
47
|
+
|
48
|
+
.light {
|
49
|
+
font-weight: 300;
|
50
|
+
letter-spacing: .1em;
|
51
|
+
}
|
52
|
+
|
53
|
+
blockquote {
|
54
|
+
text-align: justify;
|
55
|
+
font-weight: 300;
|
56
|
+
font-style: italic;
|
57
|
+
line-height: 1.4;
|
58
|
+
}
|
59
|
+
|
60
|
+
a, a:hover, a:visited {
|
61
|
+
text-decoration: none;
|
62
|
+
font-style: normal;
|
63
|
+
color: #666;
|
64
|
+
cursor: pointer;
|
65
|
+
}
|
66
|
+
|
67
|
+
a:hover { color: #333;}
|
68
|
+
|
69
|
+
p {
|
70
|
+
font-weight: 400;
|
71
|
+
line-height: 60px;
|
72
|
+
}
|
73
|
+
|
74
|
+
ul, ol {
|
75
|
+
margin: 20px 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
li {
|
81
|
+
margin: 20px 0;
|
82
|
+
line-height: 40px;
|
83
|
+
}
|
84
|
+
|
85
|
+
pre code.prettyprint {
|
86
|
+
padding: 12px 18px;
|
87
|
+
margin: 40px 0;
|
88
|
+
float: left;
|
89
|
+
font-family: "Courier New", "Courier", monospace;
|
90
|
+
font-size: 30px;
|
91
|
+
line-height: 30px;
|
92
|
+
}
|
93
|
+
|
94
|
+
code.inline {
|
95
|
+
float: none;
|
96
|
+
display: inline;
|
97
|
+
padding: 0;
|
98
|
+
margin: 0;
|
99
|
+
}
|
data/lib/impress_renderer.rb
CHANGED
@@ -1,28 +1,51 @@
|
|
1
1
|
require 'redcarpet'
|
2
2
|
class ImpressRenderer < Redcarpet::Render::HTML
|
3
|
+
@@attrs = []
|
4
|
+
@@current = 0
|
5
|
+
|
6
|
+
def self.init_with_attrs att
|
7
|
+
@@attrs = att
|
8
|
+
@@current = 0
|
9
|
+
end
|
10
|
+
|
3
11
|
def hrule
|
12
|
+
# this is how we later inject attributes into pages. what an awful hack.
|
13
|
+
@@current += 1
|
4
14
|
%{</div>
|
5
|
-
<div class=
|
15
|
+
<div class='step' #{@@attrs[@@current]}>
|
6
16
|
}
|
7
17
|
end
|
8
18
|
|
19
|
+
def block_code code, lang
|
20
|
+
"<pre><code class='prettyprint'>#{code}</code></pre>"
|
21
|
+
end
|
22
|
+
|
23
|
+
def codespan code
|
24
|
+
"<code class='inline prettyprint'>#{code}</code>"
|
25
|
+
end
|
26
|
+
|
9
27
|
def doc_header
|
10
28
|
%{
|
11
29
|
<html>
|
12
30
|
<head>
|
13
|
-
<link href="
|
31
|
+
<link href="css/reset.css" rel="stylesheet" />
|
32
|
+
<link href="css/style.css" rel="stylesheet" />
|
33
|
+
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'>
|
34
|
+
<!-- Code Prettifier: -->
|
35
|
+
<link href="css/prettify.css" type="text/css" rel="stylesheet" />
|
36
|
+
<script type="text/javascript" src="js/prettify.js"></script>
|
14
37
|
</head>
|
15
38
|
|
16
|
-
<body>
|
39
|
+
<body onload="prettyPrint()">
|
17
40
|
<div id="impress">
|
18
|
-
<div class=
|
41
|
+
<div class='step' #{@@attrs[0]}>
|
19
42
|
}
|
20
43
|
end
|
21
44
|
|
22
45
|
def doc_footer
|
23
46
|
%{
|
24
47
|
</div>
|
25
|
-
<script src="impress.js"></script>
|
48
|
+
<script src="js/impress.js"></script>
|
26
49
|
<script>impress();</script>
|
27
50
|
</body>
|
28
51
|
</html>
|
data/lib/js/impress.js
ADDED
@@ -0,0 +1,426 @@
|
|
1
|
+
/**
|
2
|
+
* impress.js
|
3
|
+
*
|
4
|
+
* impress.js is a presentation tool based on the power of CSS3 transforms and transitions
|
5
|
+
* in modern browsers and inspired by the idea behind prezi.com.
|
6
|
+
*
|
7
|
+
* MIT Licensed.
|
8
|
+
*
|
9
|
+
* Copyright 2011-2012 Bartek Szopka (@bartaz)
|
10
|
+
*
|
11
|
+
* ------------------------------------------------
|
12
|
+
* author: Bartek Szopka
|
13
|
+
* version: 0.3
|
14
|
+
* url: http://bartaz.github.com/impress.js/
|
15
|
+
* source: http://github.com/bartaz/impress.js/
|
16
|
+
*/
|
17
|
+
|
18
|
+
(function ( document, window ) {
|
19
|
+
'use strict';
|
20
|
+
|
21
|
+
// HELPER FUNCTIONS
|
22
|
+
|
23
|
+
var pfx = (function () {
|
24
|
+
|
25
|
+
var style = document.createElement('dummy').style,
|
26
|
+
prefixes = 'Webkit Moz O ms Khtml'.split(' '),
|
27
|
+
memory = {};
|
28
|
+
|
29
|
+
return function ( prop ) {
|
30
|
+
if ( typeof memory[ prop ] === "undefined" ) {
|
31
|
+
|
32
|
+
var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),
|
33
|
+
props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' ');
|
34
|
+
|
35
|
+
memory[ prop ] = null;
|
36
|
+
for ( var i in props ) {
|
37
|
+
if ( style[ props[i] ] !== undefined ) {
|
38
|
+
memory[ prop ] = props[i];
|
39
|
+
break;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
return memory[ prop ];
|
46
|
+
}
|
47
|
+
|
48
|
+
})();
|
49
|
+
|
50
|
+
var arrayify = function ( a ) {
|
51
|
+
return [].slice.call( a );
|
52
|
+
};
|
53
|
+
|
54
|
+
var css = function ( el, props ) {
|
55
|
+
var key, pkey;
|
56
|
+
for ( key in props ) {
|
57
|
+
if ( props.hasOwnProperty(key) ) {
|
58
|
+
pkey = pfx(key);
|
59
|
+
if ( pkey != null ) {
|
60
|
+
el.style[pkey] = props[key];
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return el;
|
65
|
+
}
|
66
|
+
|
67
|
+
var byId = function ( id ) {
|
68
|
+
return document.getElementById(id);
|
69
|
+
}
|
70
|
+
|
71
|
+
var $ = function ( selector, context ) {
|
72
|
+
context = context || document;
|
73
|
+
return context.querySelector(selector);
|
74
|
+
};
|
75
|
+
|
76
|
+
var $$ = function ( selector, context ) {
|
77
|
+
context = context || document;
|
78
|
+
return arrayify( context.querySelectorAll(selector) );
|
79
|
+
};
|
80
|
+
|
81
|
+
var translate = function ( t ) {
|
82
|
+
return " translate3d(" + t.x + "px," + t.y + "px," + t.z + "px) ";
|
83
|
+
};
|
84
|
+
|
85
|
+
var rotate = function ( r, revert ) {
|
86
|
+
var rX = " rotateX(" + r.x + "deg) ",
|
87
|
+
rY = " rotateY(" + r.y + "deg) ",
|
88
|
+
rZ = " rotateZ(" + r.z + "deg) ";
|
89
|
+
|
90
|
+
return revert ? rZ+rY+rX : rX+rY+rZ;
|
91
|
+
};
|
92
|
+
|
93
|
+
var scale = function ( s ) {
|
94
|
+
return " scale(" + s + ") ";
|
95
|
+
};
|
96
|
+
|
97
|
+
var getElementFromUrl = function () {
|
98
|
+
// get id from url # by removing `#` or `#/` from the beginning,
|
99
|
+
// so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work
|
100
|
+
return byId( window.location.hash.replace(/^#\/?/,"") );
|
101
|
+
};
|
102
|
+
|
103
|
+
// CHECK SUPPORT
|
104
|
+
|
105
|
+
var ua = navigator.userAgent.toLowerCase();
|
106
|
+
var impressSupported = ( pfx("perspective") != null ) &&
|
107
|
+
( document.body.classList ) &&
|
108
|
+
( document.body.dataset ) &&
|
109
|
+
( ua.search(/(iphone)|(ipod)|(android)/) == -1 );
|
110
|
+
|
111
|
+
var roots = {};
|
112
|
+
|
113
|
+
var impress = window.impress = function ( rootId ) {
|
114
|
+
|
115
|
+
rootId = rootId || "impress";
|
116
|
+
|
117
|
+
// if already initialized just return the API
|
118
|
+
if (roots["impress-root-" + rootId]) {
|
119
|
+
return roots["impress-root-" + rootId];
|
120
|
+
}
|
121
|
+
|
122
|
+
// DOM ELEMENTS
|
123
|
+
|
124
|
+
var root = byId( rootId );
|
125
|
+
|
126
|
+
if (!impressSupported) {
|
127
|
+
root.className = "impress-not-supported";
|
128
|
+
return;
|
129
|
+
} else {
|
130
|
+
root.className = "";
|
131
|
+
}
|
132
|
+
|
133
|
+
// viewport updates for iPad
|
134
|
+
var meta = $("meta[name='viewport']") || document.createElement("meta");
|
135
|
+
// hardcoding these values looks pretty bad, as they kind of depend on the content
|
136
|
+
// so they should be at least configurable
|
137
|
+
meta.content = "width=1024, minimum-scale=0.75, maximum-scale=0.75, user-scalable=no";
|
138
|
+
if (meta.parentNode != document.head) {
|
139
|
+
meta.name = 'viewport';
|
140
|
+
document.head.appendChild(meta);
|
141
|
+
}
|
142
|
+
|
143
|
+
var canvas = document.createElement("div");
|
144
|
+
canvas.className = "canvas";
|
145
|
+
|
146
|
+
arrayify( root.childNodes ).forEach(function ( el ) {
|
147
|
+
canvas.appendChild( el );
|
148
|
+
});
|
149
|
+
root.appendChild(canvas);
|
150
|
+
|
151
|
+
var steps = $$(".step", root);
|
152
|
+
|
153
|
+
// SETUP
|
154
|
+
// set initial values and defaults
|
155
|
+
|
156
|
+
document.documentElement.style.height = "100%";
|
157
|
+
|
158
|
+
css(document.body, {
|
159
|
+
height: "100%",
|
160
|
+
overflow: "hidden"
|
161
|
+
});
|
162
|
+
|
163
|
+
var props = {
|
164
|
+
position: "absolute",
|
165
|
+
transformOrigin: "top left",
|
166
|
+
transition: "all 0s ease-in-out",
|
167
|
+
transformStyle: "preserve-3d"
|
168
|
+
}
|
169
|
+
|
170
|
+
css(root, props);
|
171
|
+
css(root, {
|
172
|
+
top: "50%",
|
173
|
+
left: "50%",
|
174
|
+
perspective: "1000px"
|
175
|
+
});
|
176
|
+
css(canvas, props);
|
177
|
+
|
178
|
+
var current = {
|
179
|
+
translate: { x: 0, y: 0, z: 0 },
|
180
|
+
rotate: { x: 0, y: 0, z: 0 },
|
181
|
+
scale: 1
|
182
|
+
};
|
183
|
+
|
184
|
+
var stepData = {};
|
185
|
+
|
186
|
+
var isStep = function ( el ) {
|
187
|
+
return !!(el && el.id && stepData["impress-" + el.id]);
|
188
|
+
}
|
189
|
+
|
190
|
+
steps.forEach(function ( el, idx ) {
|
191
|
+
var data = el.dataset,
|
192
|
+
step = {
|
193
|
+
translate: {
|
194
|
+
x: data.x || 0,
|
195
|
+
y: data.y || 0,
|
196
|
+
z: data.z || 0
|
197
|
+
},
|
198
|
+
rotate: {
|
199
|
+
x: data.rotateX || 0,
|
200
|
+
y: data.rotateY || 0,
|
201
|
+
z: data.rotateZ || data.rotate || 0
|
202
|
+
},
|
203
|
+
scale: data.scale || 1,
|
204
|
+
el: el
|
205
|
+
};
|
206
|
+
|
207
|
+
if ( !el.id ) {
|
208
|
+
el.id = "step-" + (idx + 1);
|
209
|
+
}
|
210
|
+
|
211
|
+
stepData["impress-" + el.id] = step;
|
212
|
+
|
213
|
+
css(el, {
|
214
|
+
position: "absolute",
|
215
|
+
transform: "translate(-50%,-50%)" +
|
216
|
+
translate(step.translate) +
|
217
|
+
rotate(step.rotate) +
|
218
|
+
scale(step.scale),
|
219
|
+
transformStyle: "preserve-3d"
|
220
|
+
});
|
221
|
+
|
222
|
+
});
|
223
|
+
|
224
|
+
// making given step active
|
225
|
+
|
226
|
+
var active = null;
|
227
|
+
var hashTimeout = null;
|
228
|
+
|
229
|
+
var goto = function ( el ) {
|
230
|
+
if ( !isStep(el) || el == active) {
|
231
|
+
// selected element is not defined as step or is already active
|
232
|
+
return false;
|
233
|
+
}
|
234
|
+
|
235
|
+
// Sometimes it's possible to trigger focus on first link with some keyboard action.
|
236
|
+
// Browser in such a case tries to scroll the page to make this element visible
|
237
|
+
// (even that body overflow is set to hidden) and it breaks our careful positioning.
|
238
|
+
//
|
239
|
+
// So, as a lousy (and lazy) workaround we will make the page scroll back to the top
|
240
|
+
// whenever slide is selected
|
241
|
+
//
|
242
|
+
// If you are reading this and know any better way to handle it, I'll be glad to hear about it!
|
243
|
+
window.scrollTo(0, 0);
|
244
|
+
|
245
|
+
var step = stepData["impress-" + el.id];
|
246
|
+
|
247
|
+
if ( active ) {
|
248
|
+
active.classList.remove("active");
|
249
|
+
}
|
250
|
+
el.classList.add("active");
|
251
|
+
|
252
|
+
root.className = "step-" + el.id;
|
253
|
+
|
254
|
+
// `#/step-id` is used instead of `#step-id` to prevent default browser
|
255
|
+
// scrolling to element in hash
|
256
|
+
//
|
257
|
+
// and it has to be set after animation finishes, because in chrome it
|
258
|
+
// causes transtion being laggy
|
259
|
+
window.clearTimeout( hashTimeout );
|
260
|
+
hashTimeout = window.setTimeout(function () {
|
261
|
+
window.location.hash = "#/" + el.id;
|
262
|
+
}, 1000);
|
263
|
+
|
264
|
+
var target = {
|
265
|
+
rotate: {
|
266
|
+
x: -parseInt(step.rotate.x, 10),
|
267
|
+
y: -parseInt(step.rotate.y, 10),
|
268
|
+
z: -parseInt(step.rotate.z, 10)
|
269
|
+
},
|
270
|
+
translate: {
|
271
|
+
x: -step.translate.x,
|
272
|
+
y: -step.translate.y,
|
273
|
+
z: -step.translate.z
|
274
|
+
},
|
275
|
+
scale: 1 / parseFloat(step.scale)
|
276
|
+
};
|
277
|
+
|
278
|
+
// check if the transition is zooming in or not
|
279
|
+
var zoomin = target.scale >= current.scale;
|
280
|
+
|
281
|
+
// if presentation starts (nothing is active yet)
|
282
|
+
// don't animate (set duration to 0)
|
283
|
+
var duration = (active) ? "1s" : "0";
|
284
|
+
|
285
|
+
css(root, {
|
286
|
+
// to keep the perspective look similar for different scales
|
287
|
+
// we need to 'scale' the perspective, too
|
288
|
+
perspective: step.scale * 1000 + "px",
|
289
|
+
transform: scale(target.scale),
|
290
|
+
transitionDuration: duration,
|
291
|
+
transitionDelay: (zoomin ? "500ms" : "0ms")
|
292
|
+
});
|
293
|
+
|
294
|
+
css(canvas, {
|
295
|
+
transform: rotate(target.rotate, true) + translate(target.translate),
|
296
|
+
transitionDuration: duration,
|
297
|
+
transitionDelay: (zoomin ? "0ms" : "500ms")
|
298
|
+
});
|
299
|
+
|
300
|
+
current = target;
|
301
|
+
active = el;
|
302
|
+
|
303
|
+
return el;
|
304
|
+
};
|
305
|
+
|
306
|
+
var prev = function () {
|
307
|
+
var prev = steps.indexOf( active ) - 1;
|
308
|
+
prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ];
|
309
|
+
|
310
|
+
return goto(prev);
|
311
|
+
};
|
312
|
+
|
313
|
+
var next = function () {
|
314
|
+
var next = steps.indexOf( active ) + 1;
|
315
|
+
next = next < steps.length ? steps[ next ] : steps[ 0 ];
|
316
|
+
|
317
|
+
return goto(next);
|
318
|
+
};
|
319
|
+
|
320
|
+
window.addEventListener("hashchange", function () {
|
321
|
+
goto( getElementFromUrl() );
|
322
|
+
}, false);
|
323
|
+
|
324
|
+
window.addEventListener("orientationchange", function () {
|
325
|
+
window.scrollTo(0, 0);
|
326
|
+
}, false);
|
327
|
+
|
328
|
+
// START
|
329
|
+
// by selecting step defined in url or first step of the presentation
|
330
|
+
goto(getElementFromUrl() || steps[0]);
|
331
|
+
|
332
|
+
return (roots[ "impress-root-" + rootId ] = {
|
333
|
+
goto: goto,
|
334
|
+
next: next,
|
335
|
+
prev: prev
|
336
|
+
});
|
337
|
+
|
338
|
+
}
|
339
|
+
})(document, window);
|
340
|
+
|
341
|
+
// EVENTS
|
342
|
+
|
343
|
+
(function ( document, window ) {
|
344
|
+
'use strict';
|
345
|
+
|
346
|
+
// keyboard navigation handler
|
347
|
+
document.addEventListener("keydown", function ( event ) {
|
348
|
+
if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
|
349
|
+
switch( event.keyCode ) {
|
350
|
+
case 33: ; // pg up
|
351
|
+
case 37: ; // left
|
352
|
+
case 38: // up
|
353
|
+
impress().prev();
|
354
|
+
break;
|
355
|
+
case 9: ; // tab
|
356
|
+
case 32: ; // space
|
357
|
+
case 34: ; // pg down
|
358
|
+
case 39: ; // right
|
359
|
+
case 40: // down
|
360
|
+
impress().next();
|
361
|
+
break;
|
362
|
+
}
|
363
|
+
|
364
|
+
event.preventDefault();
|
365
|
+
}
|
366
|
+
}, false);
|
367
|
+
|
368
|
+
// delegated handler for clicking on the links to presentation steps
|
369
|
+
document.addEventListener("click", function ( event ) {
|
370
|
+
// event delegation with "bubbling"
|
371
|
+
// check if event target (or any of its parents is a link)
|
372
|
+
var target = event.target;
|
373
|
+
while ( (target.tagName != "A") &&
|
374
|
+
(target != document.body) ) {
|
375
|
+
target = target.parentNode;
|
376
|
+
}
|
377
|
+
|
378
|
+
if ( target.tagName == "A" ) {
|
379
|
+
var href = target.getAttribute("href");
|
380
|
+
|
381
|
+
// if it's a link to presentation step, target this step
|
382
|
+
if ( href && href[0] == '#' ) {
|
383
|
+
target = document.getElementById( href.slice(1) );
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
if ( impress().goto(target) ) {
|
388
|
+
event.stopImmediatePropagation();
|
389
|
+
event.preventDefault();
|
390
|
+
}
|
391
|
+
}, false);
|
392
|
+
|
393
|
+
// delegated handler for clicking on step elements
|
394
|
+
document.addEventListener("click", function ( event ) {
|
395
|
+
var target = event.target;
|
396
|
+
// find closest step element
|
397
|
+
while ( !target.classList.contains("step") &&
|
398
|
+
(target != document.body) ) {
|
399
|
+
target = target.parentNode;
|
400
|
+
}
|
401
|
+
|
402
|
+
if ( impress().goto(target) ) {
|
403
|
+
event.preventDefault();
|
404
|
+
}
|
405
|
+
}, false);
|
406
|
+
|
407
|
+
// touch handler to detect taps on the left and right side of the screen
|
408
|
+
document.addEventListener("touchstart", function ( event ) {
|
409
|
+
if (event.touches.length === 1) {
|
410
|
+
var x = event.touches[0].clientX,
|
411
|
+
width = window.innerWidth * 0.3,
|
412
|
+
result = null;
|
413
|
+
|
414
|
+
if ( x < width ) {
|
415
|
+
result = impress().prev();
|
416
|
+
} else if ( x > window.innerWidth - width ) {
|
417
|
+
result = impress().next();
|
418
|
+
}
|
419
|
+
|
420
|
+
if (result) {
|
421
|
+
event.preventDefault();
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}, false);
|
425
|
+
})(document, window);
|
426
|
+
|
data/lib/js/prettify.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
window.PR_SHOULD_USE_CONTINUATION=true,window.PR_TAB_WIDTH=8,window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void
|
2
|
+
0,window._pr_isIE6=function(){var a=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);return a=a?+a[1]:false,window._pr_isIE6=function(){return a},a},(function(){var
|
3
|
+
a=true,b=null,c='break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof ',d=c+'alignof align_union asm axiom bool '+'concept concept_map const_cast constexpr decltype '+'dynamic_cast explicit export friend inline late_check '+'mutable namespace nullptr reinterpret_cast static_assert static_cast '+'template typeid typename using virtual wchar_t where ',e=c+'abstract boolean byte extends final finally implements import '+'instanceof null native package strictfp super synchronized throws '+'transient ',f=e+'as base by checked decimal delegate descending event '+'fixed foreach from group implicit in interface internal into is lock '+'object out override orderby params partial readonly ref sbyte sealed '+'stackalloc string select uint ulong unchecked unsafe ushort var ',g=c+'debugger eval export function get null set undefined var with '+'Infinity NaN ',h='caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ',i='break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ',j='break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ',k='break continue do else for if return while case done elif esac eval fi function in local set then until ',l=d+f+g+h+i+j+k,m=(function(){var
|
4
|
+
a=['!','!=','!==','#','%','%=','&','&&','&&=','&=','(','*','*=','+=',',','-=','->','/','/=',':','::',';','<','<<','<<=','<=','=','==','===','>','>=','>>','>>=','>>>','>>>=','?','@','[','^','^=','^^','^^=','{','|','|=','||','||=','~','break','case','continue','delete','do','else','finally','instanceof','return','throw','try','typeof'],b='(?:^^|[+-]',c;for(c=0;c<a.length;++c)b+='|'+a[c].replace(/([^=<>:&a-z])/g,'\\$1');return b+=')\\s*',b})(),n=/&/g,o=/</g,p=/>/g,q=/\"/g,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F;function
|
5
|
+
G(a){return a.replace(n,'&').replace(o,'<').replace(p,'>').replace(q,'"')}function
|
6
|
+
H(a){return a.replace(n,'&').replace(o,'<').replace(p,'>')}C=/</g,B=/>/g,w=/'/g,E=/"/g,v=/&/g,D=/ /g;function
|
7
|
+
I(a){var b=a.indexOf('&'),c,d,e,f;if(b<0)return a;for(--b;(b=a.indexOf('&#',b+1))>=0;)d=a.indexOf(';',b),d>=0&&(e=a.substring(b+3,d),f=10,e&&e.charAt(0)==='x'&&(e=e.substring(1),f=16),c=parseInt(e,f),isNaN(c)||(a=a.substring(0,b)+String.fromCharCode(c)+a.substring(d+1)));return a.replace(C,'<').replace(B,'>').replace(w,'\'').replace(E,'\"').replace(D,' ').replace(v,'&')}function
|
8
|
+
J(a){return'XMP'===a.tagName}u=/[\r\n]/g;function K(c,d){var e;return'PRE'===c.tagName?a:u.test(d)?(e='',c.currentStyle?(e=c.currentStyle.whiteSpace):window.getComputedStyle&&(e=window.getComputedStyle(c,b).whiteSpace),!e||e==='pre'):a}function
|
9
|
+
L(a,b){var c,d,e,f;switch(a.nodeType){case 1:f=a.tagName.toLowerCase(),b.push('<',f);for(e=0;e<a.attributes.length;++e){c=a.attributes[e];if(!c.specified)continue;b.push(' '),L(c,b)}b.push('>');for(d=a.firstChild;d;d=d.nextSibling)L(d,b);(a.firstChild||!/^(?:br|link|img)$/.test(f))&&b.push('</',f,'>');break;case
|
10
|
+
2:b.push(a.name.toLowerCase(),'=\"',G(a.value),'\"');break;case 3:case 4:b.push(H(a.nodeValue))}}function
|
11
|
+
M(b){var c=0,d=false,e=false,f,g,h,i;for(f=0,g=b.length;f<g;++f){h=b[f];if(h.ignoreCase)e=a;else
|
12
|
+
if(/[a-z]/i.test(h.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,''))){d=a,e=false;break}}function
|
13
|
+
j(a){if(a.charAt(0)!=='\\')return a.charCodeAt(0);switch(a.charAt(1)){case'b':return 8;case't':return 9;case'n':return 10;case'v':return 11;case'f':return 12;case'r':return 13;case'u':case'x':return parseInt(a.substring(2),16)||a.charCodeAt(1);case'0':case'1':case'2':case'3':case'4':case'5':case'6':case'7':return parseInt(a.substring(1),8);default:return a.charCodeAt(1)}}function
|
14
|
+
k(a){var b;return a<32?(a<16?'\\x0':'\\x')+a.toString(16):(b=String.fromCharCode(a),(b==='\\'||b==='-'||b==='['||b===']')&&(b='\\'+b),b)}function
|
15
|
+
l(a){var b=a.substring(1,a.length-1).match(new RegExp('\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]','g')),c=[],d=[],e=b[0]==='^',f,g,h,i,m,n,o,p,q;for(h=e?1:0,m=b.length;h<m;++h){o=b[h];switch(o){case'\\B':case'\\b':case'\\D':case'\\d':case'\\S':case'\\s':case'\\W':case'\\w':c.push(o);continue}q=j(o),h+2<m&&'-'===b[h+1]?(g=j(b[h+2]),h+=2):(g=q),d.push([q,g]),g<65||q>122||(g<65||q>90||d.push([Math.max(65,q)|32,Math.min(g,90)|32]),g<97||q>122||d.push([Math.max(97,q)&-33,Math.min(g,122)&-33]))}d.sort(function(a,b){return a[0]-b[0]||b[1]-a[1]}),f=[],i=[NaN,NaN];for(h=0;h<d.length;++h)p=d[h],p[0]<=i[1]+1?(i[1]=Math.max(i[1],p[1])):f.push(i=p);n=['['],e&&n.push('^'),n.push.apply(n,c);for(h=0;h<f.length;++h)p=f[h],n.push(k(p[0])),p[1]
|
16
|
+
>p[0]&&(p[1]+1>p[0]&&n.push('-'),n.push(k(p[1])));return n.push(']'),n.join('')}function
|
17
|
+
m(a){var b=a.source.match(new RegExp('(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)','g')),e=b.length,f=[],g,h,i,j,k;for(j=0,i=0;j<e;++j)k=b[j],k==='('?++i:'\\'===k.charAt(0)&&(h=+k.substring(1),h&&h<=i&&(f[h]=-1));for(j=1;j<f.length;++j)-1===f[j]&&(f[j]=++c);for(j=0,i=0;j<e;++j)k=b[j],k==='('?(++i,f[i]===void
|
18
|
+
0&&(b[j]='(?:')):'\\'===k.charAt(0)&&(h=+k.substring(1),h&&h<=i&&(b[j]='\\'+f[i]));for(j=0,i=0;j<e;++j)'^'===b[j]&&'^'!==b[j+1]&&(b[j]='');if(a.ignoreCase&&d)for(j=0;j<e;++j)k=b[j],g=k.charAt(0),k.length>=2&&g==='['?(b[j]=l(k)):g!=='\\'&&(b[j]=k.replace(/[a-zA-Z]/g,function(a){var
|
19
|
+
b=a.charCodeAt(0);return'['+String.fromCharCode(b&-33,b|32)+']'}));return b.join('')}i=[];for(f=0,g=b.length;f<g;++f){h=b[f];if(h.global||h.multiline)throw new
|
20
|
+
Error(''+h);i.push('(?:'+m(h)+')')}return new RegExp(i.join('|'),e?'gi':'g')}r=b;function
|
21
|
+
N(a){var c,d,e,f;b===r&&(f=document.createElement('PRE'),f.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC \"foo bar\">\n<foo />')),r=!/</.test(f.innerHTML));if(r)return d=a.innerHTML,J(a)?(d=H(d)):K(a,d)||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,'$1').replace(/(?:[\r\n]+[ \t]*)+/g,' ')),d;e=[];for(c=a.firstChild;c;c=c.nextSibling)L(c,e);return e.join('')}function
|
22
|
+
O(a){var c=0;return function(d){var e=b,f=0,g,h,i,j;for(h=0,i=d.length;h<i;++h){g=d.charAt(h);switch(g){case' ':e||(e=[]),e.push(d.substring(f,h)),j=a-c%a,c+=j;for(;j>=0;j-=' '.length)e.push(' '.substring(0,j));f=h+1;break;case'\n':c=0;break;default:++c}}return e?(e.push(d.substring(f)),e.join('')):d}}z=new
|
23
|
+
RegExp('[^<]+|<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"\']|\'[^\']*\'|\"[^\"]*\")*>|<','g'),A=/^<\!--/,y=/^<!\[CDATA\[/,x=/^<br\b/i,F=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/;function
|
24
|
+
P(a){var b=a.match(z),c=[],d=0,e=[],f,g,h,i,j,k,l,m;if(b)for(g=0,k=b.length;g<k;++g){j=b[g];if(j.length>1&&j.charAt(0)==='<'){if(A.test(j))continue;if(y.test(j))c.push(j.substring(9,j.length-3)),d+=j.length-12;else
|
25
|
+
if(x.test(j))c.push('\n'),++d;else if(j.indexOf('nocode')>=0&&Q(j)){l=(j.match(F))[2],f=1;for(h=g+1;h<k;++h){m=b[h].match(F);if(m&&m[2]===l)if(m[1]==='/'){if(--f===0)break}else++f}h<k?(e.push(d,b.slice(g,h+1).join('')),g=h):e.push(d,j)}else
|
26
|
+
e.push(d,j)}else i=I(j),c.push(i),d+=i.length}return{source:c.join(''),tags:e}}function
|
27
|
+
Q(a){return!!a.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1=\"$2$3$4\"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)}function
|
28
|
+
R(a,b,c,d){var e;if(!b)return;e={source:b,basePos:a},c(e),d.push.apply(d,e.decorations)}function
|
29
|
+
S(a,c){var d={},e,f,g,h;return(function(){var e=a.concat(c),f=[],g={},i,j,k,l,m,n,o;for(j=0,l=e.length;j<l;++j){m=e[j],o=m[3];if(o)for(i=o.length;--i>=0;)d[o.charAt(i)]=m;n=m[1],k=''+n,g.hasOwnProperty(k)||(f.push(n),g[k]=b)}f.push(/[\0-\uffff]/),h=M(f)})(),f=c.length,g=/\S/,e=function(a){var
|
30
|
+
b=a.source,g=a.basePos,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;i=[g,'pln'],s=0,y=b.match(h)||[],u={};for(v=0,q=y.length;v<q;++v){w=y[v],t=u[w],p=void
|
31
|
+
0;if(typeof t==='string')n=false;else{r=d[w.charAt(0)];if(r)p=w.match(r[1]),t=r[0];else{for(m=0;m<f;++m){r=c[m],p=w.match(r[1]);if(p){t=r[0];break}}p||(t='pln')}n=t.length>=5&&'lang-'===t.substring(0,5),n&&!(p&&typeof
|
32
|
+
p[1]==='string')&&(n=false,t='src'),n||(u[w]=t)}x=s,s+=w.length,n?(j=p[1],l=w.indexOf(j),k=l+j.length,p[2]&&(k=w.length-p[2].length,l=k-j.length),o=t.substring(5),R(g+x,w.substring(0,l),e,i),R(g+x+l,j,W(o,j),i),R(g+x+k,w.substring(k),e,i)):i.push(g+x,t)}a.decorations=i},e}function
|
33
|
+
T(a){var c=[],d=[],e,f;return a.tripleQuotedStrings?c.push(['str',/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,b,'\'\"']):a.multiLineStrings?c.push(['str',/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,b,'\'\"`']):c.push(['str',/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,b,'\"\'']),a.verbatimStrings&&d.push(['str',/^@\"(?:[^\"]|\"\")*(?:\"|$)/,b]),a.hashComments&&(a.cStyleComments?(c.push(['com',/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,b,'#']),d.push(['str',/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,b])):c.push(['com',/^#[^\r\n]*/,b,'#'])),a.cStyleComments&&(d.push(['com',/^\/\/[^\r\n]*/,b]),d.push(['com',/^\/\*[\s\S]*?(?:\*\/|$)/,b])),a.regexLiterals&&(e='/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/',d.push(['lang-regex',new
|
34
|
+
RegExp('^'+m+'('+e+')')])),f=a.keywords.replace(/^\s+|\s+$/g,''),f.length&&d.push(['kwd',new
|
35
|
+
RegExp('^(?:'+f.replace(/\s+/g,'|')+')\\b'),b]),c.push(['pln',/^\s+/,b,' \r\n \xa0']),d.push(['lit',/^@[a-z_$][a-z_$@0-9]*/i,b],['typ',/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,b],['pln',/^[a-z_$][a-z_$@0-9]*/i,b],['lit',new
|
36
|
+
RegExp('^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*','i'),b,'0123456789'],['pun',/^.[^\s\w\.$@\'\"\`\/\#]*/,b]),S(c,d)}s=T({keywords:l,hashComments:a,cStyleComments:a,multiLineStrings:a,regexLiterals:a});function
|
37
|
+
U(c){var d=c.source,e=c.extractedTags,f=c.decorations,g=[],h=0,i=b,j=b,k=0,l=0,m=O(window.PR_TAB_WIDTH),n=/([\r\n ]) /g,o=/(^| ) /gm,p=/\r\n?|\n/g,q=/[ \r\n]$/,r=a,s;function
|
38
|
+
t(a){var c,e;a>h&&(i&&i!==j&&(g.push('</span>'),i=b),!i&&j&&(i=j,g.push('<span class=\"',i,'\">')),c=H(m(d.substring(h,a))).replace(r?o:n,'$1 '),r=q.test(c),e=window._pr_isIE6()?' <br />':'<br />',g.push(c.replace(p,e)),h=a)}while(a){k<e.length?l<f.length?(s=e[k]<=f[l]):(s=a):(s=false);if(s)t(e[k]),i&&(g.push('</span>'),i=b),g.push(e[k+1]),k+=2;else
|
39
|
+
if(l<f.length)t(f[l]),j=f[l+1],l+=2;else break}t(d.length),i&&g.push('</span>'),c.prettyPrintedHtml=g.join('')}t={};function
|
40
|
+
V(a,b){var c,d;for(d=b.length;--d>=0;)c=b[d],t.hasOwnProperty(c)?'console'in window&&console.warn('cannot override language handler %s',c):(t[c]=a)}function
|
41
|
+
W(a,b){return a&&t.hasOwnProperty(a)||(a=/^\s*</.test(b)?'default-markup':'default-code'),t[a]}V(s,['default-code']),V(S([],[['pln',/^[^<?]+/],['dec',/^<!\w[^>]*(?:>|$)/],['com',/^<\!--[\s\S]*?(?:-\->|$)/],['lang-',/^<\?([\s\S]+?)(?:\?>|$)/],['lang-',/^<%([\s\S]+?)(?:%>|$)/],['pun',/^(?:<[%?]|[%?]>)/],['lang-',/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],['lang-js',/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],['lang-css',/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],['lang-in.tag',/^(<\/?[a-z][^<>]*>)/i]]),['default-markup','htm','html','mxml','xhtml','xml','xsl']),V(S([['pln',/^[\s]+/,b,' \r\n'],['atv',/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,b,'\"\'']],[['tag',/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],['atn',/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],['lang-uq.val',/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],['pun',/^[=<>\/]+/],['lang-js',/^on\w+\s*=\s*\"([^\"]+)\"/i],['lang-js',/^on\w+\s*=\s*\'([^\']+)\'/i],['lang-js',/^on\w+\s*=\s*([^\"\'>\s]+)/i],['lang-css',/^style\s*=\s*\"([^\"]+)\"/i],['lang-css',/^style\s*=\s*\'([^\']+)\'/i],['lang-css',/^style\s*=\s*([^\"\'>\s]+)/i]]),['in.tag']),V(S([],[['atv',/^[\s\S]+/]]),['uq.val']),V(T({keywords:d,hashComments:a,cStyleComments:a}),['c','cc','cpp','cxx','cyc','m']),V(T({keywords:'null true false'}),['json']),V(T({keywords:f,hashComments:a,cStyleComments:a,verbatimStrings:a}),['cs']),V(T({keywords:e,cStyleComments:a}),['java']),V(T({keywords:k,hashComments:a,multiLineStrings:a}),['bsh','csh','sh']),V(T({keywords:i,hashComments:a,multiLineStrings:a,tripleQuotedStrings:a}),['cv','py']),V(T({keywords:h,hashComments:a,multiLineStrings:a,regexLiterals:a}),['perl','pl','pm']),V(T({keywords:j,hashComments:a,multiLineStrings:a,regexLiterals:a}),['rb']),V(T({keywords:g,cStyleComments:a,regexLiterals:a}),['js']),V(S([],[['str',/^[\s\S]+/]]),['regex']);function
|
42
|
+
X(a){var b=a.sourceCodeHtml,c=a.langExtension,d,e;a.prettyPrintedHtml=b;try{e=P(b),d=e.source,a.source=d,a.basePos=0,a.extractedTags=e.tags,W(c,d)(a),U(a)}catch(f){'console'in
|
43
|
+
window&&(console.log(f),console.trace())}}function Y(a,b){var c={sourceCodeHtml:a,langExtension:b};return X(c),c.prettyPrintedHtml}function
|
44
|
+
Z(c){var d=window._pr_isIE6(),e=d===6?'\r\n':'\r',f=[document.getElementsByTagName('pre'),document.getElementsByTagName('code'),document.getElementsByTagName('xmp')],g=[],h,i,j,k,l,m;for(i=0;i<f.length;++i)for(j=0,l=f[i].length;j<l;++j)g.push(f[i][j]);f=b,h=Date,h.now||(h={now:function(){return(new
|
45
|
+
Date).getTime()}}),k=0;function n(){var b=window.PR_SHOULD_USE_CONTINUATION?h.now()+250:Infinity,d,e,f,i,j;for(;k<g.length&&h.now()<b;++k){e=g[k];if(e.className&&e.className.indexOf('prettyprint')>=0){f=e.className.match(/\blang-(\w+)\b/),f&&(f=f[1]),i=false;for(j=e.parentNode;j;j=j.parentNode)if((j.tagName==='pre'||j.tagName==='code'||j.tagName==='xmp')&&j.className&&j.className.indexOf('prettyprint')>=0){i=a;break}i||(d=N(e),d=d.replace(/(?:\r\n?|\n)$/,''),m={sourceCodeHtml:d,langExtension:f,sourceNode:e},X(m),o())}}k<g.length?setTimeout(n,250):c&&c()}function
|
46
|
+
o(){var a=m.prettyPrintedHtml,b,c,f,g,h,i,j,k;if(!a)return;f=m.sourceNode;if(!J(f))f.innerHTML=a;else{k=document.createElement('PRE');for(g=0;g<f.attributes.length;++g)b=f.attributes[g],b.specified&&(c=b.name.toLowerCase(),c==='class'?(k.className=b.value):k.setAttribute(b.name,b.value));k.innerHTML=a,f.parentNode.replaceChild(k,f),f=k}if(d&&f.tagName==='PRE'){j=f.getElementsByTagName('br');for(h=j.length;--h>=0;)i=j[h],i.parentNode.replaceChild(document.createTextNode(e),i)}}n()}window.PR_normalizedHtml=L,window.prettyPrintOne=Y,window.prettyPrint=Z,window.PR={combinePrefixPatterns:M,createSimpleLexer:S,registerLangHandler:V,sourceDecorator:T,PR_ATTRIB_NAME:'atn',PR_ATTRIB_VALUE:'atv',PR_COMMENT:'com',PR_DECLARATION:'dec',PR_KEYWORD:'kwd',PR_LITERAL:'lit',PR_NOCODE:'nocode',PR_PLAIN:'pln',PR_PUNCTUATION:'pun',PR_SOURCE:'src',PR_STRING:'str',PR_TAG:'tag',PR_TYPE:'typ'}})()
|
47
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdpress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Bhargava
|
@@ -32,6 +32,20 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: trollop
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
35
49
|
description: Build impress.js presentations from markdown files.
|
36
50
|
email: bluemangroupie@gmail.com
|
37
51
|
executables:
|
@@ -43,6 +57,11 @@ extra_rdoc_files: []
|
|
43
57
|
files:
|
44
58
|
- lib/impress_renderer.rb
|
45
59
|
- bin/mdpress
|
60
|
+
- lib/css/prettify.css
|
61
|
+
- lib/css/reset.css
|
62
|
+
- lib/js/impress.js
|
63
|
+
- lib/js/prettify.js
|
64
|
+
- lib/impress_css/default.css
|
46
65
|
has_rdoc: true
|
47
66
|
homepage: https://github.com/egonSchiele/mdpress
|
48
67
|
licenses: []
|