asciidoctor-pdf 1.5.0.alpha.1
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.
- checksums.yaml +7 -0
- data/LICENSE.adoc +22 -0
- data/NOTICE.adoc +76 -0
- data/README.adoc +263 -0
- data/Rakefile +78 -0
- data/bin/asciidoctor-pdf +15 -0
- data/bin/optimize-pdf +63 -0
- data/data/fonts/LICENSE-liberation-fonts-2.00.1 +102 -0
- data/data/fonts/LICENSE-mplus-testflight-58 +16 -0
- data/data/fonts/LICENSE-noto-fonts-2014-01-30 +201 -0
- data/data/fonts/liberationmono-bold-latin.ttf +0 -0
- data/data/fonts/liberationmono-bolditalic-latin.ttf +0 -0
- data/data/fonts/liberationmono-italic-latin.ttf +0 -0
- data/data/fonts/liberationmono-regular-latin.ttf +0 -0
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bolditalic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
- data/data/fonts/mplus1p-bold-latin.ttf +0 -0
- data/data/fonts/mplus1p-light-latin.ttf +0 -0
- data/data/fonts/mplus1p-regular-latin.ttf +0 -0
- data/data/fonts/mplus1p-regular-multilingual.ttf +0 -0
- data/data/fonts/notoserif-bold-latin.ttf +0 -0
- data/data/fonts/notoserif-bolditalic-latin.ttf +0 -0
- data/data/fonts/notoserif-italic-latin.ttf +0 -0
- data/data/fonts/notoserif-regular-latin.ttf +0 -0
- data/data/themes/asciidoctor-theme.yml +174 -0
- data/data/themes/default-theme.yml +182 -0
- data/examples/chronicles.adoc +429 -0
- data/examples/chronicles.pdf +0 -0
- data/examples/example-pdf-screenshot.png +0 -0
- data/examples/example.adoc +27 -0
- data/examples/example.pdf +0 -0
- data/examples/sample-title-logo.jpg +0 -0
- data/examples/wolpertinger.jpg +0 -0
- data/lib/asciidoctor-pdf.rb +3 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/section.rb +26 -0
- data/lib/asciidoctor-pdf/converter.rb +1365 -0
- data/lib/asciidoctor-pdf/core_ext/array.rb +5 -0
- data/lib/asciidoctor-pdf/core_ext/ostruct.rb +9 -0
- data/lib/asciidoctor-pdf/implicit_header_processor.rb +59 -0
- data/lib/asciidoctor-pdf/pdfmarks.rb +30 -0
- data/lib/asciidoctor-pdf/prawn_ext.rb +3 -0
- data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +94 -0
- data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +529 -0
- data/lib/asciidoctor-pdf/prawn_ext/formatted_text/formatter.rb +29 -0
- data/lib/asciidoctor-pdf/prawn_ext/formatted_text/parser.rb +1012 -0
- data/lib/asciidoctor-pdf/prawn_ext/formatted_text/parser.treetop +115 -0
- data/lib/asciidoctor-pdf/prawn_ext/formatted_text/transform.rb +178 -0
- data/lib/asciidoctor-pdf/roman_numeral.rb +107 -0
- data/lib/asciidoctor-pdf/theme_loader.rb +103 -0
- data/lib/asciidoctor-pdf/version.rb +5 -0
- metadata +248 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
font:
|
2
|
+
catalog:
|
3
|
+
NotoSerif:
|
4
|
+
normal: notoserif-regular-latin.ttf
|
5
|
+
bold: notoserif-bold-latin.ttf
|
6
|
+
italic: notoserif-italic-latin.ttf
|
7
|
+
bold_italic: notoserif-bolditalic-latin.ttf
|
8
|
+
# NOTE currently, callout numbers don't work with LiberationMono
|
9
|
+
#LiberationMono:
|
10
|
+
# normal: liberationmono-regular-latin.ttf
|
11
|
+
# bold: liberationmono-bold-latin.ttf
|
12
|
+
# italic: liberationmono-italic-latin.ttf
|
13
|
+
# bold_italic: liberationmono-bolditalic-latin.ttf
|
14
|
+
Mplus1mn:
|
15
|
+
normal: mplus1mn-regular-ascii-conums.ttf
|
16
|
+
bold: mplus1mn-bold-ascii.ttf
|
17
|
+
italic: mplus1mn-italic-ascii.ttf
|
18
|
+
bold_italic: mplus1mn-bolditalic-ascii.ttf
|
19
|
+
#Mplus1pMultilingual:
|
20
|
+
# normal: mplus1p-regular-multilingual.ttf
|
21
|
+
#FontAwesome:
|
22
|
+
# normal: fontawesome-regular.ttf
|
23
|
+
# FIXME using fallbacks breaks use of custom font styles (fixed in Prawn 1.2.1!)
|
24
|
+
#fallbacks:
|
25
|
+
# - Mplus1pMultilingual
|
26
|
+
brand:
|
27
|
+
primary_color: 428bca
|
28
|
+
page:
|
29
|
+
background_color: ffffff
|
30
|
+
layout: portrait
|
31
|
+
# multiply inches by 72 to get pt values
|
32
|
+
margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
|
33
|
+
size: Letter
|
34
|
+
base:
|
35
|
+
font_color: 333333
|
36
|
+
font_family: NotoSerif
|
37
|
+
# choose one of these font_size/line_height_length combinations
|
38
|
+
#font_size: 14
|
39
|
+
#line_height_length: 20
|
40
|
+
#font_size: 11.25
|
41
|
+
#line_height_length: 18
|
42
|
+
#font_size: 11.2
|
43
|
+
#line_height_length: 16
|
44
|
+
font_size: 10.5
|
45
|
+
#line_height_length: 15
|
46
|
+
# correct line height for NotoSerif metrics
|
47
|
+
line_height_length: 12
|
48
|
+
#font_size: 11.25
|
49
|
+
#line_height_length: 18
|
50
|
+
line_height: $base_line_height_length / $base_font_size
|
51
|
+
font_size_large: round($base_font_size * 1.25)
|
52
|
+
font_size_small: round($base_font_size * 0.85)
|
53
|
+
font_style: normal
|
54
|
+
align: justify
|
55
|
+
border_radius: 4
|
56
|
+
border_width: 0.5
|
57
|
+
border_color: eeeeee
|
58
|
+
# FIXME vertical_rhythm is weird; we should think in terms of ems
|
59
|
+
#vertical_rhythm: $base_line_height_length * 2 / 3
|
60
|
+
# correct line height for NotoSerif metrics
|
61
|
+
vertical_rhythm: $base_line_height_length
|
62
|
+
horizontal_rhythm: $base_line_height_length
|
63
|
+
link_font_color: $brand_primary_color
|
64
|
+
heading:
|
65
|
+
font_color: $base_font_color
|
66
|
+
font_family: $base_font_family
|
67
|
+
# h1 is used for document title
|
68
|
+
font_size_h1: floor($base_font_size * 2.6)
|
69
|
+
# h2 is used for chapter title
|
70
|
+
font_size_h2: floor($base_font_size * 2.15)
|
71
|
+
font_size_h3: round($base_font_size * 1.7)
|
72
|
+
font_size_h4: $base_font_size_large
|
73
|
+
font_size_h5: $base_font_size
|
74
|
+
font_size_h6: $base_font_size_small
|
75
|
+
font_style: bold
|
76
|
+
#line_height: 1.4
|
77
|
+
# correct line height for NotoSerif metrics
|
78
|
+
line_height: 1.2
|
79
|
+
margin_top: $vertical_rhythm * 0.2
|
80
|
+
margin_bottom: $vertical_rhythm * 0.8
|
81
|
+
#prose:
|
82
|
+
# margin_top: 0
|
83
|
+
# margin_bottom: $vertical_rhythm
|
84
|
+
block:
|
85
|
+
#margin_top: 0
|
86
|
+
#margin_bottom: $vertical_rhythm
|
87
|
+
padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
|
88
|
+
# code is used for source blocks (perhaps change to source or listing?)
|
89
|
+
code:
|
90
|
+
font_color: $base_font_color
|
91
|
+
#font_family: LiberationMono
|
92
|
+
#font_size: floor($base_font_size * 0.9)
|
93
|
+
#font_size: 10
|
94
|
+
#padding: [9.5, 9.5, 9.5, 9.5]
|
95
|
+
# LiberationMono carries extra gap below line
|
96
|
+
#padding: [10, 10, 7.5, 10]
|
97
|
+
#line_height: 1.45
|
98
|
+
font_family: Mplus1mn
|
99
|
+
font_size: ceil($base_font_size)
|
100
|
+
#padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
|
101
|
+
padding: $code_font_size
|
102
|
+
line_height: 1.25
|
103
|
+
background_color: f5f5f5
|
104
|
+
border_color: cccccc
|
105
|
+
border_radius: $base_border_radius
|
106
|
+
border_width: 0.75
|
107
|
+
# literal is currently used for inline monospaced in prose and table cells
|
108
|
+
literal:
|
109
|
+
#font_color: c7254e
|
110
|
+
font_color: b12146
|
111
|
+
font_family: $code_font_family
|
112
|
+
blockquote:
|
113
|
+
font_color: $base_font_color
|
114
|
+
font_size: $base_font_size_large
|
115
|
+
border_width: 5
|
116
|
+
border_color: $base_border_color
|
117
|
+
cite_font_size: $base_font_size_small
|
118
|
+
cite_font_color: 999999
|
119
|
+
sidebar:
|
120
|
+
border_color: ffffff
|
121
|
+
border_radius: $base_border_radius
|
122
|
+
border_width: $base_border_width
|
123
|
+
background_color: eeeeee
|
124
|
+
title_font_color: $heading_font_color
|
125
|
+
title_font_family: $heading_font_family
|
126
|
+
title_font_size: $heading_font_size_h4
|
127
|
+
title_font_style: $heading_font_style
|
128
|
+
title_align: center
|
129
|
+
example:
|
130
|
+
border_color: $base_border_color
|
131
|
+
border_radius: $base_border_radius
|
132
|
+
border_width: 0.75
|
133
|
+
background_color: transparent
|
134
|
+
admonition:
|
135
|
+
border_color: $base_border_color
|
136
|
+
border_width: $base_border_width
|
137
|
+
caption:
|
138
|
+
font_style: italic
|
139
|
+
align: left
|
140
|
+
# FIXME perhaps set line_height instead of / in addition to margins?
|
141
|
+
margin_inside: $vertical_rhythm * 0.25
|
142
|
+
margin_outside: 0
|
143
|
+
conum:
|
144
|
+
font_family: Mplus1mn
|
145
|
+
font_color: $literal_font_color
|
146
|
+
font_size: $code_font_size
|
147
|
+
image:
|
148
|
+
align_default: left
|
149
|
+
scaled_width_default: 0.5
|
150
|
+
lead:
|
151
|
+
# QUESTION what about $base_font_size_large?
|
152
|
+
#font_size: floor($base_line_height_length * 0.8)
|
153
|
+
#font_size: floor($base_font_size * 1.15)
|
154
|
+
#line_height: 1.3
|
155
|
+
font_size: $base_font_size_large
|
156
|
+
line_height: 1.4
|
157
|
+
abstract:
|
158
|
+
#font_color: 404040
|
159
|
+
font_color: 5c6266
|
160
|
+
font_size: $lead_font_size
|
161
|
+
line_height: $lead_line_height
|
162
|
+
font_style: italic
|
163
|
+
thematic_break:
|
164
|
+
border_color: $base_border_color
|
165
|
+
margin_top: $vertical_rhythm * 0.5
|
166
|
+
margin_bottom: $vertical_rhythm * 1.5
|
167
|
+
description_list:
|
168
|
+
term_font_style: italic
|
169
|
+
description_indent: $horizontal_rhythm * 1.25
|
170
|
+
outline_list:
|
171
|
+
indent: $horizontal_rhythm * 1.25
|
172
|
+
table:
|
173
|
+
background_color: transparent
|
174
|
+
background_color_alt: f9f9f9
|
175
|
+
border_color: dddddd
|
176
|
+
border_width: $base_border_width
|
177
|
+
# HACK accounting for line-height
|
178
|
+
cell_padding: [3, 3, 6, 3]
|
179
|
+
footer:
|
180
|
+
font_size: $base_font_size_small
|
181
|
+
font_color: $base_font_color
|
182
|
+
border_color: dddddd
|
@@ -0,0 +1,429 @@
|
|
1
|
+
= The Dangerous and Thrilling Documentation Chronicles
|
2
|
+
Kismet Chameleon; Lazarus het_Draeke
|
3
|
+
v1.0, 2014-01-01: The first incarnation of {doctitle}
|
4
|
+
:description: This story chronicles the inexplicable hazards and vicious beasts a +
|
5
|
+
team must surmount and vanquish on the journey to finding their open source +
|
6
|
+
project's true power.
|
7
|
+
:doctype: book
|
8
|
+
:title-logo: sample-title-logo.jpg
|
9
|
+
// Settings:
|
10
|
+
:compat-mode:
|
11
|
+
:experimental:
|
12
|
+
:icons: font
|
13
|
+
:listing-caption: Listing
|
14
|
+
:sectnums:
|
15
|
+
:toc:
|
16
|
+
:toclevels: 3
|
17
|
+
ifdef::backend-pdf[]
|
18
|
+
:pagenums:
|
19
|
+
:pygments-style: bw
|
20
|
+
:source-highlighter: pygments
|
21
|
+
endif::[]
|
22
|
+
// URIs:
|
23
|
+
:wolper-uri: http://en.wikipedia.org/wiki/Wolpertinger
|
24
|
+
|
25
|
+
[abstract]
|
26
|
+
{description}
|
27
|
+
|
28
|
+
== It's a City Under Siege
|
29
|
+
|
30
|
+
This journey begins one late Monday afternoon at http://www.devoxx.be/#/[Devoxx].
|
31
|
+
Our team needs coffee, _desperately_, but none of us dare open the theater doors...
|
32
|
+
|
33
|
+
During the first workshop, a script-happy warlock inadvertently released a legion of Wolpertingers!
|
34
|
+
To leave now would mean *code dismemberment and certain death*.
|
35
|
+
|
36
|
+
Behold, the horror!
|
37
|
+
|
38
|
+
.Wolpertinger, stuffed
|
39
|
+
[.left.thumb]
|
40
|
+
image::wolpertinger.jpg[Wolpertinger,width=100%,scaledwidth=55%]
|
41
|
+
|
42
|
+
You may not be familiar with these {wolper-uri}[ravenous beasts].
|
43
|
+
Trust us, they'll eat your shorts and suck loops from your code.
|
44
|
+
In light of this danger, we've searched high and wide for the security crew's defensive operations manual.
|
45
|
+
We can't find it and the DefOps{empty}footnote:[a portmanteau of “defensive” and “operations”] werewolves haven't returned from their rendezvous at Bier Central.
|
46
|
+
They've either eaten each other or fallen victim to the Wolpertingers roaming the streets of Antwerp.
|
47
|
+
Quick, hit kbd:[Ctrl,Alt,Backspace] or select menu:File[Quit] and let's bail out of here!
|
48
|
+
|
49
|
+
WARNING: Working with werewolves leads to howling and trying to train aggressive regular expressions with Pavlovian reinforcement.
|
50
|
+
|
51
|
+
_Weak light from the hallway trickled across the theater, chased by a distant scream._
|
52
|
+
|
53
|
+
=== Rendezvous Point
|
54
|
+
|
55
|
+
Come on, _Bier Central_.
|
56
|
+
Did you have to ask?
|
57
|
+
If you beat me there, I'll take a http://www.sintbernardus.be/stbernardusabt12.php?l=en[St. Bernardus Abt 12].
|
58
|
+
|
59
|
+
[[ravages]]
|
60
|
+
== The Ravages of Writing
|
61
|
+
|
62
|
+
Crystalline XML tags relentlessly bombarded the theater.
|
63
|
+
|
64
|
+
.XML tags
|
65
|
+
[source,xml]
|
66
|
+
----
|
67
|
+
<author id="1">
|
68
|
+
<personname>
|
69
|
+
<firstname>Lazarus</firstname>
|
70
|
+
<surname>het Draeke</surname>
|
71
|
+
</personname>
|
72
|
+
</author>
|
73
|
+
----
|
74
|
+
|
75
|
+
Despite the assault, we were still attempting to draft an example of a defensive operation.
|
76
|
+
|
77
|
+
.DefOps Plan
|
78
|
+
====
|
79
|
+
Click btn:[Download Zip] to download the defensive operation plan bundle.
|
80
|
+
|
81
|
+
OMG!
|
82
|
+
Somebody please save us now!
|
83
|
+
I want my mum...and an extra-large double macchiato, please.
|
84
|
+
====
|
85
|
+
|
86
|
+
Unfortunaly, Lazarus and I had both come to the conclusion that we weren't going to get out of this without corrupted hardrives if we didn't locate caffeine within the next few hours.
|
87
|
+
|
88
|
+
=== A Recipe for Potion
|
89
|
+
|
90
|
+
This potion for a sample document contains the following ingredients, which are listed in a very random, chaotically nested order.
|
91
|
+
|
92
|
+
* all the headings
|
93
|
+
** syntax highlighted source code
|
94
|
+
*** non-syntax highlighted source code or just a listing block
|
95
|
+
* quote block
|
96
|
+
** verse block
|
97
|
+
*** table with some cell formatting
|
98
|
+
**** sequential paragraphs
|
99
|
+
***** admonition (at least one)
|
100
|
+
*** bullet list with nesting
|
101
|
+
** numbered list with nesting
|
102
|
+
** definition list
|
103
|
+
*** sidebar
|
104
|
+
* example block
|
105
|
+
** block image (no inline images)
|
106
|
+
*** inline formatting in a paragraph
|
107
|
+
**** two fresh Burdockian leaves
|
108
|
+
***** They must be harvested by the light of the teal moons.
|
109
|
+
|
110
|
+
Got square?
|
111
|
+
|
112
|
+
[square]
|
113
|
+
* one
|
114
|
+
* two
|
115
|
+
* three
|
116
|
+
|
117
|
+
==== Searching for Burdockian
|
118
|
+
|
119
|
+
.Steps for finding and preparing Burdockian leaves
|
120
|
+
. Locate dusty botany
|
121
|
+
.. Sneeze
|
122
|
+
... Sneeze some more
|
123
|
+
. Find section on Burdockian
|
124
|
+
.. Review its characteristics
|
125
|
+
... Take a picture of the diagram of its leaves
|
126
|
+
.... Don't rip out the picture like a troglodyte
|
127
|
+
..... Don't do it, I'm watching you
|
128
|
+
. Put on your hiking boots
|
129
|
+
. Freeze your butt off on the side of a mountain at midnight
|
130
|
+
.. By the way, you can't see toes by the light of the teal moons.
|
131
|
+
|
132
|
+
Let's start counting from 10.
|
133
|
+
|
134
|
+
[start=10]
|
135
|
+
. arabic (2)
|
136
|
+
.. loweralpha (a)
|
137
|
+
... lowerroman (i)
|
138
|
+
... lowerroman (ii)
|
139
|
+
... lowerroman (iii)
|
140
|
+
... lowerroman (iv)
|
141
|
+
.... upperalpha (A)
|
142
|
+
. arabic (2)
|
143
|
+
|
144
|
+
===== Are You Still Here?
|
145
|
+
|
146
|
+
.Move, move, move!
|
147
|
+
[CAUTION]
|
148
|
+
====
|
149
|
+
The Wolpertingers can smell your procrastination.
|
150
|
+
It's not their fault you can't find your boots.
|
151
|
+
====
|
152
|
+
|
153
|
+
====== Sigh...
|
154
|
+
|
155
|
+
TIP: Your boots are in your closet.
|
156
|
+
|
157
|
+
== Dawn on the Plateau
|
158
|
+
|
159
|
+
Lazarus was hanging from the bottom limb of a Burdockian tree, licking the bark.
|
160
|
+
|
161
|
+
[quote, Mark Tobey]
|
162
|
+
On pavements and the bark of trees I have found whole worlds.
|
163
|
+
|
164
|
+
``If there are whole worlds on that bark, he just swallowed them.'' Kizmet replied.
|
165
|
+
|
166
|
+
[verse,The documentation attorneys]
|
167
|
+
____
|
168
|
+
No bark was harmed in the making of this potion.
|
169
|
+
We're not so sure about a couple ants though.
|
170
|
+
|
171
|
+
Nor those worlds...
|
172
|
+
|
173
|
+
Crap, I smell an injunction.
|
174
|
+
____
|
175
|
+
|
176
|
+
We'd retrieved the leaves, but we'd obviously lost our minds in the process.
|
177
|
+
|
178
|
+
[verse]
|
179
|
+
Roses are +++<span style="color: #FF0000">red</span>+++.
|
180
|
+
Violets are +++<span style="color: #0000FF">blue</span>+++__-ish__.
|
181
|
+
|
182
|
+
== Words Seasoned with Power
|
183
|
+
|
184
|
+
_To tame_ the wild wolpertingers we needed to build a *charm*.
|
185
|
+
But **u**ltimate victory could only be won if we divined the *_true name_* of the __war__lock.
|
186
|
+
|
187
|
+
``What kind of charm?'' Lazarus asked. ``An odoriferous one or a mineral one?''
|
188
|
+
Kizmet shrugged. ``The note from Olaf's desk says `wormwood and licorice,' but these could be normal groceries for werewolves.''
|
189
|
+
|
190
|
+
``Well the H~2~O written on the security whiteboard could be part of a shopping list, but I don't think the local bodega also sells e = mc^2^.'' Lazarus replied.
|
191
|
+
|
192
|
+
``Wait!'' Indigo plucked a small vial from her desk's top drawer and held it toward us.
|
193
|
+
The vial's label read `+e = mc^2^+ +*_the scent of science_*+ +_smells like a genius_+'.
|
194
|
+
|
195
|
+
=== Can I Get Some +Code+?
|
196
|
+
|
197
|
+
[%hardbreaks]
|
198
|
+
Sure.
|
199
|
+
Have a listing block.
|
200
|
+
|
201
|
+
----
|
202
|
+
This is an example of a listing block.
|
203
|
+
The content inside is rendered as <pre> text.
|
204
|
+
----
|
205
|
+
|
206
|
+
But I'm not giving you any highlighting shazam just yet.
|
207
|
+
|
208
|
+
.What is a listing block?
|
209
|
+
****
|
210
|
+
Like literal blocks, the content in listing blocks is displayed exactly as you entered it.
|
211
|
+
Listing block content is rendered as +<pre>+ text.
|
212
|
+
|
213
|
+
The +listing+ style is applied to an element, such as a paragraph, by setting the +listing+ attribute on that element.
|
214
|
+
****
|
215
|
+
|
216
|
+
Let's get our highlighting on!
|
217
|
+
|
218
|
+
<<<
|
219
|
+
|
220
|
+
Install Prawn:
|
221
|
+
|
222
|
+
$ gem install prawn
|
223
|
+
|
224
|
+
Then create your first PDF document in Ruby!
|
225
|
+
|
226
|
+
.Generates a basic PDF document using Prawn
|
227
|
+
```ruby
|
228
|
+
require 'prawn' # <1>
|
229
|
+
|
230
|
+
Prawn::Document.generate 'output.pdf' do # <3>
|
231
|
+
text 'Hello, World!' # <2>
|
232
|
+
end
|
233
|
+
```
|
234
|
+
<1> Imports Prawn library
|
235
|
+
<2> Adds text “Hello, World!” to first page
|
236
|
+
<3> Writes PDF to [file]_output.pdf_ after executing all statements
|
237
|
+
|
238
|
+
How about some source code that styles code? So meta!
|
239
|
+
|
240
|
+
```css
|
241
|
+
code {
|
242
|
+
padding: 2px 4px;
|
243
|
+
font-size: 90%;
|
244
|
+
color: #c7254e;
|
245
|
+
white-space: nowrap !important;
|
246
|
+
background-color: #f9f2f4;
|
247
|
+
border-radius: 4px;
|
248
|
+
}
|
249
|
+
```
|
250
|
+
|
251
|
+
Where could we go without some Java?
|
252
|
+
|
253
|
+
```java
|
254
|
+
package org.javaee7.cdi.events;
|
255
|
+
|
256
|
+
import javax.enterprise.context.SessionScoped;
|
257
|
+
import javax.enterprise.event.Observes;
|
258
|
+
import java.io.Serializable;
|
259
|
+
|
260
|
+
/**
|
261
|
+
* @author The Duke
|
262
|
+
*/
|
263
|
+
@SessionScoped
|
264
|
+
public class GreetingReceiver implements EventReceiver, Serializable {
|
265
|
+
private String greet = "Willkommen";
|
266
|
+
|
267
|
+
void receive(@Observes String greet) {
|
268
|
+
this.greet = greet;
|
269
|
+
}
|
270
|
+
|
271
|
+
@Override
|
272
|
+
public String getGreet() {
|
273
|
+
return greet;
|
274
|
+
}
|
275
|
+
}
|
276
|
+
```
|
277
|
+
|
278
|
+
We already showed you an XML example in <<ravages>>.
|
279
|
+
|
280
|
+
I'll trade you a little table for some of that bark.
|
281
|
+
|
282
|
+
[cols=3,frame=topbot,grid=rows]
|
283
|
+
|===
|
284
|
+
|Name of Column 1 |Name of Column 2 |Name of Column 3
|
285
|
+
|
286
|
+
^m|Prefix the +{vbar}+ with +{caret}+ to center content horizontally
|
287
|
+
.<|Prefix the +{vbar}+ with a +.+ and +<+ to align the content to the top of the cell
|
288
|
+
>|Prefix the +{vbar}+ with +>+ to align the content to the right horizontally
|
289
|
+
|
290
|
+
3+^.^e|This content spans three columns (+3{plus}+) and is centered horizontally (+{caret}+) and vertically (+.{caret}+) within the cell.
|
291
|
+
|===
|
292
|
+
|
293
|
+
Wait.
|
294
|
+
What?
|
295
|
+
Where is this story going?
|
296
|
+
|
297
|
+
+<span>+:: an html tag that makes me crazy
|
298
|
+
|
299
|
+
align:: something I never get going in the right direction.
|
300
|
+
Also has to do with my poor verbal communication skills
|
301
|
+
|
302
|
+
float::
|
303
|
+
style::
|
304
|
+
don't make me laugh
|
305
|
+
|
306
|
+
Does anyone have the time?
|
307
|
+
|
308
|
+
Tg lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
309
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
310
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
311
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborumj.
|
312
|
+
|
313
|
+
== Keeping It Together
|
314
|
+
|
315
|
+
On this page we have nested ``keep together'' logic.
|
316
|
+
The combined block will be shifted to the next page if there isn't room available on this one.
|
317
|
+
|
318
|
+
[verse]
|
319
|
+
First,
|
320
|
+
we
|
321
|
+
need
|
322
|
+
to
|
323
|
+
waste
|
324
|
+
several
|
325
|
+
lines
|
326
|
+
using
|
327
|
+
a
|
328
|
+
verse
|
329
|
+
to
|
330
|
+
push
|
331
|
+
it
|
332
|
+
to
|
333
|
+
the
|
334
|
+
breaking
|
335
|
+
point.
|
336
|
+
|
337
|
+
[NOTE]
|
338
|
+
.What happens if there is both a field and a method with the same name?
|
339
|
+
====
|
340
|
+
Back to the previous example, suppose that we have both a field and a method with the same name, as in:
|
341
|
+
|
342
|
+
.Java class with a field and method that share the same name
|
343
|
+
[source,java]
|
344
|
+
----
|
345
|
+
public class Foo {
|
346
|
+
public String bar;
|
347
|
+
|
348
|
+
public String bar() {
|
349
|
+
return bar;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
----
|
353
|
+
|
354
|
+
*Golo resolves methods first, fields last.*
|
355
|
+
Hence, the following Golo code will resolve the +bar()+ method, not the +bar+ field:
|
356
|
+
|
357
|
+
.Golo picks the method over the field with the same name
|
358
|
+
----
|
359
|
+
let foo = Foo()
|
360
|
+
|
361
|
+
# Write the field
|
362
|
+
foo: bar("baz")
|
363
|
+
|
364
|
+
# Calls the bar() method
|
365
|
+
println(foo: bar())
|
366
|
+
----
|
367
|
+
====
|
368
|
+
|
369
|
+
<<<
|
370
|
+
|
371
|
+
Here's a preview of how each heading level is rendered.
|
372
|
+
|
373
|
+
[discrete]
|
374
|
+
= Heading 1 (Level 0)
|
375
|
+
|
376
|
+
filler content
|
377
|
+
|
378
|
+
[discrete]
|
379
|
+
== Heading 2 (Level 1)
|
380
|
+
|
381
|
+
filler content
|
382
|
+
|
383
|
+
[discrete]
|
384
|
+
=== Heading 3 (Level 2)
|
385
|
+
|
386
|
+
filler content
|
387
|
+
|
388
|
+
[discrete]
|
389
|
+
==== Heading 4 (Level 3)
|
390
|
+
|
391
|
+
filler content
|
392
|
+
|
393
|
+
[discrete]
|
394
|
+
===== Heading 5 (Level 4)
|
395
|
+
|
396
|
+
filler content
|
397
|
+
|
398
|
+
[discrete]
|
399
|
+
====== Heading 6 (Level 5)
|
400
|
+
|
401
|
+
filler content
|
402
|
+
|
403
|
+
---
|
404
|
+
|
405
|
+
--
|
406
|
+
Here's some content inside an open block.
|
407
|
+
--
|
408
|
+
|
409
|
+
<<<
|
410
|
+
|
411
|
+
== Credits
|
412
|
+
|
413
|
+
.Brought to you by OpenDevise
|
414
|
+
[%header,cols="1,1s,1",grid=rows,frame=topbot]
|
415
|
+
|===
|
416
|
+
|Name
|
417
|
+
|Title
|
418
|
+
|Alias
|
419
|
+
|
420
|
+
|Sarah White
|
421
|
+
|President
|
422
|
+
|http://twitter.com/carbonfray[@carbonfray]
|
423
|
+
|
424
|
+
|Dan Allen
|
425
|
+
|Vice President
|
426
|
+
|http://twitter.com/mojavelinux[@mojavelinux]
|
427
|
+
|
428
|
+
3+^.e|Powered by Open Source
|
429
|
+
|===
|