jekyll-asciidoc 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +27 -8
  3. data/Gemfile +13 -3
  4. data/LICENSE.adoc +1 -1
  5. data/README.adoc +409 -103
  6. data/jekyll-asciidoc.gemspec +6 -7
  7. data/lib/jekyll-asciidoc/compat.rb +4 -3
  8. data/lib/jekyll-asciidoc/converter.rb +50 -30
  9. data/lib/jekyll-asciidoc/filters.rb +21 -1
  10. data/lib/jekyll-asciidoc/integrator.rb +42 -34
  11. data/lib/jekyll-asciidoc/mixins.rb +6 -0
  12. data/lib/jekyll-asciidoc/version.rb +1 -1
  13. data/spec/fixtures/basic_site/docid.adoc +4 -0
  14. data/spec/fixtures/basic_site/section-with-id-and-role.adoc +6 -0
  15. data/spec/fixtures/imagesdir_relative_to_root/_config.yml +1 -1
  16. data/spec/fixtures/{include_relative_to_doc → include_relative_to_docdir}/_config.yml +0 -0
  17. data/spec/fixtures/{include_relative_to_doc → include_relative_to_docdir}/_layouts/default.html +0 -0
  18. data/spec/fixtures/{include_relative_to_doc → include_relative_to_docdir}/about/_people.adoc +0 -0
  19. data/spec/fixtures/{include_relative_to_doc → include_relative_to_docdir}/about/index.adoc +0 -0
  20. data/spec/fixtures/include_relative_to_root/source/_config.yml +2 -0
  21. data/spec/fixtures/include_relative_to_root/source/_layouts/default.html +11 -0
  22. data/spec/fixtures/include_relative_to_root/source/about/_people.adoc +2 -0
  23. data/spec/fixtures/include_relative_to_root/source/about/index.adoc +13 -0
  24. data/spec/fixtures/tocify_filter/_config.yml +2 -0
  25. data/spec/fixtures/tocify_filter/_layouts/default.html +15 -0
  26. data/spec/fixtures/tocify_filter/index.adoc +25 -0
  27. data/spec/fixtures/with_posts/_config.yml +4 -0
  28. data/spec/fixtures/with_posts/_layouts/post.html +8 -0
  29. data/spec/fixtures/with_posts/_posts/2016-02-02-post-with-singular-vars.adoc +7 -0
  30. data/spec/fixtures/with_posts/_posts/2016-06-15-post-with-date.adoc +4 -0
  31. data/spec/fixtures/with_posts/_posts/2016-07-15-post-with-date-and-tz.adoc +4 -0
  32. data/spec/fixtures/with_posts/_posts/2016-07-20-post-with-date-in-revision-line.adoc +6 -0
  33. data/spec/fixtures/xhtml_syntax/images/sunset.jpg +0 -0
  34. data/spec/jekyll-asciidoc_spec.rb +320 -127
  35. data/spec/spec_helper.rb +4 -0
  36. metadata +41 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f0880454bf13707df6ab46db960a614e543e1d5
4
- data.tar.gz: 91f7795b3722073aca1a3ab2c49a0d04f9883033
3
+ metadata.gz: c4135124b7d7842c3e199e5208d4c267e87a259d
4
+ data.tar.gz: 0d4051c81249eb6259e97bab4a0dc3c91c1e881b
5
5
  SHA512:
6
- metadata.gz: 4e865f7e9ef44ee8b8626b6948fa184d50bfd3bb8d799065e2f89dddbfc3a2a97ab5e54f6b98afe66aee5c3d771fab0a51703cbb92c6f8a10b715ada0c59256e
7
- data.tar.gz: 8e210f65e121dd1d208e9b7492bf3f3f1af6284e0d433ee1e8c3fe844f3de64d7e27df163b899df347189d5fdb87c6d7dc4ac867c8cc11c483e10b212537844f
6
+ metadata.gz: f18fd97d2472bec92a0ddecaaca4fd6d31a10f5620ade52f81e6f20fc00e1adf4c4d4410c06864cbb1bdffab4dcb2a64f6762db4363c0d5b678f8f3c5a7e680c
7
+ data.tar.gz: f377c0cfc83c0ca2edd23009011412aacbd7f302d6d636e064d9699a867ec4681b82eed07fadc1ba6982a6b7608f2a9eb6178153c781063fdf4da19c9a7c722e
@@ -5,29 +5,48 @@
5
5
  This document provides a high-level view of the changes to the {project-name} by release.
6
6
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
7
 
