Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Commit 95843ad

Browse files
author
mborges-pivotal
committed
added deck.j templates without git info
1 parent 94d7440 commit 95843ad

37 files changed

+824
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
== deck.js Backend for Asciidoctor
2+
3+
The https://github.com/asciidoctor/asciidoctor-deck.js[deck.js backend] is a collection of Haml templates for https://github.com/asciidoctor/asciidoctor[Asciidoctor] that transform an AsciiDoc document into HTML5 slides animated by http://imakewebthings.com/deck.js/[deck.js].
4+
5+
//image:https://travis-ci.org/asciidoctor/asciidoctor-deck.js.svg?branch=master[Build Status,link=https://travis-ci.org/asciidoctor/asciidoctor-deck.js]
6+
7+
== Usage Instructions
8+
9+
. Ensure Asciidoctor, Haml and all their dependencies are installed:
10+
11+
$ gem install asciidoctor tilt thread_safe haml
12+
13+
. Clone the asciidoctor-deck.js repository to get the templates necessary for converting AsciiDoc source to HTML slides:
14+
15+
$ git clone https://github.com/asciidoctor/asciidoctor-deck.js
16+
17+
. Edit `CONTENT_FILE` ( *.adoc or *.ad or ...):
18+
** Slides & content per slide
19+
** (Optional) Set presentation options at top of `CONTENT_FILE`.
20+
The options available & their values will depend on presentation library (some examples below).
21+
22+
:${Attribute}: ${Value}
23+
24+
. Generate HTML from the Asciidoctor templates
25+
.. Command Line:
26+
27+
$ asciidoctor -T templates/haml CONTENT_FILE
28+
29+
.. Build Script: use Ruby, JavaScript, Gradle or your favorite build tool/script with presentation options
30+
31+
. Copy or clone presentation library (to output destination/branch)
32+
33+
$ git clone https://github.com/imakewebthings/deck.js
34+
35+
TIP: If you are using https://pages.github.com/[GitHub Pages], plan ahead by keeping your source files on `master` branch and all output files on the `gh-pages` branch.
36+
37+
=== Additional Notes
38+
39+
* If you are planning to split your slides you also need to copy to `extensions` directory the `deck.split.js` file which can be downloaded from https://github.com/houqp/deck.split.js[GitHub]
40+
* If you want to use the fullscreen photo feature, you must create an `images` directory.
41+
42+
== Source Examples
43+
44+
// FIXME: incomplete
45+
46+
Let's see some examples of `deckjs` backend features:
47+
48+
----
49+
= Title Slide
50+
Presenter Name
51+
52+
== Slide One
53+
54+
Foo
55+
56+
Bar
57+
58+
World
59+
60+
[canvas-image=./images/cosplay.jpg]
61+
== Slide Two
62+
63+
[.canvas-caption, position=center-up]
64+
Hello World - Good Bye Cruel World
65+
----
66+
67+
In the previous snippet, we are creating a slide titled “Slide One” with bullets and another one titled “Slide Two” with centered text (the default behavior of deck.js) with https://github.com/hakimel/deck.js#speaker-notes[speaker notes].
68+
69+
Some things to consider:
70+
71+
* The `canvas-image` attribute receives as a parameter the location of image we want to use and always must go before the section.
72+
* If you are planning to add a message over the image, you can do it as usually, but probably won't be read good, using `position` attribute which positions text into the slide (bottom-left, top-left, bottom-right, top-right, center-up, center-down) and `canvas-caption` role will improve so much how text is rendered.
73+
74+
----
75+
== Another Slide
76+
77+
[%step]
78+
That's all.
79+
80+
[%step]
81+
My Folks
82+
----
83+
84+
In previous example we are creating one slide which instead of showing both paragraphs at the same time, will be presented each time you try to go to next slide.
85+
86+
And the same can be applied to lists, images, quotes, code:
87+
88+
----
89+
== Yet Another Slide
90+
91+
[%step]
92+
* A
93+
* B
94+
* C
95+
----
96+
97+
In this case, each bullet will appear to screen each time you try to go to next slide.
98+
99+
WARNING: The original deckjs backend for AsciiDoc used the option name _incremental_ instead of _step_.
100+
We've changed it here to save you some typing :)
101+
102+
== deck.js Options
103+
104+
There are some attributes that can be set at the top of the document which they are specific of `deckjs` backend.
105+
106+
[cols="1m,1,2"]
107+
|===
108+
|Attribute |Value(s) |Description
109+
110+
|:deckjs_theme:
111+
|*none*, web-2.0, swiss, neon
112+
|where you set the deck.js theme.
113+
114+
|:deckjs_transition:
115+
|*none*, horizontal-slide, vertical-slide, fade
116+
|where you set the kind of transition.
117+
118+
|:customjs:
119+
|<javascript folder>
120+
|where you set a custom javascript file. It can be used as a deck.js custom configuration.
121+
122+
|:customcss:
123+
|<css folder>
124+
|where you set a custom css file.
125+
126+
|:navigation:
127+
| _N/A_
128+
|the presence of this attribute makes deck.js to render a back/next icons.
129+
130+
|:status:
131+
| _N/A_
132+
|the presence of this attribute makes deck.js to render current slide and total number of slides.
133+
134+
|:split:
135+
| _N/A_
136+
|with this attribute we are registering the `deck.split.js` file.
137+
|===
138+
139+
NOTE: You can also specify a custom stylesheet using the `stylesheet` attribute, which can be used to customize AsciiDoc elements like section, paragraph, images, etc...
140+
141+
== Stay Connected
142+
143+
If you need any other feature supported by `deckjs` to be ported to this backend, any way to make it better or you find any bug, do not hesitate to open an issue.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%div{:id=>@id, :class=>['admonitionblock', (attr :name), role]}
2+
%table
3+
%tr
4+
%td.icon
5+
- if @document.attr? :icons, 'font'
6+
%i{:class=>"icon-#{attr :name}", :title=>@caption}
7+
- elsif @document.attr? :icons
8+
%img{:src=>icon_uri(attr :name), :alt=>@caption}
9+
- else
10+
.title=@caption
11+
%td.content
12+
- if title?
13+
.title=title
14+
=content.chomp
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
%div{:id=>@id, :class=>['audioblock', @style, role]}
2+
- if title?
3+
.title=captioned_title
4+
.content
5+
%audio{:src=>media_uri(attr :target), :autoplay=>(option? :autoplay),
6+
:controls=>!(option? :nocontrols), :loop=>(option? :loop)}
7+
Your browser does not support the audio tag.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
%div{:id=>@id, :class=>['colist', @style, role]}
2+
- if title?
3+
.title=title
4+
- if @document.attr? :icons
5+
- font_icons = @document.attr? :icons, 'font'
6+
%table
7+
- items.each_with_index do |item, i|
8+
- num = i + 1
9+
%tr
10+
%td<
11+
- if font_icons
12+
%i.conum{:data=>{:value=>num}}>
13+
%b=num
14+
- else
15+
%img{:src=>icon_uri("callouts/#{num}"), :alt=>num}
16+
%td=item.text
17+
- else
18+
%ol
19+
- items.each do |item|
20+
%li
21+
%p=item.text
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
- case @style
2+
- when 'steps'
3+
%div{:id=>@id, :class=>['slist', 'steps', role]}
4+
- if title?
5+
.title=title
6+
%ol
7+
- items.each do |headings, contents|
8+
%li
9+
- if has_role? 'headings'
10+
%h3=[*headings].first.text
11+
- else
12+
- [*headings].each do |heading|
13+
%p<
14+
%strong=heading.text
15+
- unless contents.nil?
16+
- if contents.text?
17+
%p<=contents.text
18+
- if contents.blocks?
19+
=contents.content.chomp
20+
- when 'qanda'
21+
%div{:id=>@id, :class=>['qlist', 'qanda', role]}
22+
- if title?
23+
.title=title
24+
%ol
25+
- items.each do |questions, answer|
26+
%li
27+
- [*questions].each do |question|
28+
%p<
29+
%em=question.text
30+
- unless answer.nil?
31+
- if answer.text?
32+
%p<=answer.text
33+
- if answer.blocks?
34+
=answer.content.chomp
35+
- when 'horizontal'
36+
%div{:id=>@id, :class=>['hdlist', role]}
37+
- if title?
38+
.title=title
39+
%table
40+
- if (attr? :labelwidth) || (attr? :itemwidth)
41+
%colgroup
42+
%col{:style=>((attr? :labelwidth) ? %(width:#{(attr :labelwidth).chomp '%'}%;) : nil)}
43+
%col{:style=>((attr? :itemwidth) ? %(width:#{(attr :itemwidth).chomp '%'}%;) : nil)}
44+
- items.each do |terms, dd|
45+
%tr
46+
%td{:class=>['hdlist1', ('strong' if (option? 'strong'))]}
47+
- terms = [*terms]
48+
- last_term = terms.last
49+
- terms.each do |dt|
50+
=dt.text
51+
- if dt != last_term
52+
%br
53+
%td.hdlist2
54+
- unless dd.nil?
55+
- if dd.text?
56+
%p<=dd.text
57+
- if dd.blocks?
58+
=dd.content.chomp
59+
- else
60+
%div{:id=>@id, :class=>['dlist',@style,role]}
61+
- if title?
62+
.title=title
63+
%dl
64+
- items.each do |terms, dd|
65+
- [*terms].each do |dt|
66+
%dt{:class=>('hdlist1' unless @style)}=dt.text
67+
- unless dd.nil?
68+
%dd
69+
- if dd.text?
70+
%p<=dd.text
71+
- if dd.blocks?
72+
=dd.content.chomp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%div{:id=>@id, :class=>['exampleblock', role, ('slide' if option? :step)]}
2+
- if title?
3+
.title=captioned_title
4+
.content
5+
=content.chomp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- haml_tag "h#{@level + 1}##{@id}", title, :class => [@style, role, ('slide' if option? :step)]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
%div{:id=>@id, :class=>['imageblock', @style, role, ('slide' if option? :step)],
2+
:style=>((css_style = [("text-align: #{attr :align}" if attr? :align),
3+
("float: #{attr :float}" if attr? :float)].compact * '; ').empty? ? nil : css_style)}
4+
.content
5+
- if attr? :link
6+
%a.image{:href=>(attr :link)}
7+
%img{:src=>image_uri(attr :target), :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height)}
8+
- else
9+
%img{:src=>image_uri(attr :target), :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height)}
10+
- if title?
11+
.title=captioned_title
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
%div{:id=>@id, :class=>['listingblock', role, ('slide' if option? :step)]}
2+
- if title?
3+
.title=captioned_title
4+
.content
5+
- nowrap = !(@document.attr? :prewrap) || (option? 'nowrap')
6+
- if @style == 'source'
7+
- language = attr :language
8+
- code_class = language ? [language, "language-#{language}"] : nil
9+
- pre_class = ['highlight']
10+
- pre_lang = nil
11+
- case attr 'source-highlighter'
12+
- when 'coderay'
13+
- pre_class = ['CodeRay']
14+
- when 'pygments'
15+
- pre_class = ['pygments','highlight']
16+
- when 'prettify'
17+
- pre_class = ['prettyprint']
18+
- pre_class << 'linenums' if attr? :linenums
19+
- pre_class << language if language
20+
- pre_class << "language-#{language}" if language
21+
- code_class = nil
22+
- when 'html-pipeline'
23+
- pre_lang = language
24+
- pre_class = code_class = nil
25+
- nowrap = false
26+
-#- when 'highlightjs', 'highlight.js'
27+
- pre_class << 'nowrap' if nowrap
28+
%pre{:class=>pre_class, :lang=>pre_lang}
29+
-# Haml automatically preserves whitespace in <pre> tags by replacing newlines with &#x000A;, but I'm not sure about the <code> tag
30+
%code{:class=>code_class}~content
31+
- else
32+
%pre{:class=>(nowrap ? 'nowrap' : nil)}
33+
-# Haml automatically preserves whitespace in <pre> tags by replacing newlines with &#x000A;, but I'm not sure about the <code> tag
34+
%code~content
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%div{:id=>@id, :class=>['literalblock', role, ('slide' if option? :step)]}
2+
- if title?
3+
.title=title
4+
.content
5+
%pre{:class=>(!(@document.attr? :prewrap) || (option? :nowrap) ? 'nowrap' : nil)}=content

0 commit comments

Comments
 (0)