trickster 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +200 -0
- data/bin/trickster +134 -0
- data/css/highlight-solarized_light.min.css +37 -0
- data/css/normalize.css +375 -0
- data/css/styles.css +68 -0
- data/erb/index.html.erb +27 -0
- data/js/bullets.js +83 -0
- data/js/custom.js +10 -0
- data/js/lib/highlight-7.1.min.js +1 -0
- data/js/lib/highlight-fc32801.min.js +4601 -0
- data/js/lib/jquery-1.8.0.min.js +2 -0
- data/js/lib/jquerytypewriter.js +54 -0
- data/js/lib/underscore-1.3.3.min.js +32 -0
- data/js/sizer.js +149 -0
- data/js/trickster.js +216 -0
- data/js/utils.js +19 -0
- data/lib/trickster/file_copier.rb +25 -0
- data/lib/trickster/renderer/bullets_renderer.rb +12 -0
- data/lib/trickster/renderer/code_renderer.rb +47 -0
- data/lib/trickster/renderer/commandline_renderer.rb +35 -0
- data/lib/trickster/renderer/image_renderer.rb +9 -0
- data/lib/trickster/renderer/normal_renderer.rb +11 -0
- data/lib/trickster/slide_parser.rb +34 -0
- data/lib/trickster/slide_renderer.rb +51 -0
- data/lib/trickster/version.rb +3 -0
- data/lib/trickster.rb +9 -0
- data/trickster.rdoc +69 -0
- metadata +251 -0
data/README.rdoc
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
= trickster
|
2
|
+
|
3
|
+
Trickster is a developer's in-browser presentation software.
|
4
|
+
|
5
|
+
Instead of focusing on flashy transitions, it focuses to encourage making a good presentation that looks good on the big screen. As such, each slide is dynamically sized to be as big as possible. Code slides have syntax highlighting, and you can call out lines of interest very easily, as well as create animated command-line slides.
|
6
|
+
|
7
|
+
It does this by compiling your presentation into an HTML file that, when loaded, will execute the Trickster
|
8
|
+
JavaScript, which will dynamically resize each slide to the biggest it can be based on the browser's current size.
|
9
|
+
|
10
|
+
== Presentation Format
|
11
|
+
|
12
|
+
Your presentation is stored in text file. Each slide has the following format:
|
13
|
+
|
14
|
+
!<slide_type>: options
|
15
|
+
<content>
|
16
|
+
<content>
|
17
|
+
<content>
|
18
|
+
|
19
|
+
Where <tt>slide_type</tt> is one of the types listed below. <tt>options</tt> is a space-delimited key/value string of options. <tt>content</tt> is the content of the slide, interpreted based on the slide type.
|
20
|
+
|
21
|
+
=== Example:
|
22
|
+
|
23
|
+
!TITLE: background=262626
|
24
|
+
Welcome to my presentation!
|
25
|
+
It's going to be awesome!
|
26
|
+
|
27
|
+
!CODE
|
28
|
+
def some_method(x)
|
29
|
+
if x.nil?
|
30
|
+
return "foo"
|
31
|
+
else
|
32
|
+
return x.upcase
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
!BULLETS
|
37
|
+
Check these bullets out!
|
38
|
+
* This slide
|
39
|
+
* is great!
|
40
|
+
* and will be huge!
|
41
|
+
|
42
|
+
This defines three slides, the first of which is a TITLE with a custom background, the second of which is code, and the third of which is bullets. When you play the presentation, each bullet is revealed one at a time.
|
43
|
+
|
44
|
+
Also note that each slide will be in a +section+ tag, with the CSS class of its type. This allows you to control styling per slide type.
|
45
|
+
== options
|
46
|
+
|
47
|
+
background:: although you can customize each slide based on its CSS class, this option allows you to customize the background of this particular slide. This is useful for IMAGE slides where you might want to better match the image's colors
|
48
|
+
transition:: number of milliseconds to transition to the *next* slide. The default is in the config object, but this can override it per slide.
|
49
|
+
|
50
|
+
== Slide Types
|
51
|
+
|
52
|
+
== BULLETS
|
53
|
+
The first line is the "title" if this slide, rendered in an +H1+. The remaining are bullets. If a bullet line is preceded with a <tt>*</tt>, <tt>-</tt>, or <tt>+</tt>, that bullet character is omitted automatically.
|
54
|
+
|
55
|
+
== IMAGE
|
56
|
+
The first line is the url to the image to show.
|
57
|
+
|
58
|
+
== CODE
|
59
|
+
|
60
|
+
If the first line starts with <tt>file://</tt>, the contents of this file is read in as the contents of the code block. Otherwise, the entire contents of the slide is verbatim put into a +pre+ and then +code+ block. Syntax highlighting is done using a modified version of +highlight.js+. This modification demarcates each line of the code, and allows you to show line numbers and callout particular lines.
|
61
|
+
|
62
|
+
=== Language
|
63
|
+
|
64
|
+
By default, no language is specified for highlighting, so +highlight.js+ will make a guess. If you'd like to be explicit, use the +language+ option, e.g.
|
65
|
+
|
66
|
+
!CODE language=scala
|
67
|
+
def doit(x:String) = {
|
68
|
+
"foo"
|
69
|
+
}
|
70
|
+
|
71
|
+
=== Callouts
|
72
|
+
|
73
|
+
A code slide accepts an option of +callout+ which is a comma-delimited list of the lines of code to "call out" with special styling. This is useful if you are talking about particular lines, or are demonstrating new lines having been added to a previous example.
|
74
|
+
|
75
|
+
Further, if the line number is preceded with a dash (e.g. <tt>-3</tt>), that line will be styled for strikethrough, in addition to being highlighed. This is useful to show lines of code that are going to be deleted based on whatever you are talking about.
|
76
|
+
|
77
|
+
== COMMANDLINE
|
78
|
+
|
79
|
+
This slide is for showing command-line invocations and results. It is assumed to start with a CLI invocation and that such invocations are followed by results, that can be many lines. When you present the slideshow, the command will be output in a "typewriter" style, after which the result will be shown automatically, with each command acting like a "bullet" to be revealed.
|
80
|
+
|
81
|
+
=== Example
|
82
|
+
|
83
|
+
!COMMANDLINE
|
84
|
+
> ls -l
|
85
|
+
-rw-r--r-- 1 davec staff 25 Aug 25 14:49 Gemfile
|
86
|
+
-rw-r--r-- 1 davec staff 1563 Sep 9 16:11 Gemfile.lock
|
87
|
+
-rw-r--r-- 1 davec staff 4136 Sep 10 18:54 README.rdoc
|
88
|
+
drwxr-xr-x 3 davec staff 102 Sep 10 18:50 tmp
|
89
|
+
> vim Gemfile
|
90
|
+
editing Gemfile
|
91
|
+
|
92
|
+
Prompts can be <tt>></tt>, <tt>%</tt>, and <tt>#</tt>.
|
93
|
+
|
94
|
+
=== Any other type
|
95
|
+
|
96
|
+
These slides take the first three lines of content and display them in an +H1+, +H2+, and +H3+, respectively. All other lines are ignored.
|
97
|
+
|
98
|
+
== Customizations/Styling
|
99
|
+
|
100
|
+
You have two points of customization: +custom.js+, which is loaded *after* all the other JS, but before the +load+ event. This is where you can override Trickster's configuration if you like (e.g. for default transition time).
|
101
|
+
|
102
|
+
The second, and more useful, point of customization is +styles.css+ or +styles.scss+. This is loaded in your presentation and is where you can customize the look and feel of your slideshow. If you create a <tt>.scss</tt> file, trickster will run SASS on it to convert it to CSS, so you have the full awesome power of SASS available.
|
103
|
+
|
104
|
+
=== Styling Recommendations
|
105
|
+
|
106
|
+
* Prefer 'em' over explicit sizes, as this will aloww your sizing choices to work at any size (remember that Trickster tries to fit your content to the screen)
|
107
|
+
* The <tt>BODY</tt> element will be given the class of the currently-displayed slide, so if you want to, for example, change the background color of a slide based on its type, apply styles to <tt>body.SLIDE_TYPE</tt> and not <tt>section.SLIDE_TYPE</tt>
|
108
|
+
* The syntax highlighting is woefully tied to Solarized Light. Since we are using a patched version of highlight.js that shows line numbers and calls out lines, I had to patch the syntax CSS file to show those highlights. I've currently only done so for Solarized Light, and this style is hard-coded in the generated HTML file, anway. Sorry. Feel free to improve this for me and I'll commit the patch.
|
109
|
+
|
110
|
+
== Delivering the Presentation
|
111
|
+
|
112
|
+
Simply open `index.html` in your browser. Your browser should be Safari or Chrome.
|
113
|
+
|
114
|
+
Every time you reload, the presentation will be dynamically sized to the size of the browser, so you should configure your browser and monitor to the size of your presentation, then reload.
|
115
|
+
|
116
|
+
Occasionally, Trickster will size the slides too larger or too small. In that case, you can use "-" and "+" to resize the slides on the fly. If you reload, the sizes will be reset.
|
117
|
+
|
118
|
+
=== Keyboard Commands
|
119
|
+
|
120
|
+
advance:: "j", space-bar, right-arrow, or the advance button on the Kensington Wireless Presenter.
|
121
|
+
back:: "k", backspace, left-arrow, or the back button the Kensington Wireless Presenter.
|
122
|
+
restart:: down/stop button on the Kensington Wireless Presenter.
|
123
|
+
increase font-size:: "+" or "=" (font-size will be reset if you reload the page)
|
124
|
+
decrease font-size:: "-" (font-size will be reset if you reload the page)
|
125
|
+
|
126
|
+
== Tips
|
127
|
+
|
128
|
+
Trickster discourages verbose slides with lots of text or lots of bullets. This is because these are aspects of terrible presentations. Instead, create many more slides with fewer amounts of text.
|
129
|
+
|
130
|
+
= CLI
|
131
|
+
|
132
|
+
== trickster - Bootstrap, generate, and manage your trickster presentation
|
133
|
+
|
134
|
+
v0.0.4
|
135
|
+
|
136
|
+
=== Global Options
|
137
|
+
=== --help
|
138
|
+
Show this message
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
=== --version
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
=== Commands
|
150
|
+
==== build [slides_file]
|
151
|
+
Generate the presentation from your slides
|
152
|
+
|
153
|
+
|
154
|
+
Given your slides_file (defaults to 'slides' in current directory), generates an HTML
|
155
|
+
file (based on --output-file) that, when loaded, can be used to play your presentation.
|
156
|
+
|
157
|
+
Any .scss files found in the css/ directory will be run through SASS to be converted.
|
158
|
+
|
159
|
+
Note that currently, the CSS and JS files included are fixed, so keep all your customizations
|
160
|
+
to styles.css/styles.scss and custom.js (these files will not be overwritten when
|
161
|
+
you do a trickster update).
|
162
|
+
===== Options
|
163
|
+
===== -o file
|
164
|
+
|
165
|
+
Name of the generated HTML file
|
166
|
+
|
167
|
+
[Aliases] --output-file
|
168
|
+
[Default Value] index.html
|
169
|
+
|
170
|
+
|
171
|
+
==== help command
|
172
|
+
Shows a list of commands or help for one command
|
173
|
+
|
174
|
+
|
175
|
+
Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function
|
176
|
+
==== init dir_name
|
177
|
+
Create a new trickster presentation
|
178
|
+
|
179
|
+
|
180
|
+
This will create a completely self-contained presentation that can be run just from the files
|
181
|
+
in the directory you name. It will have a static copy of the JavaScript files, JavaScript third-party
|
182
|
+
libraries and CSS files you need to run your trickster application.
|
183
|
+
|
184
|
+
You can examine the file `slides` to see some examples of how to format your
|
185
|
+
presentation. You can run `trickster build` in the directory to create the HTML
|
186
|
+
file from your slides.
|
187
|
+
|
188
|
+
Note that if you upgrade trickster, you should run `tricksterd update` in your slide directory
|
189
|
+
to get the latest JavaScript and CSS files.
|
190
|
+
==== update [dir_name]
|
191
|
+
Update an existing slideshow with the latest Trickster JS/CSS files
|
192
|
+
|
193
|
+
|
194
|
+
Run this after you've upgraded trickster and want to get the latest features. Since your
|
195
|
+
slideshow is entirely self-contained, when you upgrade tricksterd, your static JavaScript and
|
196
|
+
CSS files will be out of date.
|
197
|
+
|
198
|
+
Note that `styles.css`, which was provided by trickster as a basis for styling, will not
|
199
|
+
be touched, and your customizations will remain. All other files that trickster gave you
|
200
|
+
when you ran `trickster init` will be overwritten.
|
data/bin/trickster
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'gli'
|
4
|
+
require 'trickster'
|
5
|
+
require 'erb'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
include GLI::App
|
9
|
+
|
10
|
+
program_desc 'Bootstrap, generate, and manage your trickster presentation'
|
11
|
+
|
12
|
+
version Trickster::VERSION
|
13
|
+
|
14
|
+
desc 'Create a new trickster presentation'
|
15
|
+
long_desc <<EOS
|
16
|
+
This will create a completely self-contained presentation that can be run just from the files
|
17
|
+
in the directory you name. It will have a static copy of the JavaScript files, JavaScript third-party
|
18
|
+
libraries and CSS files you need to run your trickster application.
|
19
|
+
|
20
|
+
You can examine the file `slides` to see some examples of how to format your
|
21
|
+
presentation. You can run `trickster build` in the directory to create the HTML
|
22
|
+
file from your slides.
|
23
|
+
|
24
|
+
Note that if you upgrade trickster, you should run `tricksterd update` in your slide directory
|
25
|
+
to get the latest JavaScript and CSS files.
|
26
|
+
EOS
|
27
|
+
arg_name 'dir_name'
|
28
|
+
command :init do |c|
|
29
|
+
c.action do |global_options,options,args|
|
30
|
+
dir = args.shift
|
31
|
+
FileUtils.mkdir(dir)
|
32
|
+
File.open(File.join(dir,'slides'),'w') do |file|
|
33
|
+
file.puts <<EOF
|
34
|
+
Title of your slideshow
|
35
|
+
!TITLE
|
36
|
+
Title of your slideshow
|
37
|
+
Subtitle
|
38
|
+
Sub-sub title
|
39
|
+
|
40
|
+
!SECTION: background=dddddd
|
41
|
+
A section
|
42
|
+
|
43
|
+
!BULLETS
|
44
|
+
A bullet list
|
45
|
+
* can use any
|
46
|
+
- reasonable
|
47
|
+
+ bullet
|
48
|
+
|
49
|
+
!CODE: callout=3,4,5
|
50
|
+
class YourCode
|
51
|
+
|
52
|
+
def initialize(will)
|
53
|
+
@be_highlighted
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
EOF
|
58
|
+
base = File.expand_path(File.join(File.dirname(__FILE__),'..'))
|
59
|
+
|
60
|
+
copier = Trickster::FileCopier.new(base,dir)
|
61
|
+
copier.copy_files('js','js')
|
62
|
+
copier.copy_files('js/lib','js')
|
63
|
+
copier.copy_files('css','css')
|
64
|
+
|
65
|
+
puts "Your slideshow is ready, run trickster build to build it"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Update an existing slideshow with the latest Trickster JS/CSS files'
|
71
|
+
long_desc <<EOS
|
72
|
+
Run this after you've upgraded trickster and want to get the latest features. Since your
|
73
|
+
slideshow is entirely self-contained, when you upgrade tricksterd, your static JavaScript and
|
74
|
+
CSS files will be out of date.
|
75
|
+
|
76
|
+
Note that `styles.css`, which was provided by trickster as a basis for styling, will not
|
77
|
+
be touched, and your customizations will remain. All other files that trickster gave you
|
78
|
+
when you ran `trickster init` will be overwritten.
|
79
|
+
EOS
|
80
|
+
arg_name '[dir_name]'
|
81
|
+
command :update do |c|
|
82
|
+
c.action do |global_options,options,args|
|
83
|
+
dir = args.shift
|
84
|
+
dir = '.' if dir.nil?
|
85
|
+
base = File.expand_path(File.join(File.dirname(__FILE__),'..'))
|
86
|
+
|
87
|
+
copier = Trickster::FileCopier.new(base,dir)
|
88
|
+
copier.copy_files('js','js', :except => "custom.js")
|
89
|
+
copier.copy_files('js/lib','js')
|
90
|
+
copier.copy_files('css','css', :except => "styles.css")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'Generate the presentation from your slides'
|
95
|
+
arg_name '[slides_file]'
|
96
|
+
long_desc <<EOS
|
97
|
+
Given your slides_file (defaults to 'slides' in current directory), generates an HTML
|
98
|
+
file (based on --output-file) that, when loaded, can be used to play your presentation.
|
99
|
+
|
100
|
+
Any .scss files found in the css/ directory will be run through SASS to be converted.
|
101
|
+
|
102
|
+
Note that currently, the CSS and JS files included are fixed, so keep all your customizations
|
103
|
+
to styles.css/styles.scss and custom.js (these files will not be overwritten when
|
104
|
+
you do a trickster update).
|
105
|
+
EOS
|
106
|
+
command :build do |c|
|
107
|
+
c.desc 'Name of the generated HTML file'
|
108
|
+
c.arg_name 'file'
|
109
|
+
c.default_value 'index.html'
|
110
|
+
c.flag [:o,'output-file']
|
111
|
+
|
112
|
+
c.action do |global_options,options,args|
|
113
|
+
file = File.open(args.shift || 'slides')
|
114
|
+
css_dir = File.join(File.dirname(file),'css')
|
115
|
+
lines = file.readlines.map(&:chomp)
|
116
|
+
parser = Trickster::SlideParser.new(lines,Trickster::SlideRenderer.new)
|
117
|
+
body = parser.body
|
118
|
+
title = parser.title
|
119
|
+
|
120
|
+
erb = ERB.new(File.new(File.expand_path(File.join(File.dirname(__FILE__),'..','erb','index.html.erb'))).readlines.join(""))
|
121
|
+
File.open(options[:'output-file'],"w") do |file|
|
122
|
+
file.puts erb.result(binding)
|
123
|
+
end
|
124
|
+
Dir["#{css_dir}/*.scss"].each do |sass_file|
|
125
|
+
css_file = sass_file.gsub(/\.scss$/,'.css')
|
126
|
+
command = "sass #{sass_file} #{css_file}"
|
127
|
+
unless system(command)
|
128
|
+
STDERR.puts "Problem running '#{command}'"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
exit run(ARGV)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
pre code{display:block;padding:.5em;background:#fdf6e3;color:#657b83}pre .comment,pre .template_comment,pre .diff .header,pre .doctype,pre .pi,pre .lisp .string,pre .javadoc{color:#93a1a1;font-style:italic}pre .keyword,pre .winutils,pre .method,pre .addition,pre .css .tag,pre .request,pre .status,pre .nginx .title{color:#859900}pre .number,pre .command,pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula,pre .regexp,pre .hexcolor{color:#2aa198}pre .title,pre .localvars,pre .chunk,pre .decorator,pre .built_in,pre .identifier,pre .vhdl .literal,pre .id{color:#268bd2}pre .attribute,pre .variable,pre .lisp .body,pre .smalltalk .number,pre .constant,pre .class .title,pre .parent,pre .haskell .type{color:#b58900}pre .preprocessor,pre .preprocessor .keyword,pre .shebang,pre .symbol,pre .symbol .string,pre .diff .change,pre .special,pre .attr_selector,pre .important,pre .subst,pre .cdata,pre .clojure .title{color:#cb4b16}pre .deletion{color:#dc322f}pre .tex .formula{background:#eee8d5}
|
2
|
+
pre {
|
3
|
+
counter-reset: lines;
|
4
|
+
}
|
5
|
+
pre .line {
|
6
|
+
counter-increment: lines;
|
7
|
+
}
|
8
|
+
pre .line::before {
|
9
|
+
content: counter(lines); text-align: right;
|
10
|
+
display: inline-block; width: 2em;
|
11
|
+
padding-right: 0.5em; margin-right: 0.5em;
|
12
|
+
color: #eee8d5;
|
13
|
+
}
|
14
|
+
|
15
|
+
pre .line-callout::before {
|
16
|
+
content: '\2192'; text-align: right;
|
17
|
+
display: inline-block; width: 2em;
|
18
|
+
padding-right: 0.5em; margin-right: 0.5em;
|
19
|
+
color: #002b36;
|
20
|
+
}
|
21
|
+
|
22
|
+
.lines-callout {
|
23
|
+
border-radius: 0.25em;
|
24
|
+
padding-top: 0.15em;
|
25
|
+
padding-bottom: 0.15em;
|
26
|
+
}
|
27
|
+
|
28
|
+
.lines-callout {
|
29
|
+
padding-top: 0.1em;
|
30
|
+
padding-bottom: 0.1em;
|
31
|
+
/*
|
32
|
+
border-radius: 0.25em;
|
33
|
+
border: solid 0.05em #073642;
|
34
|
+
box-shadow: 0 0.3em 0.2em -0.2em #002b36;
|
35
|
+
*/
|
36
|
+
background: #eee8d5;
|
37
|
+
}
|