8
+ == 2.1.0 (2017-05-21) - @mojavelinux
9
+
10
+ * Add `tocify_asciidoc` Liquid filter for generating a table of contents from the parsed AsciiDoc document (Jekyll 3+ only) (#37)
11
+ * Remove trailing `@` when resolving attribute reference in value of attribute defined in config
12
+ * Set minimum version of Ruby to 1.9.3 in the gemspec
13
+ * Prefixing attribute defined in config with minus removes previously defined (e.g., built-in) attribute (#123)
14
+ * Convert attribute values in config as follows: true becomes empty string; false becomes nil, number becomes string (#127)
15
+ * Merge category page variable into categories variable and tag page variable into tags variable (#149)
16
+ * Assign document ID to page variable named docid (#146)
17
+ * Enable CI for Windows platform by configuring job on AppVeyor
18
+ * Catch SyntaxError when using Psych YAML parser with Ruby 1.9.3
19
+ * Document that the name of page variable created from a page attribute is automatically lowercased
20
+ * Parse the value of the revdate attribute using `Jekyll::Utils.parse_date`
21
+ * Document how to assign a specific time to a post
22
+ * Document how to make site-wide AsciiDoc attributes accessible to Liquid templates (#137)
23
+ * Fix crash when converting an auto-extracted excerpt when base_dir option is set to :docdir
24
+ * Add additional documentation and make other minor improvements to the README
25
+
8
26
  == 2.0.1 (2016-07-06) - @mojavelinux
9
27
 
10
- * align localtime and localdate attributes with site.time and site.timezone (#117)
11
- * don't register hook callbacks again when regenerating site; use static methods for hook callbacks (#121)
12
- * bundle CHANGELOG.adoc and test suite in gem
13
- * minor improvements to README
28
+ * Align localtime and localdate attributes with site.time and site.timezone (#117)
29
+ * Don't register hook callbacks again when regenerating site; use static methods for hook callbacks (#121)
30
+ * Bundle CHANGELOG.adoc and test suite in gem
31
+ * Minor improvements to README
14
32
 
15
33
  == 2.0.0 (2016-07-02) - @mojavelinux
16
34
 
17
35
  * Split source into multiple files; move all classes under the `Jekyll::AsciiDoc` module
18
36
  * Avoid redundant initialization caused by the jekyll-watch plugin
19
- * Set docdir, docfile, docname, outfile, outdir, and outpath attributes for each file if using Jekyll 3 (#59)
37
+ * Set docdir, docfile, docname, outfile, outdir, and outpath attributes for each file (Jekyll 3+ only) (#59)
20
38
  - docdir is only set if value of `base_dir` option is `:docdir`
21
39
  - setting outdir allows proper integration with Asciidoctor Diagram
22
40
  * Automatically set `imagesoutdir` attribute if `imagesdir` attribute is relative to root
23
41
  * Pass site information (root, source, destination, baseurl and url) through as AsciiDoc attributes
24
42
  * Automatically generate stylesheet for Pygments (#30)
25
43
  * Change default layout to match collection label (#104)
26
- - page for pages, post for posts, collection label for all others; use default layout as fallback
44
+ - page for pages, post for posts, collection label for all others
45
+ - use layout named default as fallback
27
46
  * Resolve attribute references in attribute values defined in config (#103)
28
47
  * Apply AsciiDoc header integration to documents in all collections (#93)
29
48
  * Document how to create and enable templates to customize the HTML that Asciidoctor generates (#73)
30
- * Allow `base_dir` option to track document directory by setting the value to `:docdir` (#80)
49
+ * Allow `base_dir` option to track document directory by setting the value to `:docdir` (Jekyll 3 only) (#80)
31
50
  * Add a comprehensive test suite (#77)
32
51
  * Allow site-wide Asciidoctor attributes to be specified as a Hash; convert to Hash if Array is used (#87)
33
52
  * Interpret page attribute values as YAML data
@@ -45,7 +64,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
45
64
  * Allow plugin to work in safe mode (#112)
46
65
  * Major restructure and rewrite of README
47
66
  * Document how to use plugin with GitLab Pages (#47)
48
- * Document asciidocify filter
67
+ * Document `asciidocify` Liquid filter
49
68
 
50
69
  {uri-repo}/issues?q=milestone%3Av2.0.0[issues resolved] |
51
70
  {uri-repo}/releases/tag/v2.0.0[git tag]
data/Gemfile CHANGED
@@ -2,9 +2,19 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'jekyll', %(~> #{ENV['JEKYLL_VERSION']}) if ENV.key? 'JEKYLL_VERSION'
5
+ # NOTE Windows does not include zoneinfo files, so load tzinfo-data gem
6
+ gem 'tzinfo-data', platform: :mingw
5
7
 
6
- if RUBY_ENGINE == 'jruby'
7
- gem 'pygments.rb', github: 'mojavelinux/pygments.rb', branch: 'support-jruby'
8
- else
8
+ if (ENV.key? 'JEKYLL_VERSION') && (Gem::Version.new ENV['JEKYLL_VERSION']) < (Gem::Version.new '3.0.0')
9
+ if (Gem::Version.new RUBY_VERSION) < (Gem::Version.new '2.0.0')
10
+ # NOTE downgrade ffi to support Ruby 1.9.3
11
+ gem 'ffi', '1.9.14', platform: :mingw
12
+ # NOTE downgrade octokit to support Ruby 1.9.3
13
+ gem 'octokit', '~> 4.2.0'
14
+ end
15
+ # NOTE pygments.rb 0.6.3 is not compatible with Ruby >= 2.4
9
16
  gem 'pygments.rb', '~> 0.6.3'
17
+ else
18
+ # NOTE pygments.rb >= 1.1.0 includes support for JRuby
19
+ gem 'pygments.rb', '~> 1.1.2'
10
20
  end
@@ -1,6 +1,6 @@
1
1
  .The MIT License
2
2
  ....
3
- Copyright (C) 2013-2016 Dan Allen and the Asciidoctor Project
3
+ Copyright (C) 2013-2017 Dan Allen, Paul Rayner, 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
@@ -1,12 +1,12 @@
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.1, 2016-07-06
3
+ v2.1.0, 2017-05-21
4
4
  // Settings:
5
5
  :idprefix:
6
6
  :idseparator: -
7
7
  ifndef::env-github[:icons: font]
8
8
  ifdef::env-github,env-browser[]
9
- :toc: preamble
9
+ :toc: macro
10
10
  :toclevels: 1
11
11
  endif::[]
12
12
  ifdef::env-github[]
@@ -20,7 +20,7 @@ ifdef::env-github[]
20
20
  :warning-caption: :warning:
21
21
  endif::[]
22
22
  // Aliases:
23
- :path-config: pass:q[[path]___config.yml__]
23
+ :path-config: pass:q[[.path]___config.yml__]
24
24
  :conum-guard: {sp}
25
25
  ifndef::icons[:conum-guard: {sp}#{sp}]
26
26
  // URIs:
@@ -28,7 +28,8 @@ ifndef::icons[:conum-guard: {sp}#{sp}]
28
28
  :uri-issues: {uri-repo}/issues
29
29
  :uri-search-issues: {uri-repo}/search?type=Issues
30
30
  :uri-chat: https://gitter.im/asciidoctor/asciidoctor
31
- :uri-ci: https://travis-ci.org/asciidoctor/jekyll-asciidoc
31
+ :uri-ci-travis: https://travis-ci.org/asciidoctor/jekyll-asciidoc
32
+ :uri-ci-appveyor: https://ci.appveyor.com/project/asciidoctor/jekyll-asciidoc
32
33
  :uri-gem: http://rubygems.org/gems/jekyll-asciidoc
33
34
  :uri-gem-asciidoctor: http://rubygems.org/gems/asciidoctor
34
35
  :uri-asciidoc: http://asciidoc.org
@@ -45,17 +46,32 @@ ifndef::icons[:conum-guard: {sp}#{sp}]
45
46
  :uri-jekyll-discuss: https://talk.jekyllrb.com
46
47
  :uri-front-matter: {uri-jekyll-docs}/frontmatter
47
48
  :uri-liquid-templates: {uri-jekyll-docs}/templates
49
+ :uri-variables: {uri-jekyll-docs}/variables
48
50
  :uri-graphviz: http://www.graphviz.org
49
51
  :uri-tilt: https://github.com/rtomayko/tilt
50
52
  :uri-yaml: https://en.wikipedia.org/wiki/YAML
51
53
  :uri-guide-publish-gem: http://guides.rubygems.org/publishing/#publishing-to-rubygemsorg
52
54
 
53
55
  ifdef::status[]
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}]
56
+ image:https://img.shields.io/gem/v/jekyll-asciidoc.svg[Latest Release, link={uri-gem}]
57
+ image:https://img.shields.io/badge/license-MIT-blue.svg[MIT License, link=#copyright-and-license]
58
+ image:https://img.shields.io/travis/asciidoctor/jekyll-asciidoc/master.svg[Build Status (Travis CI), link={uri-ci-travis}]
59
+ image:https://ci.appveyor.com/api/projects/status/3cf1f8p2cyoaoc25/branch/master?svg=true&passingText=green%20bar&failingText=%23fail&pendingText=checking[Build Status (AppVeyor), link={uri-ci-appveyor}]
56
60
  endif::[]
57
61
 
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].
62
+ A plugin for {uri-jekyll}[Jekyll] (>= 2.3.0) that converts the {uri-asciidoc}[AsciiDoc] source files in your site to HTML pages using {uri-asciidoctor}[Asciidoctor].
63
+
64
+ ifeval::['{branch}' == 'master']
65
+ NOTE: You're viewing the documentation for the upcoming release.
66
+ If you're looking for the documentation for an older release, please refer to one of the following branches: +
67
+ {uri-repo}/tree/2.0.x#readme[2.0.x]
68
+ &hybull;
69
+ {uri-repo}/tree/1.1.x#readme[1.1.x]
70
+ &hybull;
71
+ {uri-repo}/tree/1.0.x#readme[1.0.x]
72
+ endif::[]
73
+
74
+ toc::[]
59
75
 
60
76
  == Overview
61
77
 
@@ -66,23 +82,28 @@ Converts AsciiDoc files to HTML pages.
66
82
  This plugin currently uses Asciidoctor to convert AsciiDoc content.
67
83
 
68
84
  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).
85
+ Promotes eligible AsciiDoc attributes (e.g., doctitle, id, author, and attributes that begin with the page attribute prefix) to page variables.
86
+ These attributes are merged with the page variables defined in the front matter header.
70
87
 
71
- Liquid Filter -- `asciidocify`::
72
- A Liquid filter that uses the converter from this plugin to convert AsciiDoc content to HTML.
88
+ Liquid Filters::
89
+ * `asciidocify` -- Uses the converter from this plugin to convert a string of AsciiDoc content to HTML.
90
+ * `tocify_asciidoc` -- Generates a table of contents in HTML from the parsed AsciiDoc document of the current page (since 2.1.0; only for Jekyll 3 or better and Asciidoctor).
73
91
 
74
- These extensions are registered automatically when the [app]*jekyll-asciidoc* gem is required.
92
+ These extensions are registered automatically when the [.app]*jekyll-asciidoc* gem is required.
75
93
 
76
94
  == Installation
77
95
 
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.
96
+ This plugin is packaged as a gem named [.app]*{uri-gem}[jekyll-asciidoc]* and published to RubyGems.org.
97
+ The plugin depends on the [.app]*{uri-gem-asciidoctor}[asciidoctor]* gem, which gets installed automatically.
80
98
 
81
99
  Your method of installation will depend on whether you use Bundler to manage the dependencies for your Jekyll project.
82
100
 
101
+ IMPORTANT: Jekyll relies on several native gems, so it's necessary to have the Ruby development headers (e.g., ruby.h) on your machine in order to install AsciiDoc Jekyll (due to the requirements of Jekyll).
102
+ The instructions for how to install the Ruby development headers are platform-specific and outside of the scope of this document.
103
+
83
104
  === Installation Using Bundler
84
105
 
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_:
106
+ 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_:
86
107
 
87
108
  [source,ruby]
88
109
  ----
@@ -104,7 +125,7 @@ If you're not using Bundler to manage the dependencies for your Jekyll project,
104
125
  NOTE: The `sudo` prefix is only required if you are installing gems into your system.
105
126
  To avoid this bad practice, we recommend using RVM (or another Ruby version manager), which sets up Ruby safely in your home directory.
106
127
 
107
- Then add the [app]*jekyll-asciidoc* gem to the list of gems for Jekyll to load in your site's {path-config} file:
128
+ Then add the [.app]*jekyll-asciidoc* gem to the list of gems for Jekyll to load in your site's {path-config} file:
108
129
 
109
130
  [source,yaml]
110
131
  ----
@@ -120,8 +141,7 @@ There are a few conditions that must be met in order for an AsciiDoc file to be
120
141
  . The file must have an AsciiDoc file extension (see <<configuration>>).
121
142
  . 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
143
  . 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.
144
+ . _(Optional beginning with version 2.0.0 of this plugin)_ Aside from posts, documents must begin with a {uri-front-matter}[front matter header].
125
145
 
126
146
  Here's a sample AsciiDoc file that meets these criteria:
127
147
 
@@ -159,12 +179,22 @@ Jekyll converts it to HTML using {uri-asciidoctor}[Asciidoctor].
159
179
  puts "Hello, World!"
160
180
  ----
161
181
 
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).
182
+ === Page Attributes
183
+
184
+ Any AsciiDoc attribute defined in the AsciiDoc document header whose name begins with ``page-``footnote:[The prefix used to label page attributes can be customized.] gets promoted to a {uri-variables}[page variables].
185
+ The part of the name after the `page-` prefix is _lowercased_ and used as the variable name (e.g., page-layout becomes layout).
186
+ The value is processed as {uri-yaml}[YAML] data (single-line form).
187
+
188
+ IMPORTANT: The AsciiDoc document header stops after the first blank line.
189
+ You may use include directives in the the document header, but make sure the included file does not contain a blank line.
190
+
191
+ TIP: Use either a hyphen or an underscore as a separator for page attributes with multiple words (e.g., page-short-name).
192
+
193
+ === Specifying a Layout
164
194
 
165
195
  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_.
196
+ Jekyll will look for a template file inside the [.path]_{empty}_layouts_ folder whose root name matches the name of the layout.
197
+ For example, if the layout variable has the value `info`, Jekyll looks for a layout template at the path [.path]__layout/info.html_.
168
198
 
169
199
  If the layout is empty, the auto-selected layout layout is used (documented in the list below).
170
200
  If the layout is unset or `false`, the AsciiDoc processor will generate a standalone document.
@@ -173,16 +203,53 @@ If the layout is ~, no layout is applied.
173
203
 
174
204
  To review, here are the different ways to specify a layout using the AsciiDoc attribute page-layout:
175
205
 
176
- * `:page-layout: info` -- use the layout named `info` (e.g., [path]__layout/info.html_)
206
+ * `:page-layout: info` -- use the layout named `info` (e.g., [.path]__layout/info.html_)
177
207
  * _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
208
  * `:!page-layout:` or `:page-layout: false` -- don't use a layout; instead, generate a standalone HTML document
179
209
  * `:page-layout: ~` -- don't use a layout (often results in an incomplete HTML file)
180
210
 
181
- In addition to page attributes defined explicitly, the following implicit AsciiDoc attributes are also promoted to page variables:
211
+ === Implicit Page Variables
212
+
213
+ In addition to page attributes defined explicitly (e.g., layout, permalink, etc), the following implicit AsciiDoc attributes are also promoted to page variables:
182
214
 
183
- * doctitle (i.e., the document title) (becomes title)
215
+ * doctitle (aka the document title) (becomes title)
216
+ * id (becomes docid)
184
217
  * author
185
- * revdate (becomes date; value is converted to a DateTime object; only for posts)
218
+ * revdate (becomes date; value is converted to a DateTime object; posts only)
219
+
220
+ ==== Giving Your Post the Time of Day
221
+
222
+ By default, all posts are assigned a date that is computed from the file name (e.g., the date for 2016-03-20-welcome.adoc is 2016-03-20).
223
+ If you want to give your post a specific time as well, you can set the `revdate` attribute in the AsciiDoc header.
224
+
225
+ We recommend using the format `YYYY-MM-DD HH:MM:SS Z` as shown in this example:
226
+
227
+ [source,asciidoc]
228
+ ----
229
+ = Post Title
230
+ Author Name
231
+ :revdate: 2016-03-20 10:30:00 -0600
232
+
233
+ Lorem ipsum.
234
+ ----
235
+
236
+ If you don't provide a time zone in the date, the date is assumed to be in the same time zone as the site (which is your local time zone by default).
237
+
238
+ Alternatively, you can specify the date in the implicit revision line.
239
+ In this case, you must substitute the colons in the time part with "h", "m", and "s", respectively, since the colon demarcates the revision remark.
240
+
241
+ [source,asciidoc]
242
+ ----
243
+ = Post Title
244
+ Author Name
245
+ 2016-03-20 10h30m00s -0600
246
+
247
+ Lorem ipsum.
248
+ ----
249
+
250
+ Note that the revision line must be preceded by the implicit author line.
251
+
252
+ === Enabling Liquid Preprocessing
186
253
 
187
254
  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
255
  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).
@@ -202,30 +269,47 @@ In these cases, you define all the page variables (e.g., layout) using AsciiDoc
202
269
  You can also use a combination of both.
203
270
  When intermixed, the page attributes defined in the AsciiDoc header take precedence.
204
271
 
205
- You can now build your site using:
272
+ == Building and Previewing Your Site
273
+
274
+ You can build your site into the [.path]__site_ directory using:
206
275
 
207
276
  $ jekyll build
208
277
 
209
- or preview it using:
278
+ If you're using Bundler, prefix each command with `bundle exec`:
279
+
280
+ [subs=+quotes]
281
+ $ *bundle exec* jekyll build
282
+
283
+ You can preview your site at \http://localhost:4000 using:
210
284
 
211
285
  $ jekyll serve
212
286
 
213
- You can continuously build without preview using:
287
+ Since Jekyll 2.4.0, the `serve` command monitors the file system and rebuilds the site whenever a change is detected by default (i.e., watch mode).
288
+ You can enable watch mode explicitly using the `--watch` flag:
289
+
290
+ $ jekyll serve --watch
291
+
292
+ To disable watch mode explicitly, use the `--no-watch` flag instead.
293
+
294
+ You can also use the `--watch` flag with the `build` command:
214
295
 
215
296
  $ jekyll build --watch
216
297
 
217
- If you're using Bundler, prefix the commands with `bundle exec`, as in:
298
+ If you only want Jekyll to build files which have changed, and not the whole site, add the `--incremental` flag:
218
299
 
219
- $ bundle exec jekyll build
300
+ $ jekyll serve --incremental
301
+
302
+ or
303
+
304
+ $ jekyll build --watch --incremental
220
305
 
221
306
  To see a report of all the files that are processed, add the `--verbose` flag:
222
307
 
223
308
  $ jekyll build --verbose
224
309
 
225
- If an AsciiDoc file is not listed, then likely Jekyll did not find a {uri-front-matter}[front matter header].
226
-
227
- IMPORTANT: If you use the `--safe` option, the AsciiDoc plugin will not be activated.
228
- The `--safe` flag disables third-party plugins such as this one.
310
+ IMPORTANT: If you add the `--safe` flag, third-party plugins such as this one are disabled by default.
311
+ To reenable the plugin, you must add the name of the gem to the whitelist.
312
+ See <<Running in Safe Mode>> for details.
229
313
 
230
314
  == Configuration
231
315
 
@@ -239,7 +323,7 @@ asciidoc: {}
239
323
  asciidoctor: {}
240
324
  ----
241
325
 
242
- Using these placeholder values is an optimization that prevents initialization from being performed more than once.
326
+ Using these placeholder values prevents initialization from being performed more than once when using watch mode (see https://github.com/jekyll/jekyll/issues/4858[issue jekyll#4858]).
243
327
 
244
328
  === AsciiDoc
245
329
 
@@ -247,7 +331,7 @@ NOTE: Prior to version 2.0.0 of this plugin, the configuration keys in this sect
247
331
  These names are now deprecated, but still supported.
248
332
 
249
333
  By default, this plugin uses Asciidoctor to convert AsciiDoc files.
250
- Since Asciidoctor is currently the only option, the default setting is equivalent to the following configuration in {path-config}:
334
+ Because Asciidoctor is currently the only option, the default setting is equivalent to the following configuration in {path-config}:
251
335
 
252
336
  [source,yaml]
253
337
  ----
@@ -278,7 +362,7 @@ asciidoc:
278
362
  page_attribute_prefix: jekyll
279
363
  ----
280
364
 
281
- A hyphen is automatically added to the value of this configuration setting if the value is non-empty.
365
+ A hyphen is automatically added to the value of this configuration setting if the value is non-empty (e.g, jekyll-).
282
366
 
283
367
  Since version 2.0.0 of this plugin, all non-hidden AsciiDoc files are processed by default, even those without a front matter header.
284
368
  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}:
@@ -340,6 +424,15 @@ asciidoctor:
340
424
  pygments-css: style
341
425
  ----
342
426
 
427
+ When using the Hash syntax, you must use an empty string value to set a valueless attribute such as `sectanchors`:
428
+
429
+ [source,yaml]
430
+ ----
431
+ asciidoctor:
432
+ attributes:
433
+ sectanchors: ''
434
+ ----
435
+
343
436
  You may use attribute references in the attribute value to reference any implicit or already defined attribute.
344
437
  For example, to set the `iconsdir` attribute based on the `imagesdir` attribute, use the following:
345
438
 
@@ -351,13 +444,24 @@ asciidoctor:
351
444
  iconsdir: '{imagesdir}/icons'
352
445
  ----
353
446
 
354
- 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.
447
+ CAUTION: If the value begins with an attribute reference, and you're defining the attributes using the Hash structure, you must enclose the value in quotes.
448
+ Beware that there are additional edge cases when the value must be enclosed in quotes.
355
449
 
356
- 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].
450
+ Since version 2.1.0 of this plugin, you can remove a previously defined attribute by prefixing the name with a minus sign (without any space between):
451
+
452
+ [source,yaml]
453
+ ----
454
+ asciidoctor:
455
+ attributes:
456
+ -idprefix:
457
+ ----
458
+
459
+ In addition to `attributes`, you may define any other option key (e.g., `safe`) recognized by the {uri-asciidoctor-manual}#ruby-api-options[Asciidoctor API].
460
+ One of those is `base_dir`, which is covered in the next section.
357
461
 
358
462
  ==== Specifying the Base Directory
359
463
 
360
- In Asciidoctor, the base directory (i.e., `base_dir` option) is used as the root when resolving non-nested, relative includes, among other paths.
464
+ In Asciidoctor, the base directory (i.e., `base_dir` option) is used as the root when resolving relative include paths in top-level documents.
361
465
 
362
466
  By default, this plugin does not specify a base directory when invoking the Asciidoctor API.
363
467
  Asciidoctor will therefore use the current working directory (i.e., the project root) as the base directory.
@@ -372,6 +476,7 @@ asciidoctor:
372
476
  ----
373
477
 
374
478
  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`.
479
+ This behavior matches how Asciidoctor works when running it outside of Jekyll.
375
480
  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.
376
481
 
377
482
  [source,yaml]
@@ -387,7 +492,40 @@ IMPORTANT: The `:docdir` setting is not available when using Jekyll 2.
387
492
  You can also set the `base_dir` option to any relative or absolute path.
388
493
  In that case, the same value will be used for all documents.
389
494
 
390
- ==== Enabling Hard Line Breaks
495
+ ==== Using AsciiDoc attributes in a Liquid template
496
+
497
+ Let's say you want to reuse your AsciiDoc attributes in a Liquid template.
498
+ This section describes how to do it.
499
+
500
+ Liquid can only access simple data structures, not complex ones like the one used to store site-wide AsciiDoc attributes. (Site-wide AsciiDoc attributes are stored deep within the Jekyll configuration data as a Hash with symbol keys).
501
+ This puts them out of the reach of Liquid templates by default.
502
+
503
+ This plugin must store site-wide AsciiDoc attributes in this way due to how Jekyll is implemented and the lifecycle it exposes for plugins.
504
+ That part can't be changed.
505
+ The plugin is limited by Jekyll's design.
506
+ However, YAML provides a mechanism that we can leverage to expose these attributes to our Liquid templates.
507
+
508
+ First, you define your AsciiDoc attributes at the top level of your configuration file where Liquid is able to access them.
509
+ If you also assign a YAML reference to this key, you can then pass that Hash to the attributes key in the asciidoctor block, thus allowing the configuration to be shared.
510
+
511
+ [source,yaml]
512
+ ----
513
+ asciidoc_attributes: &asciidoc_attributes
514
+ imagesdir=/images
515
+ asciidoctor:
516
+ attributes: *asciidoc_attributes
517
+ ...
518
+ ----
519
+
520
+ You can now reference one of the site-wide AsciiDoc attributes in the Liquid template as follows:
521
+
522
+ ----
523
+ {{ site.asciidoc_attributes.imagesdir }}
524
+ ----
525
+
526
+ Keep in mind that the value of the attribute will be unmodified from the value defined in the configuration file.
527
+
528
+ ==== Enabling Hard Line Breaks Globally
391
529
 
392
530
  Many Jekyll users are used to writing in GitHub-flavored Markdown (GFM), which preserves hard line breaks in paragraph content.
393
531
  Asciidoctor supports this feature for AsciiDoc files.
@@ -416,7 +554,7 @@ WARNING: Keep in mind, if you enable hard line breaks, you won't be able to use
416
554
 
417
555
  == Running in Safe Mode
418
556
 
419
- 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:
557
+ 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:
420
558
 
421
559
  [source,yaml]
422
560
  ----
@@ -426,7 +564,7 @@ whitelist:
426
564
 
427
565
  Safe mode is enabled either through the `--safe` flag:
428
566
 
429
- $ jekyll build --safe
567
+ $ jekyll build --safe
430
568
 
431
569
  or the `safe` configuration option in your site's {path-config} file:
432
570
 
@@ -435,6 +573,66 @@ or the `safe` configuration option in your site's {path-config} file:
435
573
  safe: true
436
574
  ----
437
575
 
576
+ == Working with AsciiDoc Content in Templates
577
+
578
+ Jekyll uses the Liquid templating language to process templates.
579
+ This plugin defines two additional Liquid filters, `asciidocify` and `tocify_asciidoc`, for working with AsciiDoc content in those templates.
580
+
581
+ === Converting a String from AsciiDoc
582
+
583
+ You can use the `asciidocify` filter to convert an arbitrary AsciiDoc string anywhere in your template.
584
+
585
+ Let's assume the excerpt of the post is written in AsciiDoc.
586
+ You can convert it in your template as follows:
587
+
588
+ ----
589
+ {{ post.excerpt | asciidocify }}
590
+ ----
591
+
592
+ By default, the AsciiDoc content is parsed as a full AsciiDoc document.
593
+ If the content represents a single paragraph, and you only want to perform inline substitutions on that content, add the `inline` doctype as the filter's first argument:
594
+
595
+ ----
596
+ {{ post.excerpt | asciidocify: 'inline' }}
597
+ ----
598
+
599
+ TIP: 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).
600
+
601
+ === Generating a Table of Contents
602
+
603
+ Since version 2.1.0 of this plugin, if you're using Jekyll 3 or better, you can use the `tocify_asciidoc` filter to generate a table of contents from the content of any page that is generated from AsciiDoc.
604
+ This filter gives you the ability to place this table of contents anywhere inside the page layout, but outside the main content.
605
+
606
+ You apply the `tocify_asciidoc` filter to `page.document`, the page variable that resolves to the parsed AsciiDoc document, as shown here:
607
+
608
+ ----
609
+ {{ page.document | tocify_asciidoc }}
610
+ ----
611
+
612
+ The number of section levels (i.e., depth) shown in the table of contents defaults to the value defined by the `toclevels` attribute in the AsciiDoc document.
613
+ To tune the number of levels, pass a numeric value as the filter's first argument.
614
+
615
+ ----
616
+ {{ page.document | tocify_asciidoc: 3 }}
617
+ ----
618
+
619
+ When you use the `tocify_asciidoc` filter, you'll also want to disable the `toc` attribute in your document.
620
+ You can do this using a conditional preprocessor directive.
621
+
622
+ [source,asciidoc]
623
+ ----
624
+ = Guide
625
+ ifndef::env-site[:toc: left]
626
+
627
+ == Section A
628
+
629
+ content
630
+
631
+ == Section B
632
+
633
+ content
634
+ ----
635
+
438
636
  == Customizing the Generated HTML
439
637
 
440
638
  You can use templates to customize the HTML output that Asciidoctor generates for your site.
@@ -462,7 +660,7 @@ Now run the `bundle` command to install the new gems.
462
660
 
463
661
  === Step {counter:step}: Create a Templates Folder
464
662
 
465
- Next, create a new folder in your site named [path]__templates_ to store your templates.
663
+ Next, create a new folder in your site named [.path]__templates_ to store your templates.
466
664
 
467
665
  $ mkdir _templates
468
666
 
@@ -481,7 +679,7 @@ asciidoctor:
481
679
 
482
680
  The final step is to compose a template.
483
681
  We'll be customizing the unordered list node.
484
- Name the file [path]_ulist.html.slim_.
682
+ Name the file [.path]_ulist.html.slim_.
485
683
 
486
684
  .ulist.html.slim
487
685
  [source,slim]
@@ -508,33 +706,82 @@ The next time you build your site, Asciidoctor will use your custom template to
508
706
 
509
707
  TIP: You can find additional examples of custom templates in the {uri-asciidoctor-backends}[asciidoctor-backends] repository.
510
708
 
709
+ == Enabling Asciidoctor Extensions
710
+
711
+ You enable Asciidoctor extensions in much the same way as this plugin.
712
+ You just need to get Jekyll to load the source.
713
+
714
+ If the extension you want to use is published as a gem, and you're using Bundler to manage the dependencies for your project (as recommended), then you simply add the gem to the `jekyll_plugins` group in your [.path]_Gemfile_:
715
+
716
+ [source,ruby]
717
+ ----
718
+ group :jekyll_plugins do
719
+ gem 'asciidoctor-extension-xyz'
720
+ end
721
+ ----
722
+
723
+ Then, run the `bundle` command from Bundler to install the gem:
724
+
725
+ $ bundle
726
+
727
+ If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually.
728
+ Once that's done, add the gem to the list gems for Jekyll to load in your site's {path-config} file:
729
+
730
+ [source,ruby]
731
+ ----
732
+ gems:
733
+ - asciidoctor-extension-xyz
734
+ ----
735
+
736
+ If the extension you want to use is not published as a gem, or is something you're developing, then you'll load it like an ad-hoc Jekyll plugin.
737
+ Add the file [.path]_asciidoctor-extensions.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:
738
+
739
+ ._plugins/asciidoctor-extensions.rb
740
+ [source,ruby]
741
+ ----
742
+ require 'asciidoctor/extensions'
743
+
744
+ Asciidoctor::Extensions.register do
745
+ treeprocessor do
746
+ process do |doc|
747
+ doc
748
+ end
749
+ end
750
+ end
751
+ ----
752
+
753
+ Asciidoctor will automatically enable the extensions in this file when it is loaded by Jekyll.
754
+
755
+ For a concrete example of using an Asciidoctor extension, refer to the next section.
756
+
511
757
  == Enabling Asciidoctor Diagram
512
758
 
513
759
  {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.
514
760
  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*.
515
761
  Other combinations are known to have issues.
516
762
 
517
- [IMPORTANT]
518
- For Graphviz and PlantUML diagram generation, {uri-graphviz}[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`.
763
+ IMPORTANT: For Graphviz and PlantUML diagram generation, {uri-graphviz}[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`.
764
+
765
+ TIP: To follow a start-to-finish tutorial that covers how to integrate Asciidoctor Diagram, see https://gist.github.com/mojavelinux/968623c493190dd61c059c2d85f9bdc3[this gist].
519
766
 
520
767
  === Installation
521
768
 
522
769
  Using Bundler::
523
770
  +
524
771
  --
525
- Add `asciidoctor-diagram` gem to your [path]_Gemfile_:
772
+ Add the `asciidoctor-diagram` gem to your [.path]_Gemfile_:
526
773
 
527
774
  [source,ruby,subs=attributes+]
528
775
  ----
529
776
  group :jekyll_plugins do
530
- gem 'asciidoctor-diagram', '~> 1.4.0' #{conum-guard}<1>
777
+ gem 'asciidoctor-diagram', '~> 1.5.4' #{conum-guard}<1>
531
778
  gem 'jekyll-asciidoc'
532
779
  ...
533
780
  end
534
781
  ----
535
782
  <1> Customize the version of Asciidoctor Diagram as needed.
536
783
 
537
- Then, run the Bundler command to install it:
784
+ Then, run Bundler's install command to install the new gem:
538
785
 
539
786
  $ bundle install
540
787
  --
@@ -570,7 +817,9 @@ asciidoctor:
570
817
  safe: unsafe
571
818
  ----
572
819
 
573
- With this configuration, Asciidoctor Diagram will generate images relative to the generated HTML page (i.e., into the same directory).
820
+ With this configuration, Asciidoctor Diagram will generate images relative to the generated HTML page (i.e., in the same directory) within the destination folder.
821
+
822
+ WARNING: Jekyll will *delete* the images Asciidoctor Diagram generates unless you follow the instructions in <<Preserving Generated Images>>.
574
823
 
575
824
  You can use the following example to test your setup:
576
825
 
@@ -601,13 +850,15 @@ asciidoctor:
601
850
  imagesdir: /images
602
851
  ----
603
852
 
604
- With this configuration, all images will be generated into the [path]_images_ directory inside the destination folder.
853
+ With this configuration, Asciidoctor Diagram will generate images into the [.path]_images_ directory within the destination folder.
854
+
855
+ WARNING: Jekyll will *delete* the images Asciidoctor Diagram generates unless you follow the instructions in <<Preserving Generated Images>>.
605
856
 
606
857
  ==== Preserving Generated Images
607
858
 
608
- Since Asciidoctor Diagram writes to the output folder, you have instruct Jekyll not to remove these generated files.
859
+ Since Asciidoctor Diagram writes to the output folder, you have to instruct Jekyll not to remove these generated files in the middle of the build process.
609
860
  One way to do this is to apply a "`monkeypatch`" to Jekyll.
610
- 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:
861
+ 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:
611
862
 
612
863
  ._plugins/jekyll-ext.rb
613
864
  [source,ruby]
@@ -621,7 +872,8 @@ An alternative to the monkeypath approach is to identify folders that contain ge
621
872
 
622
873
  [source,yaml]
623
874
  ----
624
- keep_files: [images]
875
+ keep_files:
876
+ - images
625
877
  asciidoctor:
626
878
  base_dir: :docdir
627
879
  safe: unsafe
@@ -644,8 +896,8 @@ The Jekyll AsciiDoc plugin converts AsciiDoc to embeddable HTML.
644
896
  This HTML is then inserted into the page layout.
645
897
  You need to augment the layout to include resources typically present in a standalone HTML document that Asciidoctor produces.
646
898
 
647
- . Create a stylesheet in the [path]_css_ directory named [path]_asciidoc.css_ to hold additional CSS for body content generated from AsciiDoc.
648
- . Add this stylesheet to the HTML `<head>` in [path]_{empty}_includes/head.html_ under the main.css declaration:
899
+ . Create a stylesheet in the [.path]_css_ directory named [.path]_asciidoc.css_ to hold additional CSS for body content generated from AsciiDoc.
900
+ . Add this stylesheet to the HTML `<head>` in [.path]_{empty}_includes/head.html_ under the main.css declaration:
649
901
  +
650
902
  [source,html]
651
903
  ----
@@ -655,7 +907,18 @@ You need to augment the layout to include resources typically present in a stand
655
907
  === Stylesheet for Code Highlighting
656
908
 
657
909
  Asciidoctor integrates with Pygments to provide code highlighting of source blocks in AsciiDoc content.
658
- This integration is separate from the Pygments integration in Jekyll.
910
+ This integration is separate from the Pygments integration in Jekyll 2.
911
+
912
+ To enable Pygments, you must install the `pygments.rb` gem.
913
+ This gem is bundled with Jekyll 2, so no further action is needed when if you're using Jekyll 2.
914
+ To use Pygments with Ruby >= 2.4 or JRuby, you must install pygments.rb >= 1.1.0, which also requires Jekyll >= 3.0.0.
915
+ If you're using Jekyll 3, add the `pygments.rb` gem to your [.path]_Gemfile_:
916
+
917
+ [source,ruby]
918
+ ----
919
+ gem 'pygments.rb', '~> 1.1.2'
920
+ ----
921
+
659
922
  As part of this integration, Asciidoctor generates a custom stylesheet tailored specially to work with the HTML that Asciidocotor produces.
660
923
  Since this stylesheet is backed by the Pygments API, it provides access to all the themes in Pygments
661
924
 
@@ -688,16 +951,16 @@ NOTE: It may still be necessary to make some tweaks to your site's stylesheet to
688
951
 
689
952
  === Font-based Admonition and Inline Icons
690
953
 
691
- 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:
954
+ 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:
692
955
 
693
956
  [source,html]
694
957
  ----
695
958
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
696
959
  ----
697
960
 
698
- NOTE: You can also link to local copy of Font Awesome.
961
+ NOTE: You can also link to a local copy of Font Awesome.
699
962
 
700
- Next, you need to add the following CSS rules from the default Asciidoctor stylesheet to the [path]_css/asciidoc.css_ file:
963
+ Next, you need to add the following CSS rules from the default Asciidoctor stylesheet to the [.path]_css/asciidoc.css_ file:
701
964
 
702
965
  [source,css]
703
966
  ----
@@ -778,72 +1041,60 @@ asciidoctor:
778
1041
  - iconsdir=/images/icons
779
1042
  ----
780
1043
 
781
- Then, simply put the icon images that the page needs in the [path]_images/icons_ directory.
782
-
783
- == Converting AsciiDoc in Templates
1044
+ Then, simply put the icon images that the page needs in the [.path]_images/icons_ directory.
784
1045
 
785
- Jekyll uses the Liquid templating language to process templates.
786
- This plugin defines an additional filter named `asciidocify` for converting a string of AsciiDoc.
1046
+ == Publishing Your Site
787
1047
 
788
- Let's assume the excerpt of the post is written in AsciiDoc.
789
- You can convert it in your template as follows:
1048
+ This section covers several options you have available for publishing your site, including GitHub Pages and GitLab Pages.
790
1049
 
791
- ----
792
- {{ post.excerpt | asciidocify }}
793
- ----
794
-
795
- If you only want to perform inline substitutions on the content, add the `inline` doctype as the first argument:
796
-
797
- ----
798
- {{ post.excerpt | asciidocify: 'inline' }}
799
- ----
800
-
801
- 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).
802
-
803
- == Using this Plugin on GitHub Pages
1050
+ === Using this Plugin on GitHub Pages
804
1051
 
805
1052
  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.
806
1053
 
807
1054
  [IMPORTANT]
808
- ====
809
1055
  GitHub needs to hear from enough users that need this plugin to persuade them to enable it.
810
1056
  Our recommendation is to https://github.com/contact[contact support] and keep asking for it.
811
-
812
1057
  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.
813
- ====
814
1058
 
815
1059
  _But don't despair!_
816
1060
  You can still automate publishing of the generated site to GitHub Pages using a continuous integration job.
817
1061
  Refer to the http://eshepelyuk.github.io/2014/10/28/automate-github-pages-travisci.html[Automate GitHub Pages publishing with Jekyll and Travis CI^] tutorial to find step-by-step instructions.
818
1062
  You can also refer to the https://github.com/johncarl81/transfuse-site[Transfuse website build^] for an example in practice.
819
1063
 
820
- TIP: When using this setup, don't forget to add the [path]_.nojekyll_ file to the root of the source to tell GitLab Pages not to waste time running Jekyll again on the server.
1064
+ TIP: When using this setup, don't forget to add the [.path]_.nojekyll_ file to the root of the source to tell GitLab Pages not to waste time running Jekyll again on the server.
821
1065
 
822
- === Jekyll AsciiDoc Quickstart
1066
+ ==== Jekyll AsciiDoc Quickstart
823
1067
 
824
1068
  If you want to take a shortcut that skips all the steps in the previously mentioned tutorial, clone the {uri-jaq}[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site.
825
1069
  JAQ includes a Rake build that is preconfigured to deploy to GitHub Pages from Travis CI and also provides a theme (page layout and CSS) that properly styles body content generated from AsciiDoc.
826
1070
 
827
- == Using this Plugin on GitLab Pages
1071
+ ==== Feeling Responsive
1072
+
1073
+ If you're looking for a Jekyll theme that provides comprehensive and mature styles and layouts out of the box, check out the https://github.com/Phlow/feeling-responsive[Feeling Responsive] theme.
1074
+ It includes integration with this plugin, which you simply have to enable.
1075
+ Refer to the https://phlow.github.io/feeling-responsive/getting-started/[Getting Started] page for a step-by-step guide to get your site started and feeling responsive.
1076
+
1077
+ === Using this Plugin on GitLab Pages
828
1078
 
829
1079
  Deployment to GitLab Pages is much simpler.
830
1080
  That's because GitLab allows you to control the execution of Jekyll yourself.
831
1081
  There's no need to mess around with CI jobs and authentication tokens.
832
- 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].
1082
+ 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].
1083
+ More in-depth information regarding setting up your repository for GitLab Pages can be found in the https://docs.gitlab.com/ee/pages/README.html[GitLab Enterprise Edition / Pages] documentation.
833
1084
 
834
1085
  Assuming the following are true:
835
1086
 
836
- . The source of your site resides on the master branch.
1087
+ . The source of your site resides on the master branch (though you can use any branch for this purpose).
837
1088
  . You're using Bundler to manage the dependencies for your project.
838
1089
 
839
- then you can use the following [path]_.gitlab-ci.yml_ file to get starting hosting your Jekyll site on GitLab Pages.
1090
+ You can then use the following [.path]_.gitlab-ci.yml_ file to get starting hosting your Jekyll site on GitLab Pages.
840
1091
 
841
1092
  .gitlab-ci.yml
842
1093
  [source,yaml]
843
1094
  ----
844
1095
  image: ruby:2.3
845
1096
  cache:
846
- paths:
1097
+ paths:
847
1098
  - .bundle
848
1099
  before_script:
849
1100
  - bundle --path .bundle/gems
@@ -859,7 +1110,7 @@ pages:
859
1110
 
860
1111
  This script runs Jekyll on the official Ruby Docker container.
861
1112
 
862
- 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.
1113
+ You also need to add an additional configuration file, [.path]__config-gitlab.yml_, to set the `url` and `baseurl` options when deploying your site to GitLab Pages.
863
1114
 
864
1115
  ._config-gitlab.yml
865
1116
  [source,yaml,subs=attributes+]
@@ -870,10 +1121,13 @@ baseurl: /<projectname> #{conum-guard}<2>
870
1121
  <1> Replace `<username>` with your GitLab username or group.
871
1122
  <2> Replace `<projectname>` with the basename of your project repository.
872
1123
 
873
- 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.
1124
+ 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.
874
1125
 
875
1126
  Like GitHub Pages, you can also have your site respond to a custom domain name, which is explained in the referenced tutorial.
876
- In this case, update the [path]__config-gitlab.yml_ file with the appropriate values.
1127
+ In this case, update the [.path]__config-gitlab.yml_ file with the appropriate values.
1128
+
1129
+ CAUTION: At this time, GitLab Pages only works with projects hosted at GitLab.com or on self-hosted GitLab Enterprise Edition instances.
1130
+ GitLab Community Edition does not support continuous integration and cannot host pages.
877
1131
 
878
1132
  == Getting Help
879
1133
 
@@ -924,7 +1178,7 @@ Next, switch to the project directory.
924
1178
 
925
1179
  === Install the Dependencies
926
1180
 
927
- The dependencies needed to develop the Jekyll AsciiDoc plugin are defined in the [path]_Gemfile_ at the root of the project.
1181
+ The dependencies needed to develop the Jekyll AsciiDoc plugin are defined in the [.path]_Gemfile_ at the root of the project.
928
1182
  You'll use Bundler to install these dependencies.
929
1183
 
930
1184
  To check if you have Bundler installed, use the `bundle` command to query for the version:
@@ -944,7 +1198,7 @@ IMPORTANT: Since we've installed dependencies inside the project, it's necessary
944
1198
  === Running the Tests
945
1199
 
946
1200
  The tests are based on RSpec.
947
- The test suite is located in the [path]_spec_ directory.
1201
+ The test suite is located in the [.path]_spec_ directory.
948
1202
 
949
1203
  You can run the tests using Rake.
950
1204
 
@@ -991,12 +1245,23 @@ The coding style is as follows:
991
1245
  * Indent using 2 spaces, generally.
992
1246
 
993
1247
  * Indent successive lines of conditions, method arguments or ternary expressions using 4 spaces (but not data structures or chained method calls).
1248
+ // QUESTION are we sure chained method calls should be an exception?
994
1249
 
995
1250
  * Don't indent `when` lines in a case block.
996
1251
 
1252
+ * Wrap API docs at 120 characters.
1253
+
1254
+ * Leave a single space inside brackets of a Hash.
1255
+
1256
+ { "key" => "value" }
1257
+
1258
+ * Use JSON-style key-value pair when key is a Symbol.
1259
+
1260
+ { key: "value" }
1261
+
997
1262
  * Fully qualify the class name (beginning with `::`) of any type not in the current namespace.
998
1263
 
999
- ::File.extname path
1264
+ ::File.extname path
1000
1265
 
1001
1266
  * Use triple equals to check for type, placing the type on the left hand side.
1002
1267
 
@@ -1017,9 +1282,14 @@ The coding style is as follows:
1017
1282
  end
1018
1283
 
1019
1284
  * For chained method calls, wrap parentheses around nested method call.
1285
+ (NOTE: This produces a warning in Ruby < 2).
1020
1286
 
1021
1287
  asciidoctor_config.replace (Utils.symbolize_keys asciidoctor_config)
1022
1288
 
1289
+ * Add `%r` prefix to inline regexp when used as the first argument of a method.
1290
+
1291
+ files.grep %r/^spec\//
1292
+
1023
1293
  * Use parentheses outside of a method call when parentheses are required.
1024
1294
 
1025
1295
  layout = collection_name ? (collection_name.chomp 's') : 'page'
@@ -1044,21 +1314,32 @@ The coding style is as follows:
1044
1314
 
1045
1315
  if (imagesdir = attrs['imagesdir'])
1046
1316
 
1047
- * Use simple check for nil.
1317
+ * Use variable reference to check for nil.
1048
1318
 
1049
- if base
1319
+ if base
1050
1320
 
1051
1321
  * Use `%()` instead of double quotes around interpolated strings.
1052
1322
 
1053
1323
  %(--- #{val})
1054
1324
 
1325
+ * Use single quotes around string if interpolation is not required.
1326
+
1327
+ 'asciidoctor'
1328
+
1055
1329
  * Name constants using pascal style.
1056
1330
 
1057
1331
  NewLine = %(\n)
1058
1332
 
1059
- * Store each static regular expression in a constant.
1333
+ * Define each static regular expression (regexp) as a constant so it's precompiled.
1334
+ Append `Rx` suffix to name.
1335
+
1336
+ ExtensionRx = /^\.adoc$/
1337
+
1338
+ * Place the regular expression (regexp) before the string when creating a match.
1060
1339
 
1061
- HeaderBoundaryRx = /(?<=\p{Graph})\n\n/
1340
+ ExtensionRx =~ ext
1341
+ +
1342
+ ExtensionRx.match ext
1062
1343
 
1063
1344
  * Use parentheses in traditional style when writing test assertions.
1064
1345
 
@@ -1066,6 +1347,31 @@ The coding style is as follows:
1066
1347
  expect(result.key? 'icons').to be true
1067
1348
  expect(contents).to match('<div class="page-content">')
1068
1349
 
1350
+ * Use `.size` to get the length of a collection and `.length` to get the length of a string.
1351
+
1352
+ "abc".length
1353
+ [1, 2, 3].size
1354
+
1355
+ * Use `+#[0]+` and `+#[-1]+` to get the first and last element of an Array, respectively, rather than `#first` and `#last`.
1356
+ NOTE: You still have to use `#first` and `#last` on an Enumerable object that's not an Array.
1357
+
1358
+ a = [1, 2, 3]
1359
+ a[0]
1360
+ a[-1]
1361
+
1362
+ * Pass symbol reference to `.map` when invoking no-args method on iteration variable (parens are required).
1363
+
1364
+ lines.map(&:strip)
1365
+
1366
+ * When calling `raise` to raise an exception, pass the exception class as the first argument and the message as the second.
1367
+ Write the message as a sentence, but exclude the period.
1368
+
1369
+ raise ::ArgumentError, 'Not a valid argument'
1370
+
1371
+ * Use name instead of symbol to alias a method.
1372
+
1373
+ alias copy original
1374
+
1069
1375
  ////
1070
1376
  * use `do; end` for multi-line blocks; use `{}` for single-line blocks
1071
1377
  * try to make assignments in condition if scoped to that block
@@ -1074,7 +1380,7 @@ The coding style is as follows:
1074
1380
 
1075
1381
  === Releasing the Gem
1076
1382
 
1077
- When you are ready for a release, first set the version in the file [path]_lib/jekyll-asciidoc/version.rb_.
1383
+ When you are ready for a release, first set the version in the file [.path]_lib/jekyll-asciidoc/version.rb_.
1078
1384
  Then, commit the change using the following commit message template:
1079
1385
 
1080
1386
  Release X.Y.Z
@@ -1100,7 +1406,7 @@ This plugin was created by Dan Allen and Paul Rayner and has received contributi
1100
1406
 
1101
1407
  === Copyright and License
1102
1408
 
1103
- Copyright (C) 2013-2016 Dan Allen, Paul Rayner, and the Asciidoctor Project.
1409
+ Copyright (C) 2013-2017 Dan Allen, Paul Rayner, and the Asciidoctor Project.
1104
1410
  Free use of this software is granted under the terms of the MIT License.
1105
1411
  See <<LICENSE#,LICENSE>> for details.
1106
1412