middleman-presentation 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +33 -0
  3. data/.rdebugrc +7 -0
  4. data/.rspec +5 -0
  5. data/.rubocop.yml +4 -0
  6. data/.simplecov +8 -0
  7. data/.travis.yml +8 -0
  8. data/.yardopts +5 -0
  9. data/CONTRIBUTING.md +44 -0
  10. data/Gemfile +49 -0
  11. data/Gemfile.lock +328 -0
  12. data/Guardfile +13 -0
  13. data/LICENSE.software +21 -0
  14. data/README.md +601 -0
  15. data/RELEASE_NOTES.md +36 -0
  16. data/Rakefile +191 -0
  17. data/bin/middleman-presentation +7 -0
  18. data/bin/mp +7 -0
  19. data/config/license_finder.yml +13 -0
  20. data/config/rubocop/exclude.yml +25 -0
  21. data/config/rubocop/include.yml +142 -0
  22. data/cucumber.yml +2 -0
  23. data/doc/licenses/dependencies.csv +55 -0
  24. data/doc/licenses/dependencies.db +0 -0
  25. data/doc/licenses/dependencies.html +1415 -0
  26. data/doc/licenses/dependencies.md +603 -0
  27. data/doc/licenses/dependencies_detailed.csv +190 -0
  28. data/features/create_presentation-cli.feature +301 -0
  29. data/features/create_theme-cli.feature +62 -0
  30. data/features/grouping_slides.feature +121 -0
  31. data/features/ignore_slides.feature +86 -0
  32. data/features/image_gallery.feature +58 -0
  33. data/features/init_application-cli.feature +91 -0
  34. data/features/init_predefined_slides.feature +13 -0
  35. data/features/presentation.feature +113 -0
  36. data/features/show_config-cli.feature +27 -0
  37. data/features/show_style-cli.feature +21 -0
  38. data/features/show_support_information-cli.feature +12 -0
  39. data/features/slide-cli.feature +300 -0
  40. data/features/step_definitions.rb +135 -0
  41. data/features/support/ci.rb +3 -0
  42. data/features/support/env.rb +19 -0
  43. data/features/support/reporting.rb +2 -0
  44. data/features/version_number.feature +18 -0
  45. data/fixtures/images/image01.png +0 -0
  46. data/fixtures/images/image02.png +0 -0
  47. data/lib/middleman-presentation.rb +72 -0
  48. data/lib/middleman-presentation/cli/create.rb +14 -0
  49. data/lib/middleman-presentation/cli/create_presentation.rb +308 -0
  50. data/lib/middleman-presentation/cli/create_theme.rb +77 -0
  51. data/lib/middleman-presentation/cli/init.rb +34 -0
  52. data/lib/middleman-presentation/cli/reset_thor.rb +18 -0
  53. data/lib/middleman-presentation/cli/runner.rb +18 -0
  54. data/lib/middleman-presentation/cli/show.rb +37 -0
  55. data/lib/middleman-presentation/commands/presentation.rb +23 -0
  56. data/lib/middleman-presentation/commands/slide.rb +86 -0
  57. data/lib/middleman-presentation/commands/style.rb +29 -0
  58. data/lib/middleman-presentation/comparable_slide.rb +69 -0
  59. data/lib/middleman-presentation/css_class_extracter.rb +41 -0
  60. data/lib/middleman-presentation/custom_template.rb +11 -0
  61. data/lib/middleman-presentation/erb_template.rb +11 -0
  62. data/lib/middleman-presentation/existing_slide.rb +133 -0
  63. data/lib/middleman-presentation/extension.rb +12 -0
  64. data/lib/middleman-presentation/file_extensions.rb +60 -0
  65. data/lib/middleman-presentation/frontend_component.rb +82 -0
  66. data/lib/middleman-presentation/group_template.rb +11 -0
  67. data/lib/middleman-presentation/helpers.rb +11 -0
  68. data/lib/middleman-presentation/helpers/images.rb +38 -0
  69. data/lib/middleman-presentation/helpers/slides.rb +31 -0
  70. data/lib/middleman-presentation/helpers/tests.rb +13 -0
  71. data/lib/middleman-presentation/ignore_file.rb +52 -0
  72. data/lib/middleman-presentation/liquid_template.rb +11 -0
  73. data/lib/middleman-presentation/logger.rb +8 -0
  74. data/lib/middleman-presentation/main.rb +40 -0
  75. data/lib/middleman-presentation/markdown_template.rb +11 -0
  76. data/lib/middleman-presentation/new_slide.rb +147 -0
  77. data/lib/middleman-presentation/predefined_slide_templates_directory.rb +11 -0
  78. data/lib/middleman-presentation/presentation_config.rb +48 -0
  79. data/lib/middleman-presentation/slide_group.rb +38 -0
  80. data/lib/middleman-presentation/slide_list.rb +46 -0
  81. data/lib/middleman-presentation/transformers/file_keeper.rb +13 -0
  82. data/lib/middleman-presentation/transformers/group_slides.rb +34 -0
  83. data/lib/middleman-presentation/transformers/ignore_slides.rb +28 -0
  84. data/lib/middleman-presentation/transformers/remove_duplicate_slides.rb +32 -0
  85. data/lib/middleman-presentation/transformers/sort_slides.rb +13 -0
  86. data/lib/middleman-presentation/version.rb +8 -0
  87. data/lib/middleman_extension.rb +2 -0
  88. data/locales/de.yml +9 -0
  89. data/locales/en.yml +18 -0
  90. data/middleman-presentation.gemspec +38 -0
  91. data/script/bootstrap +11 -0
  92. data/script/ci +3 -0
  93. data/spec/css_class_extracter_spec.rb +28 -0
  94. data/spec/existing_slide_spec.rb +158 -0
  95. data/spec/frontend_resource_spec.rb +87 -0
  96. data/spec/ignore_file_spec.rb +74 -0
  97. data/spec/new_slide_spec.rb +130 -0
  98. data/spec/shared_examples/.keep +0 -0
  99. data/spec/slide_group_spec.rb +69 -0
  100. data/spec/slide_list_spec.rb +90 -0
  101. data/spec/spec_helper.rb +19 -0
  102. data/spec/support/ci.rb +20 -0
  103. data/spec/support/environment.rb +18 -0
  104. data/spec/support/filesystem.rb +22 -0
  105. data/spec/support/reporting.rb +2 -0
  106. data/spec/support/rspec.rb +9 -0
  107. data/spec/support/string.rb +2 -0
  108. data/spec/transformers/file_keeper_spec.rb +23 -0
  109. data/spec/transformers/group_slides_spec.rb +44 -0
  110. data/spec/transformers/ignore_slides_spec.rb +64 -0
  111. data/spec/transformers/remove_duplicate_slides_spec.rb +120 -0
  112. data/spec/transformers/sort_slides_spec.rb +17 -0
  113. data/templates/.bowerrc.tt +4 -0
  114. data/templates/.gitignore +5 -0
  115. data/templates/LICENSE.presentation +1 -0
  116. data/templates/Rakefile +59 -0
  117. data/templates/bower.json.tt +8 -0
  118. data/templates/config.yaml.tt +41 -0
  119. data/templates/data/config.yml.tt +9 -0
  120. data/templates/data/metadata.yml.tt +77 -0
  121. data/templates/predefined_slides.d/00.html.erb.tt +23 -0
  122. data/templates/predefined_slides.d/999980.html.erb.tt +4 -0
  123. data/templates/predefined_slides.d/999981.html.erb.tt +21 -0
  124. data/templates/predefined_slides.d/999982.html.erb.tt +3 -0
  125. data/templates/presentation_theme/bower.json.tt +20 -0
  126. data/templates/presentation_theme/images/.keep +0 -0
  127. data/templates/presentation_theme/javascripts/%theme_name%.js.tt +0 -0
  128. data/templates/presentation_theme/stylesheets/%theme_name%.scss.tt +9 -0
  129. data/templates/presentation_theme/stylesheets/_fonts.scss.tt +0 -0
  130. data/templates/presentation_theme/stylesheets/_images.scss.tt +5 -0
  131. data/templates/presentation_theme/stylesheets/_theme.scss.tt +252 -0
  132. data/templates/script/bootstrap +5 -0
  133. data/templates/script/build +3 -0
  134. data/templates/script/export +34 -0
  135. data/templates/script/presentation +3 -0
  136. data/templates/script/slide +3 -0
  137. data/templates/script/start +43 -0
  138. data/templates/slides/custom.md.tt +3 -0
  139. data/templates/slides/erb.tt +5 -0
  140. data/templates/slides/group.tt +3 -0
  141. data/templates/slides/liquid.tt +5 -0
  142. data/templates/slides/markdown.tt +3 -0
  143. data/templates/source/index.html.erb +1 -0
  144. data/templates/source/javascripts/application.js.tt +3 -0
  145. data/templates/source/layout.erb +89 -0
  146. data/templates/source/stylesheets/application.scss.tt +3 -0
  147. metadata +427 -0
