jekyll-asciidoc 1.1.2 → 2.0.0
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 +4 -4
- data/{LICENSE → LICENSE.adoc} +4 -3
- data/README.adoc +832 -122
- data/Rakefile +10 -1
- data/lib/jekyll-asciidoc.rb +6 -151
- data/lib/jekyll-asciidoc/compat.rb +14 -0
- data/lib/jekyll-asciidoc/converter.rb +218 -0
- data/lib/jekyll-asciidoc/filters.rb +18 -0
- data/lib/jekyll-asciidoc/integrator.rb +119 -0
- data/lib/jekyll-asciidoc/mixins.rb +12 -0
- data/lib/jekyll-asciidoc/utils.rb +86 -0
- data/lib/jekyll-asciidoc/version.rb +1 -1
- metadata +36 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f6d28bbd931f1d823e06625ad68b9314cf8836
|
4
|
+
data.tar.gz: c59995e13e47e147624ec578d4c42cf5d187953f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97b51d72a92abc00d2bed80fc561ef74bb26e9022be6204af97dca38830f38bf09f54bd18fc99920e4cacbc171f86e0f238a322f7ec291f3aa0cf56752e5dd2
|
7
|
+
data.tar.gz: e1905e712312e6d108de8f79ad69717477d71f33f62b4baf653ca86f7988f80b203172b8e1027070a5a27b20cd23190a052996cc44a4dce3263480963b0f2551
|
data/{LICENSE → LICENSE.adoc}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
The MIT License
|
2
|
-
|
3
|
-
Copyright (C) 2013 Dan Allen
|
1
|
+
.The MIT License
|
2
|
+
....
|
3
|
+
Copyright (C) 2013-2016 Dan Allen and the Asciidoctor Project
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
THE SOFTWARE.
|
22
|
+
....
|
data/README.adoc
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
= Jekyll AsciiDoc Plugin (powered by Asciidoctor)
|
2
|
-
|
2
|
+
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Paul Rayner <https://github.com/paulrayner[@paulrayner]>
|
3
|
+
v2.0.0, 2016-07-02
|
3
4
|
// Settings:
|
4
5
|
:idprefix:
|
5
6
|
:idseparator: -
|
@@ -18,115 +19,188 @@ ifdef::env-github[]
|
|
18
19
|
:tip-caption: :bulb:
|
19
20
|
:warning-caption: :warning:
|
20
21
|
endif::[]
|
21
|
-
|
22
|
-
|
22
|
+
// Aliases:
|
23
|
+
:path-config: pass:q[[path]___config.yml__]
|
24
|
+
:conum-guard: {sp}
|
25
|
+
ifndef::icons[:conum-guard: {sp}#{sp}]
|
26
|
+
// URIs:
|
27
|
+
:uri-repo: https://github.com/asciidoctor/jekyll-asciidoc
|
28
|
+
:uri-issues: {uri-repo}/issues
|
29
|
+
:uri-search-issues: {uri-repo}/search?type=Issues
|
30
|
+
:uri-chat: https://gitter.im/asciidoctor/asciidoctor
|
31
|
+
:uri-ci: https://travis-ci.org/asciidoctor/jekyll-asciidoc
|
32
|
+
:uri-gem: http://rubygems.org/gems/jekyll-asciidoc
|
33
|
+
:uri-gem-asciidoctor: http://rubygems.org/gems/asciidoctor
|
34
|
+
:uri-asciidoc: http://asciidoc.org
|
35
|
+
:uri-asciidoctor: http://asciidoctor.org
|
36
|
+
:uri-asciidoctor-backends: https://github.com/asciidoctor/asciidoctor-backends
|
37
|
+
:uri-asciidoctor-docs: {uri-asciidoctor}/docs
|
38
|
+
:uri-asciidoctor-diagram: {uri-asciidoctor-docs}/asciidoctor-diagram
|
39
|
+
:uri-asciidoctor-discuss: http://discuss.asciidoctor.org
|
40
|
+
:uri-asciidoctor-manual: {uri-asciidoctor-docs}/user-manual
|
41
|
+
:uri-asciidoc-practices: {uri-asciidoctor-docs}/asciidoc-recommended-practices
|
42
|
+
:uri-jaq: https://github.com/asciidoctor/jekyll-asciidoc-quickstart
|
43
|
+
:uri-jekyll: https://jekyllrb.com
|
44
|
+
:uri-jekyll-docs: {uri-jekyll}/docs
|
45
|
+
:uri-jekyll-discuss: https://talk.jekyllrb.com
|
46
|
+
:uri-front-matter: {uri-jekyll-docs}/frontmatter
|
47
|
+
:uri-liquid-templates: {uri-jekyll-docs}/templates
|
48
|
+
:uri-graphviz: http://www.graphviz.org
|
49
|
+
:uri-tilt: https://github.com/rtomayko/tilt
|
50
|
+
:uri-yaml: https://en.wikipedia.org/wiki/YAML
|
51
|
+
:uri-guide-publish-gem: http://guides.rubygems.org/publishing/#publishing-to-rubygemsorg
|
23
52
|
|
24
53
|
ifdef::status[]
|
25
|
-
image
|
54
|
+
image:https://img.shields.io/gem/v/jekyll-asciidoc.svg?label=gem%20version[Gem Version, link={uri-gem}]
|
55
|
+
image:https://img.shields.io/travis/asciidoctor/jekyll-asciidoc/master.svg[Build Status (Travis CI), link={uri-ci}]
|
26
56
|
endif::[]
|
27
57
|
|
58
|
+
A plugin for {uri-jekyll}[Jekyll] (>= 2.3.0) that converts {uri-asciidoc}[AsciiDoc] source files in your site to HTML pages using {uri-asciidoctor}[Asciidoctor].
|
59
|
+
|
28
60
|
== Overview
|
29
61
|
|
30
62
|
The plugin consists of three extensions:
|
31
63
|
|
32
|
-
`Jekyll::
|
33
|
-
|
34
|
-
|
35
|
-
Promotes select AsciiDoc attributes to Jekyll front matter (e.g., title, author, page-layout)
|
36
|
-
`Jekyll::Filters.asciidocify`::
|
37
|
-
A Liquid filter for converting AsciiDoc content to HTML using the AsciiDocConverter
|
38
|
-
|
39
|
-
These extensions are loaded automatically when the jekyll-asciidoc is required.
|
64
|
+
Converter -- `Jekyll::AsciiDoc::Converter`::
|
65
|
+
Converts AsciiDoc files to HTML pages.
|
66
|
+
This plugin currently uses Asciidoctor to convert AsciiDoc content.
|
40
67
|
|
41
|
-
|
42
|
-
|
43
|
-
The plugin depends on the http://rubygems.org/gems/asciidoctor[asciidoctor] gem.
|
44
|
-
You can install the gem using:
|
68
|
+
Generator -- `Jekyll::AsciiDoc::Integrator`::
|
69
|
+
Promotes select AsciiDoc attributes (e.g., title, author, page-layout, page-*) to page variables (merged with the page variables defined in the front matter header).
|
45
70
|
|
46
|
-
|
71
|
+
Liquid Filter -- `asciidocify`::
|
72
|
+
A Liquid filter that uses the converter from this plugin to convert AsciiDoc content to HTML.
|
47
73
|
|
48
|
-
|
74
|
+
These extensions are registered automatically when the [app]*jekyll-asciidoc* gem is required.
|
49
75
|
|
50
|
-
|
51
|
-
----
|
52
|
-
source 'https://rubygems.org'
|
76
|
+
== Installation
|
53
77
|
|
54
|
-
gem
|
55
|
-
gem
|
56
|
-
----
|
78
|
+
This plugin is packaged as a gem named [app]*{uri-gem}[jekyll-asciidoc]* and published to RubyGems.org.
|
79
|
+
The plugin depends on the [app]*{uri-gem-asciidoctor}[asciidoctor]* gem, which gets installed automatically.
|
57
80
|
|
58
|
-
|
81
|
+
Your method of installation will depend on whether you use Bundler to manage the dependencies for your Jekyll project.
|
59
82
|
|
60
|
-
|
83
|
+
=== Installation Using Bundler
|
61
84
|
|
62
|
-
|
63
|
-
|
64
|
-
Using Bundler::
|
65
|
-
+
|
66
|
-
--
|
67
|
-
Add the `jekyll-asciidoc` plugin gem to your [path]_Gemfile_
|
85
|
+
If you're using Bundler to manage the dependencies for your project (as recommended), simply add the [app]*jekyll-asciidoc* gem to the `:jekyll_plugins` group in your [path]_Gemfile_:
|
68
86
|
|
69
87
|
[source,ruby]
|
88
|
+
----
|
70
89
|
group :jekyll_plugins do
|
71
90
|
gem 'jekyll-asciidoc'
|
72
91
|
end
|
92
|
+
----
|
73
93
|
|
74
|
-
Then, run the
|
94
|
+
Then, run the `bundle` command from Bundler to install the gem:
|
75
95
|
|
76
|
-
$ bundle
|
77
|
-
--
|
96
|
+
$ bundle
|
78
97
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
If you are not using Bundler for managing Jekyll then install gems manually
|
98
|
+
=== Manual Installation
|
99
|
+
|
100
|
+
If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually:
|
83
101
|
|
84
|
-
$ gem install jekyll-asciidoc
|
102
|
+
$ [sudo] gem install jekyll-asciidoc
|
85
103
|
|
86
|
-
|
104
|
+
NOTE: The `sudo` prefix is only required if you are installing gems into your system.
|
105
|
+
To avoid this bad practice, we recommend using RVM (or another Ruby version manager), which sets up Ruby safely in your home directory.
|
106
|
+
|
107
|
+
Then add the [app]*jekyll-asciidoc* gem to the list of gems for Jekyll to load in your site's {path-config} file:
|
87
108
|
|
88
109
|
[source,yaml]
|
110
|
+
----
|
89
111
|
gems:
|
90
112
|
- jekyll-asciidoc
|
91
|
-
|
92
|
-
|
93
|
-
=== Installing development version of the plugin
|
94
|
-
|
95
|
-
To install the development version of this plugin, use:
|
96
|
-
|
97
|
-
$ rake install
|
113
|
+
----
|
98
114
|
|
99
|
-
|
115
|
+
== Creating Pages
|
100
116
|
|
101
|
-
|
117
|
+
This plugin converts eligible AsciiDoc files located inside the source directory (by default, the project root) to HTML pages in the generated site.
|
118
|
+
There are a few conditions that must be met in order for an AsciiDoc file to be eligible:
|
102
119
|
|
103
|
-
|
120
|
+
. The file must have an AsciiDoc file extension (see <<configuration>>).
|
121
|
+
. The name of the file must not begin with a dot (`.`) or an underscore (`_`).footnoteref:[excluded_files,Hidden files and folders are automatically excluded by Jekyll.]
|
122
|
+
. The file must not be located in a folder whose name begins with a dot (`.`) or an underscore (`_`) (unless the folder is a designated collection, such as _posts).footnoteref:[excluded_files]
|
123
|
+
. With the exception of posts, documents must begin with a {uri-front-matter}[front matter header] if using a version of this plugin < 2.0.0.
|
124
|
+
Since version 2.0.0 of this plugin, the front matter header is always optional.
|
104
125
|
|
105
|
-
|
126
|
+
Here's a sample AsciiDoc file that meets these criteria:
|
106
127
|
|
107
128
|
.sample.adoc
|
108
|
-
[
|
109
|
-
|
129
|
+
[source,asciidoc]
|
130
|
+
----
|
110
131
|
---
|
132
|
+
layout: info
|
133
|
+
permalink: /sample/
|
111
134
|
---
|
112
135
|
= Sample Page
|
113
|
-
:
|
114
|
-
:permalink: /page/
|
136
|
+
:uri-asciidoctor: http://asciidoctor.org
|
115
137
|
|
116
138
|
This is a sample page composed in AsciiDoc.
|
117
|
-
Jekyll converts it to HTML using
|
139
|
+
Jekyll converts it to HTML using {uri-asciidoctor}[Asciidoctor].
|
118
140
|
|
119
141
|
[source,ruby]
|
142
|
+
puts "Hello, World!"
|
120
143
|
----
|
144
|
+
|
145
|
+
Alternatively, you can define the page variables directly in the AsciiDoc header, which we recommend:
|
146
|
+
|
147
|
+
.sample.adoc
|
148
|
+
[source,asciidoc]
|
149
|
+
----
|
150
|
+
= Sample Page
|
151
|
+
:page-layout: info
|
152
|
+
:page-permalink: /sample/
|
153
|
+
:uri-asciidoctor: http://asciidoctor.org
|
154
|
+
|
155
|
+
This is a sample page composed in AsciiDoc.
|
156
|
+
Jekyll converts it to HTML using {uri-asciidoctor}[Asciidoctor].
|
157
|
+
|
158
|
+
[source,ruby]
|
121
159
|
puts "Hello, World!"
|
122
160
|
----
|
123
|
-
....
|
124
161
|
|
125
|
-
|
126
|
-
|
162
|
+
AsciiDoc attributes defined in the document header whose names begin with ``page-``footnote:[The prefix used to label page attributes can be customized.] get promoted to page variables.
|
163
|
+
The part of the name after the `page-` prefix is used as the entry's key (e.g., page-layout becomes layout) and the value is interpeted as {uri-yaml}[YAML] data (that which can be expressed in a single line).
|
127
164
|
|
128
|
-
|
129
|
-
|
165
|
+
The most commonly defined page variable is layout, which determines which template is used to wrap the generated content.
|
166
|
+
Jekyll will look for a template file inside the [path]_{empty}_layouts_ folder whose root name matches the name of the layout.
|
167
|
+
For example, if the layout variable has the value `info`, Jekyll looks for a layout template at the path [path]__layout/info.html_.
|
168
|
+
|
169
|
+
If the layout is empty, the auto-selected layout layout is used (documented in the list below).
|
170
|
+
If the layout is unset or `false`, the AsciiDoc processor will generate a standalone document.
|
171
|
+
In this case, the page will appear like an HTML file generated by the AsciiDoc processor directly (with the option `header_footer: true`).
|
172
|
+
If the layout is ~, no layout is applied.
|
173
|
+
|
174
|
+
To review, here are the different ways to specify a layout using the AsciiDoc attribute page-layout:
|
175
|
+
|
176
|
+
* `:page-layout: info` -- use the layout named `info` (e.g., [path]__layout/info.html_)
|
177
|
+
* _not specified_, `:page-layout:` or `:page-layout: _auto` -- use the automatic layout (i.e., `page` for pages, `post` for posts, the singular form of the collection label for a document; if the auto-selected layout isn't available, the layout `default` is used)
|
178
|
+
* `:!page-layout:` or `:page-layout: false` -- don't use a layout; instead, generate a standalone HTML document
|
179
|
+
* `:page-layout: ~` -- don't use a layout (often results in an incomplete HTML file)
|
180
|
+
|
181
|
+
In addition to page attributes defined explicitly, the following implicit AsciiDoc attributes are also promoted to page variables:
|
182
|
+
|
183
|
+
* doctitle (i.e., the document title) (becomes title)
|
184
|
+
* author
|
185
|
+
* revdate (becomes date; value is converted to a DateTime object; only for posts)
|
186
|
+
|
187
|
+
Unlike other content files, the {uri-liquid-templates}[Liquid template preprocessor] is not applied to AsciiDoc files by default (as of version 2.0.0 of this plugin).
|
188
|
+
If you want the Liquid template preprocessor to be applied to an AsciiDoc file (prior to the content being passed to the AsciiDoc processor), you must enable it by setting the `liquid` page variable (shown here defined using a page attribute).
|
189
|
+
|
190
|
+
[source,asciidoc]
|
191
|
+
----
|
192
|
+
:page-liquid:
|
193
|
+
----
|
194
|
+
|
195
|
+
IMPORTANT: AsciiDoc files may include a {uri-front-matter}[front matter header] for defining page variables.
|
196
|
+
If present, the front matter header must be the very first character of the file.
|
197
|
+
The front matter header won't be seen--and could distort conversion--if the front matter is preceded by whitespace or a Byte Order Mark (BOM).
|
198
|
+
|
199
|
+
NOTE: As of version 2.0.0 of this plugin, you may exclude the front matter header, as shown in the second example above.
|
200
|
+
Prior to version 2.0.0, you had to include at least an empty front matter header (except for posts).
|
201
|
+
In these cases, you define all the page variables (e.g., layout) using AsciiDoc page attributes instead of in the front matter.
|
202
|
+
You can also use a combination of both.
|
203
|
+
When intermixed, the page attributes defined in the AsciiDoc header take precedence.
|
130
204
|
|
131
205
|
You can now build your site using:
|
132
206
|
|
@@ -136,83 +210,325 @@ and preview it using:
|
|
136
210
|
|
137
211
|
$ jekyll serve
|
138
212
|
|
139
|
-
If you
|
213
|
+
If you're using Bundler, then prefix the commands with `bundle exec`, as in:
|
140
214
|
|
141
215
|
$ bundle exec jekyll build
|
142
|
-
|
216
|
+
|
217
|
+
To see a report of all the files that are processed, add the `--verbose` flag:
|
218
|
+
|
219
|
+
$ jekyll build --verbose
|
220
|
+
|
221
|
+
If an AsciiDoc file is not listed, then likely Jekyll did not find a {uri-front-matter}[front matter header].
|
143
222
|
|
144
223
|
IMPORTANT: If you use the `--safe` option, the AsciiDoc plugin will not be activated.
|
145
224
|
The `--safe` flag disables third-party plugins such as this one.
|
146
225
|
|
147
|
-
== Configuration
|
226
|
+
== Configuration
|
227
|
+
|
228
|
+
This section describes the configuration options for this plugin, which are _optional_.
|
229
|
+
|
230
|
+
You should at least assign an empty Hash as a default (e.g., `{}`) to the `asciidoc` and `asciidoctor` keys in {path-config}, respectively, if you don't plan on making any further customizations.
|
231
|
+
|
232
|
+
[source,yaml]
|
233
|
+
----
|
234
|
+
asciidoc: {}
|
235
|
+
asciidoctor: {}
|
236
|
+
----
|
237
|
+
|
238
|
+
Using these placeholder values is an optimization that prevents initialization from being performed more than once.
|
239
|
+
|
240
|
+
=== AsciiDoc
|
241
|
+
|
242
|
+
NOTE: Prior to version 2.0.0 of this plugin, the configuration keys in this section were defined as flat, top-level names (e.g., `asciidoc_ext`).
|
243
|
+
These names are now deprecated, but still supported.
|
148
244
|
|
149
245
|
By default, this plugin uses Asciidoctor to convert AsciiDoc files.
|
150
|
-
Since Asciidoctor is the only option, the default setting is equivalent to the following configuration in
|
246
|
+
Since Asciidoctor is currently the only option, the default setting is equivalent to the following configuration in {path-config}:
|
151
247
|
|
152
248
|
[source,yaml]
|
153
|
-
|
249
|
+
----
|
250
|
+
asciidoc:
|
251
|
+
processor: asciidoctor
|
252
|
+
----
|
154
253
|
|
155
|
-
|
254
|
+
IMPORTANT: The `asciidoc` block should only appear _once_ inside {path-config}.
|
255
|
+
If you define any other options that are documented in this section, you should append them to the `asciidoc` block.
|
256
|
+
|
257
|
+
To tell Jekyll which file extensions to match as AsciiDoc files, append the `ext` option to the `asciidoc` block of your {path-config}:
|
156
258
|
|
157
259
|
[source,yaml]
|
158
|
-
|
260
|
+
----
|
261
|
+
asciidoc:
|
262
|
+
ext: asciidoc,adoc,ad
|
263
|
+
----
|
159
264
|
|
160
265
|
The extensions shown in the previous listing are the default values, so you don't need to specify this option if those defaults are sufficient.
|
161
266
|
|
162
|
-
AsciiDoc attributes defined in the document header whose names begin with `page-` are promoted to
|
267
|
+
AsciiDoc attributes defined in the document header whose names begin with `page-` are promoted to page variables.
|
163
268
|
The part of the name after the `page-` prefix is used as the key (e.g., page-layout becomes layout).
|
164
|
-
If you want to change this attribute prefix,
|
269
|
+
If you want to change this attribute prefix, append the `page_attribute_prefix` option to the `asciidoc` block of your {path-config}:
|
165
270
|
|
166
271
|
[source,yaml]
|
167
|
-
|
272
|
+
----
|
273
|
+
asciidoc:
|
274
|
+
page_attribute_prefix: jekyll
|
275
|
+
----
|
168
276
|
|
169
277
|
A hyphen is automatically added to the value of this configuration setting if the value is non-empty.
|
170
278
|
|
171
|
-
|
279
|
+
Since version 2.0.0 of this plugin, all non-hidden AsciiDoc files are processed by default, even those without a front matter header.
|
280
|
+
If you only want files containing a front matter header to be processed (as was the behavior prior to version 2.0.0), add the `require_front_matter_header` option to the `asciidoc` block of your {path-config}:
|
172
281
|
|
173
282
|
[source,yaml]
|
283
|
+
----
|
284
|
+
asciidoc:
|
285
|
+
require_front_matter_header: true
|
286
|
+
----
|
287
|
+
|
288
|
+
=== Asciidoctor
|
289
|
+
|
290
|
+
In addition to the built-in attributes in AsciiDoc, the following additional AsciiDoc attributes are automatically defined by this plugin and available to all AsciiDoc-based pages:
|
291
|
+
|
292
|
+
....
|
293
|
+
site-root=(absolute path of root directory)
|
294
|
+
site-source=(absolute path of source directory)
|
295
|
+
site-destination=(absolute path of output directory)
|
296
|
+
site-baseurl=(value of the baseurl config option)
|
297
|
+
site-url=(value of the url config option)
|
298
|
+
env=site
|
299
|
+
env-site
|
300
|
+
site-gen=jekyll
|
301
|
+
site-gen-jekyll
|
302
|
+
builder=jekyll
|
303
|
+
builder-jekyll
|
304
|
+
jekyll-version=(value of the Jekyll::VERSION constant)
|
305
|
+
idprefix
|
306
|
+
idseparator=-
|
307
|
+
linkattrs=@
|
308
|
+
....
|
309
|
+
|
310
|
+
The following attributes are defined per page:
|
311
|
+
|
312
|
+
....
|
313
|
+
outpath=(path of page relative to baseurl)
|
314
|
+
....
|
315
|
+
|
316
|
+
You can pass additional attributes to AsciiDoc, or override default attributes provided by the plugin, by using the `attributes` option of the `asciidoctor` block in your {path-config}.
|
317
|
+
The value of this option can either be an Array containing key-value pairs:
|
318
|
+
|
319
|
+
[source,yaml]
|
320
|
+
----
|
174
321
|
asciidoctor:
|
175
322
|
attributes:
|
176
|
-
-
|
323
|
+
- idprefix=_
|
177
324
|
- source-highlighter=pygments
|
178
325
|
- pygments-css=style
|
326
|
+
----
|
327
|
+
|
328
|
+
or key-value pairs defined as a Hash:
|
329
|
+
|
330
|
+
[source,yaml]
|
331
|
+
----
|
332
|
+
asciidoctor:
|
333
|
+
attributes:
|
334
|
+
idprefix: _
|
335
|
+
source-highlighter: pygments
|
336
|
+
pygments-css: style
|
337
|
+
----
|
338
|
+
|
339
|
+
You may use attribute references in the attribute value to reference any implicit or already defined attribute.
|
340
|
+
For example, to set the `iconsdir` attribute based on the `imagesdir` attribute, use the following:
|
341
|
+
|
342
|
+
[source,yaml]
|
343
|
+
----
|
344
|
+
asciidoctor:
|
345
|
+
attributes:
|
346
|
+
imagesdir: /images
|
347
|
+
iconsdir: '{imagesdir}/icons'
|
348
|
+
----
|
349
|
+
|
350
|
+
CAUTION: If the value begins with an attribute reference, and you are defining the attributes using the Hash structure, you must enclose the value in quotes.
|
351
|
+
|
352
|
+
In addition to `attributes`, you can define any another option key (e.g., `safe`) that is recognized by the {uri-asciidoctor-manual}#ruby-api-options[Asciidoctor API].
|
353
|
+
|
354
|
+
==== Specifying the Base Directory
|
355
|
+
|
356
|
+
In Asciidoctor, the base directory (i.e., `base_dir` option) is used as the root when resolving non-nested, relative includes, among other paths.
|
357
|
+
|
358
|
+
By default, this plugin does not specify a base directory when invoking the Asciidoctor API.
|
359
|
+
Asciidoctor will therefore use the current working directory (i.e., the project root) as the base directory.
|
360
|
+
|
361
|
+
If your source directory is not the project root, and you want Asciidoctor to use the source directory as the base directory, set the value of the `base_dir` option to `:source`.
|
362
|
+
|
363
|
+
[source,yaml]
|
364
|
+
----
|
365
|
+
asciidoctor:
|
366
|
+
base_dir: :source
|
367
|
+
...
|
368
|
+
----
|
369
|
+
|
370
|
+
If, instead, you want the base directory to track the directory of the document being processed, and you're using Jekyll 3 or better, you can set the value of the `base_dir` option to `:docdir`.
|
371
|
+
Since the base directory is also the jail, we also recommend setting the `safe` option to `unsafe` so that you can still resolve paths outside of this directory.
|
372
|
+
|
373
|
+
[source,yaml]
|
374
|
+
----
|
375
|
+
asciidoctor:
|
376
|
+
base_dir: :docdir
|
377
|
+
safe: unsafe
|
378
|
+
...
|
379
|
+
----
|
380
|
+
|
381
|
+
IMPORTANT: The `:docdir` setting is not available when using Jekyll 2.
|
179
382
|
|
180
|
-
|
383
|
+
You can also set the `base_dir` option to any relative or absolute path.
|
384
|
+
In that case, the same value will be used for all documents.
|
181
385
|
|
182
|
-
|
183
|
-
|
184
|
-
|
386
|
+
==== Enabling Hard Line Breaks
|
387
|
+
|
388
|
+
Many Jekyll users are used to writing in GitHub-flavored Markdown (GFM), which preserves hard line breaks in paragraph content.
|
389
|
+
Asciidoctor supports this feature for AsciiDoc files.
|
390
|
+
(In fact, previous versions of this plugin enabled this behavior by default).
|
391
|
+
If you want to enable this behavior for AsciiDoc files, add the `hardbreaks-option` attribute to the Asciidoctor attributes configuration in your site's {path-config} file:
|
185
392
|
|
186
393
|
[source,yaml]
|
394
|
+
----
|
187
395
|
asciidoctor:
|
188
396
|
attributes:
|
189
|
-
- hardbreaks
|
397
|
+
- hardbreaks-option
|
398
|
+
----
|
399
|
+
|
400
|
+
If you want to allow individual files to override this setting, then assign the value `@` to the attribute:
|
401
|
+
|
402
|
+
[source,yaml]
|
403
|
+
----
|
404
|
+
asciidoctor:
|
405
|
+
attributes:
|
406
|
+
- hardbreaks-option=@
|
407
|
+
----
|
408
|
+
|
409
|
+
If you already have AsciiDoc attributes defined in the {path-config}, the new attribute should be added as a sibling entry in the YAML collection.
|
410
|
+
|
411
|
+
WARNING: Keep in mind, if you enable hard line breaks, you won't be able to use the {uri-asciidoc-practices}#one-sentence-per-line[one sentence-per-line writing technique].
|
412
|
+
|
413
|
+
== Running in Safe Mode
|
414
|
+
|
415
|
+
If you want to use this plugin when running Jekyll in safe mode, you must add the [app]*jekyll-asciidoc* gem to the whitelist in your site's {path-config} file:
|
190
416
|
|
191
|
-
|
417
|
+
[source,yaml]
|
418
|
+
----
|
419
|
+
whitelist:
|
420
|
+
- jekyll-asciidoc
|
421
|
+
----
|
422
|
+
|
423
|
+
Safe mode is enabled either through the `--safe` flag:
|
424
|
+
|
425
|
+
$ jekyll build --safe
|
426
|
+
|
427
|
+
or the `safe` configuration option in your site's {path-config} file:
|
428
|
+
|
429
|
+
[source,yaml]
|
430
|
+
----
|
431
|
+
safe: true
|
432
|
+
----
|
433
|
+
|
434
|
+
== Customizing the Generated HTML
|
435
|
+
|
436
|
+
You can use templates to customize the HTML output that Asciidoctor generates for your site.
|
437
|
+
Template files can be composed in any templating language that is supported by {uri-tilt}[Tilt].
|
438
|
+
Each template file corresponds to a node in the AsciiDoc document tree (aka AST).
|
439
|
+
|
440
|
+
Below are the steps you need to take to configure Asciidoctor to use custom templates with your site.
|
441
|
+
|
442
|
+
=== Step 1: Add Required Gems
|
443
|
+
|
444
|
+
You'll first need to add the thread_safe gem as well as the gem for the templating language you plan to use.
|
445
|
+
We'll assume that you are using Slim.
|
446
|
+
|
447
|
+
[source,ruby]
|
448
|
+
----
|
449
|
+
gem 'slim', '~> 3.0.7'
|
450
|
+
gem 'thread_safe', '~> 0.3.5'
|
451
|
+
----
|
452
|
+
|
453
|
+
=== Step 2: Install New Gems
|
454
|
+
|
455
|
+
Now run the `bundle` command to install the new gems.
|
456
|
+
|
457
|
+
$ bundle
|
192
458
|
|
193
|
-
|
459
|
+
=== Step 3: Create a Templates Folder
|
194
460
|
|
195
|
-
|
461
|
+
Next, create a new folder in your site named [path]__templates_ to store your templates.
|
462
|
+
|
463
|
+
$ mkdir _templates
|
464
|
+
|
465
|
+
=== Step 4: Configure Asciidoctor to Load Templates
|
466
|
+
|
467
|
+
In your site's {path-config} file, configure Asciidoctor to load the templates by telling it the location where the templates are stored.
|
468
|
+
|
469
|
+
[source,yaml]
|
470
|
+
----
|
471
|
+
asciidoctor:
|
472
|
+
template_dir: _templates
|
473
|
+
attributes: ...
|
474
|
+
----
|
475
|
+
|
476
|
+
=== Step 5: Compose a Template
|
477
|
+
|
478
|
+
The final step is to compose a template.
|
479
|
+
We'll be customizing the unordered list node.
|
480
|
+
Name the file [path]_ulist.html.slim_.
|
481
|
+
|
482
|
+
.ulist.html.slim
|
483
|
+
[source,slim]
|
484
|
+
----
|
485
|
+
- if title?
|
486
|
+
figure.list.unordered id=id
|
487
|
+
figcaption=title
|
488
|
+
ul class=[style, role]
|
489
|
+
- items.each do |_item|
|
490
|
+
li
|
491
|
+
span.primary=_item.text
|
492
|
+
- if _item.blocks?
|
493
|
+
=_item.content
|
494
|
+
- else
|
495
|
+
ul id=id class=[style, role]
|
496
|
+
- items.each do |_item|
|
497
|
+
li
|
498
|
+
span.primary=_item.text
|
499
|
+
- if _item.blocks?
|
500
|
+
=_item.content
|
501
|
+
----
|
502
|
+
|
503
|
+
The next time you build your site, Asciidoctor will use your custom template to generate the HTML for unordered lists.
|
504
|
+
|
505
|
+
TIP: You can find additional examples of custom templates in the {uri-asciidoctor-backends}[asciidoctor-backends] repository.
|
506
|
+
|
507
|
+
== Enabling Asciidoctor Diagram
|
508
|
+
|
509
|
+
{uri-asciidoctor-diagram}[Asciidoctor Diagram] is a set of extensions for Asciidoctor that allow you to embed diagrams generated by PlantUML, Graphviz, ditaa, Shaape, and other plain-text diagram tools inside your AsciiDoc documents.
|
510
|
+
In order to use Asciidoctor Diagram in a Jekyll project successfully, *you must use Jekyll >= 3.0.0 and a version of this plugin >= 2.0.0*.
|
511
|
+
Other combinations are known to have issues.
|
196
512
|
|
197
513
|
[IMPORTANT]
|
198
|
-
For Graphviz and PlantUML diagram generation,
|
514
|
+
For Graphviz and PlantUML diagram generation, {uri-graphviz}[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`.
|
199
515
|
|
200
516
|
=== Installation
|
201
517
|
|
202
518
|
Using Bundler::
|
203
519
|
+
|
204
520
|
--
|
205
|
-
Add `asciidoctor-diagram` gem to your [path]_Gemfile_
|
521
|
+
Add `asciidoctor-diagram` gem to your [path]_Gemfile_:
|
206
522
|
|
207
|
-
[source,ruby]
|
523
|
+
[source,ruby,subs=attributes+]
|
208
524
|
----
|
209
525
|
group :jekyll_plugins do
|
210
|
-
|
211
|
-
gem '
|
526
|
+
gem 'asciidoctor-diagram', '~> 1.4.0' #{conum-guard}<1>
|
527
|
+
gem 'jekyll-asciidoc'
|
212
528
|
...
|
213
529
|
end
|
214
530
|
----
|
215
|
-
<1> version
|
531
|
+
<1> Customize the version of Asciidoctor Diagram as needed.
|
216
532
|
|
217
533
|
Then, run the Bundler command to install it:
|
218
534
|
|
@@ -224,74 +540,156 @@ Without Bundler::
|
|
224
540
|
--
|
225
541
|
Install gems manually
|
226
542
|
|
227
|
-
$ gem install asciidoctor-diagram
|
543
|
+
$ [sudo] gem install asciidoctor-diagram
|
228
544
|
|
229
|
-
Then, add the `asciidoctor-diagram` gem to the list of gems for Jekyll to load in your site's
|
545
|
+
Then, add the `asciidoctor-diagram` gem to the list of gems for Jekyll to load in your site's {path-config} file:
|
230
546
|
|
231
547
|
[source,yaml]
|
548
|
+
----
|
232
549
|
gems:
|
233
550
|
- asciidoctor-diagram
|
551
|
+
- jekyll-asciidoc
|
552
|
+
----
|
234
553
|
--
|
235
554
|
|
236
|
-
|
555
|
+
The preceding configurations are equivalent to passing `-r asciidoctor-diagram` to the `asciidoctor` command.
|
556
|
+
|
557
|
+
=== Generated Image Location
|
237
558
|
|
238
|
-
|
559
|
+
Asciidoctor Diagram needs some context in order to write the images to the proper location.
|
560
|
+
At a minimum, you must set the following configuration in {path-config}:
|
239
561
|
|
240
|
-
|
241
|
-
|
562
|
+
[source,yaml]
|
563
|
+
----
|
564
|
+
asciidoctor:
|
565
|
+
base_dir: :docdir
|
566
|
+
safe: unsafe
|
567
|
+
----
|
242
568
|
|
243
|
-
|
569
|
+
With this configuration, Asciidoctor Diagram will generate images relative to the generated HTML page (i.e., into the same directory).
|
244
570
|
|
245
|
-
|
246
|
-
[listing]
|
247
|
-
....
|
248
|
-
---
|
249
|
-
---
|
250
|
-
= Diagrams
|
251
|
-
:imagesdir: /images/2015-12-24 <1>
|
571
|
+
You can use the following example to test your setup:
|
252
572
|
|
253
|
-
|
573
|
+
._posts/2016-01-01-diagram-sample.adoc
|
574
|
+
[source,asciidoc]
|
254
575
|
----
|
576
|
+
= Diagram Sample
|
577
|
+
|
578
|
+
[graphviz,dot-example,svg]
|
579
|
+
....
|
255
580
|
digraph g {
|
256
581
|
a -> b
|
257
582
|
b -> c
|
258
583
|
c -> d
|
259
584
|
d -> a
|
260
585
|
}
|
261
|
-
----
|
262
586
|
....
|
263
|
-
|
587
|
+
----
|
588
|
+
|
589
|
+
If you prefer to serve all images from the same folder, assign a value to the `imagesdir` attribute that is relative to the site root:
|
590
|
+
|
591
|
+
[source,yaml]
|
592
|
+
----
|
593
|
+
asciidoctor:
|
594
|
+
base_dir: :docdir
|
595
|
+
safe: unsafe
|
596
|
+
attributes:
|
597
|
+
imagesdir: /images
|
598
|
+
----
|
599
|
+
|
600
|
+
With this configuration, all images will be generated into the [path]_images_ directory inside the destination folder.
|
601
|
+
|
602
|
+
==== Preserving Generated Images
|
603
|
+
|
604
|
+
Since Asciidoctor Diagram writes to the output folder, you have instruct Jekyll not to remove these generated files.
|
605
|
+
One way to do this is to apply a "`monkeypatch`" to Jekyll.
|
606
|
+
Add the file [path]_jekyll-ext.rb_ to the [path]__plugins_ folder of your project root (creating the folder if it does not already exist) and populate the file with the following content:
|
607
|
+
|
608
|
+
._plugins/jekyll-ext.rb
|
609
|
+
[source,ruby]
|
610
|
+
----
|
611
|
+
class Jekyll::Cleaner
|
612
|
+
def cleanup!; end
|
613
|
+
end
|
614
|
+
----
|
264
615
|
|
265
|
-
|
266
|
-
|
616
|
+
An alternative to the monkeypath approach is to identify folders that contain generated images in the `keep_files` option in {path-config}:
|
617
|
+
|
618
|
+
[source,yaml]
|
619
|
+
----
|
620
|
+
keep_files: [images]
|
621
|
+
asciidoctor:
|
622
|
+
base_dir: :docdir
|
623
|
+
safe: unsafe
|
624
|
+
attributes:
|
625
|
+
imagesdir: /images
|
626
|
+
----
|
267
627
|
|
268
|
-
== Supplemental
|
628
|
+
== Adding Supplemental Assets
|
269
629
|
|
270
630
|
Certain Asciidoctor features, such as icons, require additional CSS rules and other assets to work.
|
271
631
|
These CSS rules and other assets do not get automatically included in the pages generated by Jekyll.
|
272
632
|
This section documents how to configure these additional resources.
|
273
633
|
|
274
|
-
TIP: If you want to take a shortcut that skips all this configuration, clone the
|
634
|
+
TIP: If you want to take a shortcut that skips all this configuration, clone the {uri-jaq}[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site.
|
275
635
|
JAQ provides a page layout out of the box configured to fully style body content generated from AsciiDoc.
|
276
636
|
|
277
637
|
=== Setup
|
278
638
|
|
279
639
|
The Jekyll AsciiDoc plugin converts AsciiDoc to embeddable HTML.
|
280
640
|
This HTML is then inserted into the page layout.
|
281
|
-
You need to augment the
|
641
|
+
You need to augment the layout to include resources typically present in a standalone HTML document that Asciidoctor produces.
|
282
642
|
|
283
643
|
. Create a stylesheet in the [path]_css_ directory named [path]_asciidoc.css_ to hold additional CSS for body content generated from AsciiDoc.
|
284
644
|
. Add this stylesheet to the HTML `<head>` in [path]_{empty}_includes/head.html_ under the main.css declaration:
|
285
645
|
+
|
286
646
|
[source,html]
|
647
|
+
----
|
287
648
|
<link rel="stylesheet" href="{{ "/css/asciidoc.css" | prepend: site.baseurl }}">
|
649
|
+
----
|
650
|
+
|
651
|
+
=== Stylesheet for Code Highlighting
|
652
|
+
|
653
|
+
Asciidoctor integrates with Pygments to provide code highlighting of source blocks in AsciiDoc content.
|
654
|
+
This integration is separate from the Pygments integration in Jekyll.
|
655
|
+
As part of this integration, Asciidoctor generates a custom stylesheet tailored specially to work with the HTML that Asciidocotor produces.
|
656
|
+
Since this stylesheet is backed by the Pygments API, it provides access to all the themes in Pygments
|
657
|
+
|
658
|
+
This plugin will automatically generate a stylesheet for Pygments into the source directory if the AsciiDoc attributes in your site's {path-config} are configured as follows:
|
659
|
+
|
660
|
+
* `source-highlighter` has the value `pygments`
|
661
|
+
* `pygments-css` has the value `class` or is not set
|
662
|
+
* `pygments-stylesheet` is not unset (if set, it can have any value)
|
663
|
+
|
664
|
+
By default, the stylesheet is written to `stylesdir` + `pygments-stylesheet`.
|
665
|
+
If the `pygments-stylesheet` attribute is not specified, the value defaults to `asciidoc-pygments.css`.
|
666
|
+
You can customize this value to your liking.
|
667
|
+
|
668
|
+
The Pygments theme is selected by the value of the `pygments-style` attribute.
|
669
|
+
If this attribute is not set, it defaults to `vs`.
|
670
|
+
|
671
|
+
The stylesheet file will be created if it does not yet exist or the theme has been changed.
|
672
|
+
Jekyll will handle copying the file to the output directory.
|
673
|
+
|
674
|
+
You'll need to add a line to your template to link to this stylesheet, such as:
|
675
|
+
|
676
|
+
[source,html]
|
677
|
+
----
|
678
|
+
<link rel="stylesheet" href="{{ "/css/asciidoc-pygments.css" | prepend: site.baseurl }}">
|
679
|
+
----
|
680
|
+
|
681
|
+
To disable this feature, either set the `pygments-css` to `style` (to enable inline styles) or unset the `pygments-stylesheet` attribute in your site's {path-config}.
|
682
|
+
|
683
|
+
NOTE: It may still be necessary to make some tweaks to your site's stylesheet to accomodate this integration.
|
288
684
|
|
289
685
|
=== Font-based Admonition and Inline Icons
|
290
686
|
|
291
687
|
To enable font-based admonition and inline icons, you first need to add Font Awesome to [path]_{empty}_includes/head.html_ file under the asciidoc.css declaration:
|
292
688
|
|
293
689
|
[source,html]
|
690
|
+
----
|
294
691
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
|
692
|
+
----
|
295
693
|
|
296
694
|
NOTE: You can also link to local copy of Font Awesome.
|
297
695
|
|
@@ -338,15 +736,20 @@ Feel free to modify the CSS to your liking.
|
|
338
736
|
|
339
737
|
Finally, you need to enable the font-based icons in the header of the document:
|
340
738
|
|
341
|
-
|
739
|
+
[source,asciidoc]
|
740
|
+
----
|
741
|
+
:icons: font
|
742
|
+
----
|
342
743
|
|
343
744
|
or in the site configuration:
|
344
745
|
|
345
746
|
[source,yaml]
|
747
|
+
----
|
346
748
|
asciidoctor:
|
347
749
|
attributes:
|
348
750
|
- icons=font
|
349
751
|
...
|
752
|
+
----
|
350
753
|
|
351
754
|
=== Image-based Admonition and Inline Icons
|
352
755
|
|
@@ -355,33 +758,310 @@ In this case, all you need to do is provide the icons at the proper location.
|
|
355
758
|
|
356
759
|
First, enable image-based icons and configure the path to the icons in the header of the document:
|
357
760
|
|
358
|
-
|
359
|
-
|
761
|
+
[source,asciidoc]
|
762
|
+
----
|
763
|
+
:icons:
|
764
|
+
:iconsdir: /images/icons
|
765
|
+
----
|
360
766
|
|
361
767
|
or your site configuration:
|
362
768
|
|
363
769
|
[source,yaml]
|
770
|
+
----
|
364
771
|
asciidoctor:
|
365
772
|
attributes:
|
366
773
|
- icons
|
367
774
|
- iconsdir=/images/icons
|
775
|
+
----
|
368
776
|
|
369
777
|
Then, simply put the icon images that the page needs in the [path]_images/icons_ directory.
|
370
778
|
|
371
|
-
==
|
779
|
+
== Converting AsciiDoc in Templates
|
780
|
+
|
781
|
+
Jekyll uses the Liquid templating language to process templates.
|
782
|
+
This plugin defines an additional filter named `asciidocify` for converting a string of AsciiDoc.
|
783
|
+
|
784
|
+
Let's assume the excerpt of the post is written in AsciiDoc.
|
785
|
+
You can convert it in your template as follows:
|
786
|
+
|
787
|
+
----
|
788
|
+
{{ post.excerpt | asciidocify }}
|
789
|
+
----
|
790
|
+
|
791
|
+
If you only want to perform inline substitutions on the content, add the `inline` doctype as the first argument:
|
792
|
+
|
793
|
+
----
|
794
|
+
{{ post.excerpt | asciidocify: 'inline' }}
|
795
|
+
----
|
796
|
+
|
797
|
+
This filter allows you to compose site-wide data in AsciiDoc, such your site's description or synopsis, then convert it to HTML for use in the page template(s).
|
798
|
+
|
799
|
+
== Using this Plugin on GitHub Pages
|
372
800
|
|
373
|
-
GitHub doesn't (yet) whitelist the AsciiDoc plugin, so you
|
801
|
+
GitHub doesn't (yet) whitelist the AsciiDoc plugin, so you must run Jekyll either on your own computer or on a continuous integration (CI) server.
|
374
802
|
|
375
|
-
|
376
|
-
|
803
|
+
[IMPORTANT]
|
804
|
+
====
|
805
|
+
GitHub needs to hear from enough users that need this plugin to persuade them to enable it.
|
806
|
+
Our recommendation is to https://github.com/contact[contact support] and keep asking for it.
|
807
|
+
|
808
|
+
Refer to the help page https://help.github.com/articles/adding-jekyll-plugins-to-a-github-pages-site/[Adding Jekyll Plugins to a GitHub Pages site] for a list of plugins currently supported on GitHub Pages.
|
809
|
+
====
|
377
810
|
|
378
811
|
You can automate publishing of the generated site to GitHub Pages using a continuous integration job.
|
379
812
|
Refer to the tutorial http://eshepelyuk.github.io/2014/10/28/automate-github-pages-travisci.html[Automate GitHub Pages publishing with Jekyll and Travis CI^] to find step-by-step instructions to setup this job.
|
380
813
|
You can also refer to the https://github.com/johncarl81/transfuse-site[Tranfuse website build^] for an example in practice.
|
381
814
|
|
382
|
-
|
815
|
+
TIP: If you want to take a shortcut that skips all the steps in the tutorial, clone the {uri-jaq}[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site.
|
816
|
+
JAQ provides a page layout out of the box configured to fully style body content generated from AsciiDoc.
|
817
|
+
|
818
|
+
== Using this Plugin on GitLab Pages
|
819
|
+
|
820
|
+
Deployment to GitLab Pages is much simpler.
|
821
|
+
That's because GitLab allows you to control the execution of Jekyll yourself.
|
822
|
+
There's no need to mess around with CI jobs and authentication tokens.
|
823
|
+
You can find all about how to use Jekyll with GitLab Pages in the tutorial https://about.gitlab.com/2016/04/07/gitlab-pages-setup/#option-b-gitlab-ci-for-jekyll-websites[Hosting on GitLab.com with GitLab Pages].
|
824
|
+
|
825
|
+
Assuming the following are true:
|
826
|
+
|
827
|
+
. The source of your site resides on the master branch.
|
828
|
+
. You're using Bundler to manage the dependencies for your project.
|
829
|
+
|
830
|
+
then you can use the following [path]_.gitlab-ci.yml_ file to get starting hosting your Jekyll site on GitLab Pages.
|
831
|
+
|
832
|
+
.gitlab-ci.yml
|
833
|
+
[source,yaml]
|
834
|
+
----
|
835
|
+
image: ruby:2.3
|
836
|
+
cache:
|
837
|
+
paths:
|
838
|
+
- .bundle
|
839
|
+
before_script:
|
840
|
+
- bundle --path .bundle/gems
|
841
|
+
pages:
|
842
|
+
script:
|
843
|
+
- bundle exec jekyll build -d public --config _config.yml,_config-gitlab.yml -q
|
844
|
+
artifacts:
|
845
|
+
paths:
|
846
|
+
- public
|
847
|
+
only:
|
848
|
+
- master
|
849
|
+
----
|
850
|
+
|
851
|
+
This script runs Jekyll on the official Ruby Docker container.
|
852
|
+
|
853
|
+
You also need to add and additional configuration file, [path]__config-gitlab.yml_, to set the `url` and `baseurl` options when deploying your site to GitLab Pages.
|
854
|
+
|
855
|
+
._config-gitlab.yml
|
856
|
+
[source,yaml,subs=attributes+]
|
857
|
+
----
|
858
|
+
url: https://<username>.gitlab.io #{conum-guard}<1>
|
859
|
+
baseurl: /<projectname> #{conum-guard}<2>
|
860
|
+
----
|
861
|
+
<1> Replace `<username>` with your GitLab username or group.
|
862
|
+
<2> Replace `<projectname>` with the basename of your project repository.
|
863
|
+
|
864
|
+
The next time you push to the master branch, the GitLab Pages runner will execute Jekyll and deploy your site to [uri]_\https://<username>.gitlab.io/<projectname>_, where `<username>` is your GitLab username or group and `<projectname>` is the basename of your project repository.
|
865
|
+
|
866
|
+
Like GitHub Pages, you can also have your site respond to a custom domain name, which is explained in the referenced tutorial.
|
867
|
+
In this case, update the [path]__config-gitlab.yml_ file with the appropriate values.
|
868
|
+
|
869
|
+
== Getting Help
|
870
|
+
|
871
|
+
The Jekyll AsciiDoc plugin is developed to help you publish your content quickly and easily.
|
872
|
+
But we can't achieve that goal without your input.
|
873
|
+
Your questions and feedback help steer the project, so speak up!
|
874
|
+
Activity drives progress.
|
875
|
+
|
876
|
+
When seeking answers, always start with the official documentation for Jekyll, which can be found on the {uri-jekyll}[Jekyll website].
|
877
|
+
If you have general questions about Jekyll, we recommend you visit the {uri-jekyll-discuss}[Jekyll Talk] forum to get assistance.
|
878
|
+
For questions related to this extension specifically, or general questions about AsciiDoc, please post to the {uri-asciidoctor-discuss}[Asciidoctor discussion list].
|
879
|
+
You can also join us in the {uri-chat}[asciidoctor/asciidoctor channel] on Gitter.
|
880
|
+
For general information about AsciiDoc, look no further than the {uri-asciidoctor-manual}[Asciidoctor User Manual].
|
881
|
+
|
882
|
+
=== Filing Bug Reports and Feature Requests
|
383
883
|
|
384
|
-
|
884
|
+
This project uses the {uri-issues}[GitHub issue tracker] to manage bug reports and feature requests.
|
885
|
+
If you encounter a problem, please {uri-search-issues}[browse or search] the issues to find out if your problem has already been reported.
|
886
|
+
If it has not, you may {uri-issues}/new[submit a new issue].
|
887
|
+
|
888
|
+
The best way to get a timely response and quick fix for your issue is to write a detailed report and respond to replies in a timely manner.
|
889
|
+
|
890
|
+
If you know Ruby (or you're willing to learn), we encourage you to submit a pull request.
|
891
|
+
Please include an RSpec behavior that describes how your feature should work or demonstrates the problem you're encountering.
|
892
|
+
Make sure to send your pull request from a branch in your fork.
|
893
|
+
If the pull request resolves an issue, please name the branch using the issue number (e.g., issue-N, where N is the issue number).
|
894
|
+
|
895
|
+
If you aren't able to submit a pull request, please provide a sample so that the developers can reproduce your scenario.
|
896
|
+
|
897
|
+
== Development
|
898
|
+
|
899
|
+
To help develop the Jekyll AsciiDoc plugin, or to simply use the development version, you need to retrieve the source from GitHub.
|
900
|
+
Follow the instructions below to learn how to clone the source, run the tests and install the development version.
|
901
|
+
|
902
|
+
=== Retrieve the Source Code
|
903
|
+
|
904
|
+
You can retrieve the source code from GitHub using git.
|
905
|
+
Simply copy the URL of the {uri-repo}[GitHub repository] and pass it to the `git clone` command:
|
906
|
+
|
907
|
+
[subs=attributes+]
|
908
|
+
....
|
909
|
+
git clone {uri-repo}
|
910
|
+
....
|
911
|
+
|
912
|
+
Next, switch to the project directory.
|
913
|
+
|
914
|
+
$ cd jekyll-asciidoc
|
915
|
+
|
916
|
+
=== Install the Dependencies
|
917
|
+
|
918
|
+
The dependencies needed to develop the Jekyll AsciiDoc plugin are defined in the [path]_Gemfile_ at the root of the project.
|
919
|
+
You'll use Bundler to install these dependencies.
|
920
|
+
|
921
|
+
To check if you have Bundler installed, use the `bundle` command to query for the version:
|
922
|
+
|
923
|
+
$ bundle --version
|
924
|
+
|
925
|
+
If Bundler is not installed, use the `gem` command to install it.
|
926
|
+
|
927
|
+
$ [sudo] gem install bundler
|
928
|
+
|
929
|
+
Finally, invoke the `bundle` command (which is provided by the bundler gem) from the root of the project to install the dependencies into the project:
|
930
|
+
|
931
|
+
$ bundle --path=.bundle/gems
|
932
|
+
|
933
|
+
IMPORTANT: Since we've installed dependencies inside the project, it's necessary to prefix all commands (e.g., rake) with `bundle exec`.
|
934
|
+
|
935
|
+
=== Running the Tests
|
936
|
+
|
937
|
+
The tests are based on RSpec.
|
938
|
+
The test suite is located in the [path]_spec_ directory.
|
939
|
+
|
940
|
+
You can run the tests using Rake.
|
941
|
+
|
942
|
+
$ bundle exec rake spec
|
943
|
+
|
944
|
+
For more fine-grained control, you can also run the tests using RSpec directly.
|
945
|
+
|
946
|
+
$ bundle exec rspec
|
947
|
+
|
948
|
+
If you only want to run a selection of tests, you can do so by assigning those specifications a tag and filtering the test run accordingly.
|
949
|
+
|
950
|
+
Start by adding the `focus` tag to one or more specifications:
|
951
|
+
|
952
|
+
[source,ruby]
|
953
|
+
----
|
954
|
+
it 'should register AsciiDoc converter', focus: true do
|
955
|
+
expect(site.converters.any? {|c| ::Jekyll::AsciiDoc::Converter === c }).to be true
|
956
|
+
end
|
957
|
+
----
|
958
|
+
|
959
|
+
Then, run RSpec with the `focus` flag enabled:
|
960
|
+
|
961
|
+
$ bundle exec rspec -t focus
|
962
|
+
|
963
|
+
You should see that RSpec only runs the specifications that have this flag.
|
964
|
+
|
965
|
+
=== Installing the Gem Locally
|
966
|
+
|
967
|
+
You can install the development version of the gem as follows:
|
968
|
+
|
969
|
+
$ bundle exec rake install
|
970
|
+
|
971
|
+
This allows you to use an unreleased version of the gem in your site.
|
972
|
+
If you want to build the gem and install it manually, use these commands instead:
|
973
|
+
|
974
|
+
$ bundle exec rake build
|
975
|
+
$ [sudo] gem install pkg/jekyll-asciidoc-*.dev.gem
|
976
|
+
|
977
|
+
=== Coding Style
|
978
|
+
|
979
|
+
This project adheres to the coding style used throughout the Asciidoctor project.
|
980
|
+
The coding style is as follows:
|
981
|
+
|
982
|
+
* Indent using 2 spaces, generally.
|
983
|
+
|
984
|
+
* Indent successive lines of conditions, method arguments or ternary expressions using 4 spaces (but not data structures or chained method calls).
|
985
|
+
|
986
|
+
* Don't indent `when` lines in a case block.
|
987
|
+
|
988
|
+
* Fully qualify the class name (beginning with `::`) of any type not in the current namespace.
|
989
|
+
|
990
|
+
::File.extname path
|
991
|
+
|
992
|
+
* Use triple equals to check for type, placing the type on the left hand side.
|
993
|
+
|
994
|
+
::Hash === attrs
|
995
|
+
|
996
|
+
* Drop parentheses around method arguments of a method definition.
|
997
|
+
|
998
|
+
def integrate document, collection_name = nil
|
999
|
+
...
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
* Drop parentheses around method arguments of an isolated method call.
|
1003
|
+
|
1004
|
+
source = ::File.expand_path config['source']
|
1005
|
+
+
|
1006
|
+
if key.start_with? '!'
|
1007
|
+
...
|
1008
|
+
end
|
1009
|
+
+
|
1010
|
+
asciidoctor_config.replace Utils.symbolize_keys asciidoctor_config
|
1011
|
+
|
1012
|
+
* Use parentheses outside of a method call when parentheses are required.
|
1013
|
+
|
1014
|
+
layout = collection_name ? (collection_name.chomp 's') : 'page'
|
1015
|
+
+
|
1016
|
+
if (::Jekyll::Utils.method dlg_method.name).arity == -1
|
1017
|
+
...
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
* Use parentheses where required, such as around the accumulator seed value for a collection predicate.
|
1021
|
+
|
1022
|
+
hash.each_with_object({}) {|(key, val), accum| accum[key.to_sym] = val }
|
1023
|
+
|
1024
|
+
* Don't put curly braces around entries in an options Hash (i.e., symbol keys).
|
1025
|
+
|
1026
|
+
record_path_info document, source_only: true
|
1027
|
+
|
1028
|
+
* Use a trailing condition for single-line statements.
|
1029
|
+
|
1030
|
+
clear_path_info if Document === document
|
1031
|
+
|
1032
|
+
* Put parantheses around a variable assignment inside a condition.
|
1033
|
+
|
1034
|
+
if (imagesdir = attrs['imagesdir'])
|
1035
|
+
|
1036
|
+
* Use simple check for nil.
|
1037
|
+
|
1038
|
+
if base
|
1039
|
+
|
1040
|
+
* Use `%()` instead of double quotes around interpolated strings.
|
1041
|
+
|
1042
|
+
%(--- #{val})
|
1043
|
+
|
1044
|
+
* Name constants using pascal style.
|
1045
|
+
|
1046
|
+
NewLine = %(\n)
|
1047
|
+
|
1048
|
+
* Store each static regular expression in a constant.
|
1049
|
+
|
1050
|
+
HeaderBoundaryRx = /(?<=\p{Graph})\n\n/
|
1051
|
+
|
1052
|
+
* Use parentheses in traditional style when writing test assertions.
|
1053
|
+
|
1054
|
+
expect(site.config['asciidoc']['processor']).to eql('asciidoctor')
|
1055
|
+
expect(result.key? 'icons').to be true
|
1056
|
+
expect(contents).to match('<div class="page-content">')
|
1057
|
+
|
1058
|
+
////
|
1059
|
+
* use `do; end` for multi-line blocks; use `{}` for single-line blocks
|
1060
|
+
* try to make assignments in condition if scoped to that block
|
1061
|
+
* close empty block on same line if empty - `rescue ::NameError; end`
|
1062
|
+
////
|
1063
|
+
|
1064
|
+
=== Releasing the Gem
|
385
1065
|
|
386
1066
|
When you are ready for a release, first set the version in the file [path]_lib/jekyll-asciidoc/version.rb_.
|
387
1067
|
Then, commit the change using the following commit message template:
|
@@ -392,8 +1072,38 @@ where `X.Y.Z` is the version number of the gem.
|
|
392
1072
|
|
393
1073
|
Next, package, tag and release the gem to RubyGems.org, run the following rake task:
|
394
1074
|
|
395
|
-
$ rake release
|
1075
|
+
$ bundle exec rake release
|
1076
|
+
|
1077
|
+
IMPORTANT: Ensure you have the proper credentials setup as described in the guide {uri-guide-publish-gem}[Publishing to RubyGems.org].
|
1078
|
+
|
1079
|
+
Once you finish the release, you should update the version to the next micro version in the sequence using the `.dev` suffix (e.g., 2.0.1.dev).
|
1080
|
+
|
1081
|
+
== About the Project
|
1082
|
+
|
1083
|
+
The Jekyll AsciiDoc plugin, a plugin for the static site generator {uri-jekyll}[Jekyll], is a member project of the Asciidoctor organization.
|
1084
|
+
This plugin is developed and supported by volunteers in the Asciidoctor community.
|
1085
|
+
|
1086
|
+
=== Authors
|
1087
|
+
|
1088
|
+
This plugin was created by Dan Allen and Paul Rayner and has received contributions from many other individuals in the Asciidoctor community.
|
1089
|
+
|
1090
|
+
=== Copyright and License
|
1091
|
+
|
1092
|
+
Copyright (C) 2013-2016 Dan Allen, Paul Rayner, and the Asciidoctor Project.
|
1093
|
+
Free use of this software is granted under the terms of the MIT License.
|
1094
|
+
See <<LICENSE#,LICENSE>> for details.
|
1095
|
+
|
1096
|
+
////
|
1097
|
+
[glossary]
|
1098
|
+
== Glossary
|
396
1099
|
|
397
|
-
|
1100
|
+
[glossary]
|
1101
|
+
page variable::
|
1102
|
+
Data associated with a page, post or document.
|
1103
|
+
Page variables are defined in the front matter header or as page attributes in the AsciiDoc header.
|
398
1104
|
|
399
|
-
|
1105
|
+
page attribute::
|
1106
|
+
Any AsciiDoc attribute that gets promoted to a page variable by this plugin.
|
1107
|
+
Before being promoted, the designated prefix is removed from the name.
|
1108
|
+
The value of a page attribute is parse as YAML data.
|
1109
|
+
////
|