data/Guardfile ADDED
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ # A sample Guardfile
3
+ # More info at https://github.com/guard/guard#readme
4
+
5
+ # Add files and commands to this file, like the example:
6
+ # watch(%r{file/path}) { `command(s)` }
7
+ #
8
+ guard :shell do
9
+ watch(%r{^source/slides/.+\.(?:erb|html)}) do
10
+ $stderr.puts 'Running middleman'
11
+ system('bundle exec middleman build')
12
+ end
13
+ end
data/LICENSE.software ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 maxmeyer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,601 @@
1
+ # middleman-presentation
2
+
3
+ [![Build Status](https://travis-ci.org/maxmeyer/middleman-presentation.png?branch=master)](https://travis-ci.org/maxmeyer/middleman-presentation)
4
+ [![Coverage Status](https://coveralls.io/repos/maxmeyer/middleman-presentation/badge.png?branch=master)](https://coveralls.io/r/maxmeyer/middleman-presentation?branch=master)
5
+ [![Gem Version](https://badge.fury.io/rb/middleman-presentation.svg)](http://badge.fury.io/rb/middleman-presentation)
6
+
7
+ This project helps you to build wonderful presentations based on
8
+ [HTML](http://www.w3.org/html/) and JavaScript. The JavaScript-part is powered
9
+ by [`reveal.js`](https://github.com/hakimel/reveal.js), a great framework to
10
+ build HTML-/JavaScript-presentations. The infrastructure behind
11
+ `middleman-presentation` is powered by `middleman`, a flexible static site
12
+ generator which also offers a live preview of your presentation.
13
+
14
+ To get started with `middleman-presentation` you should know a little bit about
15
+ HTML, JavaScript, reveal.js and [Ruby](https://www.ruby-lang.org/en).
16
+ `middleman-presentation` will then help you wherever it can to make your life
17
+ easy with presentations.
18
+
19
+ Why you would like to use `middleman-presentation` instead of pure `reveal.js`?
20
+
21
+ * It provides helper-commands for recurring tasks, e.g. create new
22
+ presentations, create new slides, editing slides
23
+ * It separates data (slides) from style (theme) by using bower + sprockets
24
+ * It supports a lot of template languages, e.g. Markdown, Erb, Liquid
25
+ * It provides templates, but give you the freedom to define your own ones
26
+ * It can be extended by using ruby
27
+
28
+ ## Installation
29
+
30
+ ### Gem
31
+
32
+ Install via rubygems
33
+
34
+ gem install middleman-presentation
35
+
36
+ Or add this line to your middleman application's Gemfile:
37
+
38
+ gem 'middleman-presentation'
39
+
40
+ And then execute:
41
+
42
+ $ bundle
43
+
44
+ ### External Dependencies
45
+
46
+ **Nodejs**
47
+
48
+ Please install [`nodejs`](https://github.com/joyent/node). It is required by
49
+ `bower` - see [bower](#bower_install)-section below. It is recommended to
50
+ install it via [package
51
+ manager](https://github.com/joyent/node/wiki/installing-node.js-via-package-manager).
52
+
53
+ It is recommended to configure the path where global packages are installed.
54
+ That ensures that you do not need to install global packages as `root`.
55
+
56
+ 1. Create `.npmrc`
57
+
58
+ ```bash
59
+ # Change <user> to your user
60
+ prefix = /home/<user>/.local/share/npm
61
+
62
+ # If you need to use a coporate proxy, add those lines as well.
63
+ # Be careful `https-proxy` needs use a `http`-url, not a `https`-one
64
+ # proxy = http://localhost:3128
65
+ # https-proxy = http://localhost:3128
66
+ ```
67
+
68
+ 2. Make executables of nodejs-packages available via PATH
69
+
70
+ Add `npm`-bin dir to your PATH-variable via `.bashrc`, `.zshrc` or whatever
71
+ initialization-script your shell uses.
72
+
73
+ ```bash
74
+ export PATH=~/.local/share/npm/bin:$PATH
75
+ ```
76
+
77
+ **Bower**
78
+ <a name="bower_install"></a>
79
+
80
+ You also need to install [`bower`](http://www.bower.io). It is used to install
81
+ the assets (CSS-, JavaScript-files etc.).
82
+
83
+ ```bash
84
+ npm install -g bower
85
+ ```
86
+
87
+ **JavaScript Engine**
88
+
89
+ Make sure you've got a javascript engine installed. Please follow the
90
+ instructions found [here](https://github.com/sstephenson/execjs). I do not add
91
+ this as a runtime-dependency to this gem. So it is your choice what engine you want to
92
+ use.
93
+
94
+ ## Release Notes
95
+
96
+ You find the release notes [here](RELEASE_NOTES.md) or on
97
+ [github](https://github.com/maxmeyer/middleman-presentation/blob/master/RELEASE_NOTES.md).
98
+
99
+ ## Supported rubies
100
+
101
+ * MRI >= 2.1.x
102
+
103
+ ## Find help
104
+
105
+ * This [README.md](README.m)
106
+ * A good [tutorial](http://htmlcheats.com/reveal-js/reveal-js-tutorial-reveal-js-for-beginners/) tutorial about `reveal.js`
107
+ * The [documentation](https://github.com/hakimel/reveal.js/) of `reveal.js`
108
+ * The [documentation](http://middlemanapp.com/) of `middleman`
109
+
110
+ ## Getting Started
111
+
112
+ ### Initialize middleman presentation globally
113
+
114
+ To create a global configuration file for `middleman-presentation` you need to
115
+ run the following command:
116
+
117
+ ```bash
118
+ middleman-presentation init application
119
+ ```
120
+
121
+ This will create a configuration file at
122
+ `$HOME/.config/middleman/presentation/presentations.yaml`. The configuration options
123
+ given there will be used for all presentations created with
124
+ `middleman-presentation`. After running the command on a pristine system it
125
+ will contain the defaults.
126
+
127
+ Please run `cat $HOME/.config/middleman/presentation/presentations.yaml` to view them.
128
+
129
+ ### Initialize presentation
130
+
131
+ This gem provides a helper to start a new presentatio from scratch. The given
132
+ options below need to be given on command line.
133
+
134
+ ```bash
135
+ # long
136
+ middleman-presentation create presentation --title "my title" --speaker "Me"
137
+
138
+ #short
139
+ middleman-presentation create --title "my title" --speaker "Me"
140
+ ```
141
+
142
+ The presentation helper provides a lot of more options. Use the help command to
143
+ get an overview. If you want to switch the language for generated slides use
144
+ the `--language`-switch.
145
+
146
+ ```bash
147
+ bundle exec middleman help presentation
148
+ ```
149
+
150
+ ### Start your presentation
151
+
152
+ To start your presentation use the `start`-script. It opens the presentation in
153
+ your browser and starts `middleman`. After `middleman` has started you just
154
+ need to reload the presentation in the browser.
155
+
156
+ ```bash
157
+ # Short
158
+ script/start
159
+
160
+ # Long
161
+ bundle exec middleman server
162
+ ```
163
+
164
+ ### Add new slide
165
+
166
+ **MAKE SURE YOU NEVER EVER GIVE TWO SLIDES THE SAME BASENAME**, eg. 01.html.erb
167
+ and 01.html.md. This will not work with `middleman`.
168
+
169
+ To add a new slide you can use the `slide`-helper.
170
+
171
+ ```bash
172
+ bundle exec middleman slide <name>
173
+ ```
174
+
175
+ It is recommended to use a number as name greater than `00`, e.g. `01`. If you
176
+ leave out the file extension the `slide`-helper will create a Markdown-slide by
177
+ default. If you want to overwrite this, please create a custom-slide-template -
178
+ see [Custom Templates](#custom_templates) for more information.
179
+
180
+ ```bash
181
+ bundle exec middleman slide 01
182
+ ```
183
+
184
+ If you enter duplicate slide names, e.g. "02.md" and "02.erb", the
185
+ `slide`-command will fail. It is not possible to serve files with the same base
186
+ name - e.g. "02" - via `middleman`.
187
+
188
+ ```bash
189
+ bundle exec middleman slide 02.md 02.erb
190
+ # => will fail
191
+ ```
192
+
193
+ If you prefer another template language you can provide that information as
194
+ part of the slide name. Today only `embedded ruby`, `markdown` and `liquid`-templates are supported.
195
+
196
+ ```bash
197
+ # embedded ruby
198
+ bundle exec middleman slide 01.erb
199
+
200
+ # markdown
201
+ bundle exec middleman slide 01.md
202
+ bundle exec middleman slide 01.markdown
203
+
204
+ # liquid
205
+ bundle exec middleman slide 01.l
206
+ bundle exec middleman slide 01.liquid
207
+ ```
208
+
209
+ To set a title for the slide use the `--title`-switch.
210
+
211
+ ```bash
212
+ bundle exec middleman slide 01 --title 'my Title'
213
+ ```
214
+
215
+ If you want to create multiple slides at once, this is possible to. Just ask
216
+ `middleman-presentation` to do this.
217
+
218
+ ```bash
219
+ bundle exec middleman slide 01 02 03
220
+ ```
221
+
222
+ There are some more options available. Please use the `help`-command to get an
223
+ overview.
224
+
225
+ ```bash
226
+ bundle exec middleman help slide
227
+ ```
228
+
229
+ Both provide the possibility to change the port where middleman should listen
230
+ on. Use `-h` check on available options.
231
+
232
+ ### Edit slide
233
+
234
+ To edit the slide after creating it use the `--edit`-switch. It uses the
235
+ `$EDITOR`-environment variable and falls back to `vim`.
236
+
237
+ ```bash
238
+ bundle exec middleman slide 01 --edit
239
+ ```
240
+
241
+ If you want to edit an alread created slide, you can use the
242
+ `slide`-command as well. It creates slides if they do not exist and opens them
243
+ in your favorit editor (ENV['EDITOR']) if they already exist.
244
+
245
+ In some cases you might want to use a different editor-command. To change the
246
+ editor used or the arguments used, you can run `middleman-presentation` with
247
+ the `--editor-command`-switch.
248
+
249
+ ```bash
250
+ bundle exec middleman slide --edit --editor-command "nano" 01 02 03
251
+ ```
252
+
253
+ The `editor-command`-string is also parsed by Erubis which makes the data
254
+ available in `metadata.yml` accessible to you. You can use this to start a vim server
255
+ with the presentation's project id as server name. This can be handy if you work more
256
+ or less simultaneously on diffent presentations. To make the use of the project
257
+ id as server name more stable you should use [`Shellwords.shellescape`](http://www.ruby-doc.org/stdlib-2.1.2/libdoc/shellwords/rdoc/Shellwords.html#method-c-shellescape).
258
+
259
+ ```bash
260
+ bundle exec middleman slide --edit --editor-command "vim --servername <%= Shellwords.shellescape(project_id) %> --remote-tab 2>/dev/null" 01 02 03
261
+ ```
262
+
263
+ ### Remove a slide
264
+
265
+ If you remove a slide while `middleman` is showing the presentation, you might
266
+ experience some weird errors. Please restart `middleman` after you removed a
267
+ slide and everything will be fine again.
268
+
269
+ ### Export presentation
270
+
271
+ If you need to export the presentation, you can use the `export`-script. It
272
+ creates tar-file in `<root>/pkg/<presentation_directory_name>.tar.gz`.
273
+
274
+ ```bash
275
+ script/export
276
+ # => Creates tar-file in <root>/pkg/<presentation_directory_name>.tar.gz
277
+ ```
278
+
279
+ ## Reuse existing presentation
280
+
281
+ *Bootstrap*
282
+
283
+ Bootstrap the presentation environment.
284
+
285
+ ```bash
286
+ script/bootstrap
287
+ # => Installs all needed software components
288
+ ```
289
+
290
+ *Start presentation*
291
+
292
+ To start your presentation use the `start`-script.
293
+
294
+ ```bash
295
+ script/start
296
+ ```
297
+
298
+ ### Ignore slides
299
+
300
+ *Introduction*
301
+
302
+ Sometimes you may want to slides to be available in the filesystem, but not
303
+ part of your presentation. To make this possible you can use the
304
+ `.slidesignore`-file. If you prefer a different name, change the
305
+ configuration-option `:slides_ignore_file`.
306
+
307
+ *Patterns*
308
+
309
+ Every line is a regular expression checked against the file names of existing
310
+ slides. To "unignore" particular slides, you can prefix your pattern with "!".
311
+
312
+ ```config
313
+ # ignore all slides ending with *.md
314
+ .*\.md
315
+ # unignore 01.html.md
316
+ !01.html.md
317
+ ```
318
+
319
+
320
+ ## Creating slides
321
+
322
+ ### Introduction
323
+
324
+ You need to decide if you want to create slides in pure HTML or if you want to
325
+ use [`Markdown`](http://daringfireball.net/projects/markdown/syntax). It's up
326
+ to you to make your choice. In most cases you should get along with `Markdown`
327
+ &#9786;. From version `0.6.0` onwards
328
+ [`kramdown`](http://kramdown.gettalong.org/syntax.html) is used to parsed
329
+ Markdown. because it supports "Attribute List Definitions" which can be used,
330
+ to provide HTML-attributes to Markdown-elements. Something similar to what
331
+ [reveal.js](https://github.com/hakimel/reveal.js/#element-attributes) does.
332
+
333
+ ### Grouping Slides
334
+ <a name="grouping_slides"></a>
335
+
336
+ `reveal.js` has a feature called "vertical slides". You can use this to add
337
+ "additional" slides to your presentation to add some auxiliary information.
338
+ To use this feature you need to place slides grouped together in a directory.
339
+
340
+ ```
341
+ # Single slide without namespace
342
+ 01.html.erb
343
+
344
+ # Group "02_hello" of three slides namespace by 02_hello
345
+ 02_hello/01.html.erb
346
+ 02_hello/02.html.erb
347
+ 02_hello/03.html.erb
348
+
349
+ # Group "03_world" of two slides namespace by 03_world
350
+ 03_world/01.html.erb
351
+ 03_world/02.html.erb
352
+ ```
353
+
354
+ If you prefer to use the `slide`-command to create your slides, you can create a
355
+ namespaced slide by using the following synatx:
356
+
357
+ ```
358
+ bundle exec middleman slide 02_hello:01
359
+ ```
360
+
361
+ Those commands will create a directory named `02_hello` and a file named `01.html.erb`.
362
+
363
+ ## Use external resources
364
+
365
+ I encourage you to use `bower` to make external resources within your presentation
366
+ available. This works fine together with the asset pipeline `middleman` uses:
367
+ [sprockets](https://github.com/sstephenson/sprockets). Just add resources to
368
+ your (existing) `bower.json` and make yourself comfortable with bower:
369
+ http://bower.io/. Reference the resources from within your
370
+ `javascripts/application.js` and/or
371
+ `stylesheets/application.scss`
372
+
373
+ By using `bower` for external resources you can better separate the slide
374
+ content from your styles.
375
+
376
+ If you created your presentation using the `middleman-presentation`-command,
377
+ files named "bower.json" and ".bowerrc" should exist. Within "bower.json" you
378
+ define the dependencies of your presentation. The last one can be used to tell
379
+ bower where to store the downloaded components.
380
+
381
+ To reference your assets you should use helpers. There are helpers avaiable for
382
+ Ruby-code and for Sass-code.
383
+
384
+ * `asset_path(type, name)`, `asset_url(type, name)`:
385
+
386
+ To reference an arbitrary type you can use the both *ruby* helpers mentioned above. To
387
+ reference a JavaScript-file use `asset_path(:js,
388
+ '<component>/<path>/<file>.js')`.
389
+
390
+ * `font-path(name)`, `font-url(name)`, `image-path(name)`, `image-url(name)`:
391
+
392
+ The helpers above can be used to reference assets in Sass-files. You need to
393
+ provide name to reference the asset, e.g.
394
+ `font-path('<component>/<path>/<file>.ttf')`.
395
+
396
+ To import Css- and Sass-files you should use the `@import`-command. To import
397
+ JavaScript-files from JavaScript-files you should use the `//=
398
+ require`-command.
399
+
400
+ Please see [sass](http://sass-lang.com/documentation/file.SASS_REFERENCE.html)
401
+ and [sprockets](https://github.com/sstephenson/sprockets) for more information
402
+ about that topic.
403
+
404
+ ## Creating themes
405
+
406
+ To create your own theme for `middleman-presentation`, you should use the
407
+ `theme`-command. It will create a new directory in the current directory
408
+ (`$PWD`) based on the name for the template, e.g. `new_theme`.
409
+
410
+ ```
411
+ cd my_presentation
412
+ middleman-presentation create theme new_theme
413
+ ```
414
+
415
+ Or if you want to get a more or less empty stylesheet, run it with
416
+ `--clean-css`.
417
+
418
+ ```
419
+ cd my_presentation
420
+ middleman-presentation create theme new_theme --clean-css
421
+ ```
422
+
423
+ After that a directory `new_theme` exists with some sub-directories:
424
+
425
+ * `javascripts`: Javascript-file go here
426
+ * `stylesheets`: Stylesheets (CSS, SCSS, ..) go here
427
+ * `images`: Image go here
428
+
429
+ To use your newly created files you need to modify the
430
+ `middleman-presentation`-configuration file and add the following yaml-snippet
431
+ to the file - see [Configuration](#configuration) for more about the
432
+ `middleman-presentation`-configuration file.
433
+
434
+ ```yaml
435
+ theme:
436
+ name: new_theme
437
+ github: <github_account>/<repository>
438
+ javascripts:
439
+ - javascripts/<name>
440
+ stylesheets:
441
+ - stylesheets/<name>
442
+ ```
443
+
444
+ If you prefer to learn by example, look at the default-theme at
445
+ [github](https://github.com/maxmeyer/middleman-presentation-theme-default).
446
+
447
+ To give you an overview about all css-classes used within templates, issue the
448
+ `style`-command. This will print every available css-class to style existing
449
+ templates. Each of those classes is prefixed with `mp-`.
450
+
451
+ ```bash
452
+ middleman-presentation show style
453
+ # => mp-speaker
454
+ # => [...]
455
+ ```
456
+
457
+ ## Creating slide templates
458
+
459
+ ### Normal slide templates
460
+
461
+ <a name="normal_slide_templates"></a>
462
+
463
+ To create slides using the `slide`-command templates are used. They are written in
464
+ Eruby (erb). For a good documentation about Eruby see the [Erubis User
465
+ Guide](http://www.kuwata-lab.com/erubis/users-guide.html). Since `0.11.4`. you
466
+ can have your own templates which overwrite the default templates.
467
+
468
+ You can store those templates in different directories. They are read in the
469
+ given order.
470
+
471
+ 1. presentation local templates (`<presentation root>/templates/<template>`)
472
+ 2. user local templates (`~/.config/middleman/presentation/templates/<template>`, `~/.middleman/presentation/templates/<template>`)
473
+ 3. system local templates (`/etc/middleman/presentation/templates/<template>`)
474
+
475
+
476
+ There are four different templates available:
477
+
478
+ * Erb (`erb.tt`): Templates for generating `Erb`-slides
479
+ * Markdown (`markdown.tt`): Templates for generating `markdown`-slides
480
+ * Liquid (`liquid.tt`): Templates for generating `liquid`-slides
481
+ * Group (`group.tt`): Templates for groups of slides - see [Grouping Slides](#grouping_slides).
482
+
483
+ ### Custom slide templates
484
+
485
+ <a name="custom_templates"></a>
486
+
487
+ Addiontionlly users can define one `custom`-slide-template. It's file extension
488
+ is used for the resulting slide. Given a template `custom.erb.tt` it becomes
489
+ `01.html.erb` when running `middleman slide 01`.
490
+
491
+ **Example**
492
+
493
+ Given you want to create a presentation local custom slide template with haml
494
+ as template language. The created slides should automatically get `.haml` as
495
+ file extension. First you need to create the template directory.
496
+
497
+ ```bash
498
+ # Switch to the directory containing your presentation
499
+ cd my_presentation
500
+
501
+ # Create template directory
502
+ mkdir -p templates
503
+ ```
504
+
505
+ Next you need to create the template itself using your favourite template
506
+ language. If you want to use information like the presentation title, don't forget the
507
+ template itself is parsed by `Erubis` before it is stored as slide in the file
508
+ system.
509
+
510
+ *templates/custom.haml.tt*:
511
+
512
+ ```
513
+ %h1 <%%= site_title %>
514
+ %h2 <%%= title %>
515
+ ```
516
+
517
+ After writing the file to the filesystem you can use it with the
518
+ `slide`-command to create slide by running the following code.
519
+
520
+ ```bash
521
+ # => creates source/slides/01.html.haml
522
+ bundle exec middleman slide 01
523
+ ```
524
+
525
+ ### Predefined slide templates
526
+
527
+ There are four predefined slide templates available:
528
+
529
+ * Start slide
530
+ * Slide name: `00.html.erb.tt`
531
+ * Questions slide
532
+ * Slide name: `999980.html.erb.tt`
533
+ * Contact slide
534
+ * Slide name: `999981.html.erb.tt`
535
+ * End slide
536
+ * Slide name: `999982.html.erb.tt`
537
+
538
+ If you place templates in one of the template directories - see [Normal Slide
539
+ Templates](#normal_slide_templates) for the concrete paths -
540
+ `middleman-presentation` will use your templates instead of the ones comming
541
+ with the gem.
542
+
543
+ If you want to modify the existing predefined slides, run the following command first,
544
+ it will copy the files to
545
+ `~/.config/middleman/presentation/templates/predefined_slides.d`.
546
+
547
+ ```
548
+ middleman-presentation init predefined_slides
549
+ ```
550
+
551
+ ## Configuration
552
+
553
+ <a name="configuration"></a>
554
+
555
+ `middleman-presentation` will try to find its configuration file at different places:
556
+
557
+ 1. User local: `~/.config/middleman/presentation/presentations.yaml`, `~/.middleman/presentation/presentations.yaml`
558
+ 2. System local: `/etc/middleman/presentation/presentations`
559
+
560
+ To get a full list of available configuration options and their values, run the following command
561
+
562
+ ```
563
+ middleman-presentation show config
564
+ ```
565
+
566
+ To get a full list of available configuration options and their default values, run the following command
567
+
568
+ ```
569
+ middleman-presentation show config --defaults
570
+ ```
571
+
572
+ ## Development
573
+
574
+ Make sure you've got a working internet connection before running the tests. To
575
+ keep the source code repository lean there tests that download assets via bower.
576
+
577
+ If you care about licensing, please have a look at [LICENSE.txt](LICENSE.txt).
578
+ As this software would not be possible without the wonderful gems out there,
579
+ there's also an overview about all the licenses used by the required gems at
580
+ [doc/licenses/dependencies.html](doc/licenses/dependencies.html).
581
+
582
+ If you get some weird errors during testing, make sure have got enough space at
583
+ `/tmp`. This directory is used by `bower` to temporary store downloaded assets.
584
+
585
+ To check which file consumes the whole space at `/tmp` you can use the following command:
586
+
587
+ ```bash
588
+ # output sizes in mebibytes and sort numerically
589
+ du -ms /tmp/* | sort -n
590
+ ```
591
+
592
+ To find the process which uses this file, run this command:
593
+
594
+ ```bash
595
+ lsof <file>
596
+ ```
597
+
598
+ ## Contributing
599
+
600
+ Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file.
601
+