jekyll-asciidoc 2.1.1 → 3.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +26 -0
- data/Gemfile +4 -16
- data/LICENSE.adoc +1 -1
- data/README.adoc +370 -192
- data/jekyll-asciidoc.gemspec +23 -11
- data/lib/jekyll-asciidoc/compat.rb +5 -9
- data/lib/jekyll-asciidoc/converter.rb +89 -69
- data/lib/jekyll-asciidoc/filters.rb +2 -3
- data/lib/jekyll-asciidoc/integrator.rb +18 -29
- data/lib/jekyll-asciidoc/utils.rb +6 -3
- data/lib/jekyll-asciidoc/version.rb +1 -1
- metadata +48 -220
- data/Rakefile +0 -24
- data/spec/fixtures/alternate_page_attribute_prefix/_config.yml +0 -4
- data/spec/fixtures/alternate_page_attribute_prefix/_layouts/default.html +0 -12
- data/spec/fixtures/alternate_page_attribute_prefix/explicit-permalink.adoc +0 -4
- data/spec/fixtures/attributes_as_array/_config.yml +0 -7
- data/spec/fixtures/attributes_as_hash/_config.yml +0 -7
- data/spec/fixtures/basic_site/_config.yml +0 -2
- data/spec/fixtures/basic_site/_layouts/custom.html +0 -15
- data/spec/fixtures/basic_site/_layouts/page.html +0 -15
- data/spec/fixtures/basic_site/auto-layout.adoc +0 -4
- data/spec/fixtures/basic_site/bare-header.adoc +0 -4
- data/spec/fixtures/basic_site/custom-layout.adoc +0 -4
- data/spec/fixtures/basic_site/docid.adoc +0 -4
- data/spec/fixtures/basic_site/empty-layout.adoc +0 -4
- data/spec/fixtures/basic_site/empty-page-attribute.adoc +0 -4
- data/spec/fixtures/basic_site/liquid-enabled.adoc +0 -6
- data/spec/fixtures/basic_site/nil-layout.adoc +0 -4
- data/spec/fixtures/basic_site/no-doctitle.adoc +0 -2
- data/spec/fixtures/basic_site/no-liquid.adoc +0 -3
- data/spec/fixtures/basic_site/not-published.adoc +0 -4
- data/spec/fixtures/basic_site/section-with-id-and-role.adoc +0 -6
- data/spec/fixtures/basic_site/standalone-a.adoc +0 -4
- data/spec/fixtures/basic_site/standalone-b.adoc +0 -4
- data/spec/fixtures/basic_site/subdir/page-in-subdir.adoc +0 -7
- data/spec/fixtures/basic_site/with-front-matter-header-only.adoc +0 -4
- data/spec/fixtures/basic_site/with-front-matter-header.adoc +0 -6
- data/spec/fixtures/basic_site/without-front-matter-header.adoc +0 -3
- data/spec/fixtures/blank_page_attribute_prefix/_config.yml +0 -4
- data/spec/fixtures/blank_page_attribute_prefix/_layouts/default.html +0 -12
- data/spec/fixtures/blank_page_attribute_prefix/explicit-permalink.adoc +0 -4
- data/spec/fixtures/default_config/_config.yml +0 -2
- data/spec/fixtures/explicit_site_time/_config.yml +0 -4
- data/spec/fixtures/explicit_site_time/_layouts/default.html +0 -12
- data/spec/fixtures/explicit_site_time/home.adoc +0 -3
- data/spec/fixtures/fallback_to_default_layout/_blueprints/blueprint.adoc +0 -3
- data/spec/fixtures/fallback_to_default_layout/_config.yml +0 -5
- data/spec/fixtures/fallback_to_default_layout/_layouts/default.html +0 -15
- data/spec/fixtures/fallback_to_default_layout/_posts/2016-01-01-post.adoc +0 -4
- data/spec/fixtures/fallback_to_default_layout/home.adoc +0 -3
- data/spec/fixtures/front_matter_defaults/_config.yml +0 -10
- data/spec/fixtures/front_matter_defaults/_layouts/docs.html +0 -15
- data/spec/fixtures/front_matter_defaults/_layouts/general.html +0 -15
- data/spec/fixtures/front_matter_defaults/docs/page.adoc +0 -3
- data/spec/fixtures/front_matter_defaults/page.adoc +0 -3
- data/spec/fixtures/hybrid_config/_config.yml +0 -8
- data/spec/fixtures/imagesdir_relative_to_root/_config.yml +0 -5
- data/spec/fixtures/include_relative_to_docdir/_config.yml +0 -4
- data/spec/fixtures/include_relative_to_docdir/_layouts/default.html +0 -12
- data/spec/fixtures/include_relative_to_docdir/about/_people.adoc +0 -2
- data/spec/fixtures/include_relative_to_docdir/about/index.adoc +0 -13
- data/spec/fixtures/include_relative_to_root/source/_config.yml +0 -2
- data/spec/fixtures/include_relative_to_root/source/_layouts/default.html +0 -11
- data/spec/fixtures/include_relative_to_root/source/about/_people.adoc +0 -2
- data/spec/fixtures/include_relative_to_root/source/about/index.adoc +0 -13
- data/spec/fixtures/include_relative_to_source/_config.yml +0 -4
- data/spec/fixtures/include_relative_to_source/_layouts/default.html +0 -12
- data/spec/fixtures/include_relative_to_source/about/_people.adoc +0 -2
- data/spec/fixtures/include_relative_to_source/about/index.adoc +0 -13
- data/spec/fixtures/legacy_config/_config.yml +0 -5
- data/spec/fixtures/pygments_code_highlighting/_config.yml +0 -6
- data/spec/fixtures/pygments_code_highlighting/_layouts/page.html +0 -13
- data/spec/fixtures/pygments_code_highlighting/page-with-code.adoc +0 -16
- data/spec/fixtures/read_error/_config.yml +0 -2
- data/spec/fixtures/read_error/unreadable.adoc +0 -3
- data/spec/fixtures/require_front_matter_header/_config.yml +0 -4
- data/spec/fixtures/require_front_matter_header/_layouts/default.html +0 -12
- data/spec/fixtures/require_front_matter_header/with-front-matter-header.adoc +0 -5
- data/spec/fixtures/require_front_matter_header/without-front-matter-header.adoc +0 -3
- data/spec/fixtures/safe_mode/_config.yml +0 -4
- data/spec/fixtures/safe_mode/_layouts/home.html +0 -15
- data/spec/fixtures/safe_mode/home.adoc +0 -5
- data/spec/fixtures/tocify_filter/_config.yml +0 -2
- data/spec/fixtures/tocify_filter/_layouts/default.html +0 -15
- data/spec/fixtures/tocify_filter/index.adoc +0 -25
- data/spec/fixtures/with_custom_collection/_blueprints/blueprint-a.adoc +0 -4
- data/spec/fixtures/with_custom_collection/_blueprints/blueprint-b.adoc +0 -10
- data/spec/fixtures/with_custom_collection/_config.yml +0 -7
- data/spec/fixtures/with_custom_collection/_layouts/blueprint.html +0 -15
- data/spec/fixtures/with_custom_collection/_layouts/default.html +0 -15
- data/spec/fixtures/with_posts/_config.yml +0 -6
- data/spec/fixtures/with_posts/_drafts/a-draft-post.adoc +0 -5
- data/spec/fixtures/with_posts/_layouts/custom.html +0 -15
- data/spec/fixtures/with_posts/_layouts/post.html +0 -23
- data/spec/fixtures/with_posts/_posts/2016-01-01-welcome.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-01-02-empty-layout.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-01-03-auto-layout.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-01-04-custom-layout.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-01-05-nil-layout.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-02-01-post-with-categories.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-02-02-post-with-singular-vars.adoc +0 -7
- data/spec/fixtures/with_posts/_posts/2016-03-01-post-with-excerpt.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-04-01-show-me-the-title.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-05-31-automatic-title.adoc +0 -1
- data/spec/fixtures/with_posts/_posts/2016-06-15-post-with-date.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-07-15-post-with-date-and-tz.adoc +0 -4
- data/spec/fixtures/with_posts/_posts/2016-07-20-post-with-date-in-revision-line.adoc +0 -6
- data/spec/fixtures/with_posts/index.html +0 -22
- data/spec/fixtures/xhtml_syntax/_config.yml +0 -6
- data/spec/fixtures/xhtml_syntax/home.adoc +0 -5
- data/spec/fixtures/xhtml_syntax/images/sunset.jpg +0 -0
- data/spec/jekyll-asciidoc_spec.rb +0 -1103
- data/spec/spec_helper.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df9c038b47a511b9b26c4c9e8f585f5d6e89b747f47cfa09f2e257edb26e73bf
|
4
|
+
data.tar.gz: 86591c6545adce1715f2f3afd5032671748e33013ccc567599bd0362101ae9aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afb33673bed24e8448ab7cb4def0a6cb3606c9bdc0d69ac6dac15c374f6aa17de50a765416447699486765c5ffefaf9b5323c0e1af282e64f08956c001fbeef
|
7
|
+
data.tar.gz: 7d5dbf5562d3c260555947dc264287693f5bedcf36e51e0fa63a93875013bce949f9545ddf7d318ce6485e86bae01dd2587f917ac87b00868c4da1edc7a60cb2
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,32 @@
|
|
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
|
+
== 3.0.0.beta.1 (2018-12-29) - @mojavelinux
|
9
|
+
|
10
|
+
* only support Ruby >= 2.2.0 and Jekyll >= 3.0.0
|
11
|
+
* update tests to only run against supported versions
|
12
|
+
* load processor eagerly (at end of plugin initialization)
|
13
|
+
* don't crash if document body is empty (#179)
|
14
|
+
* process AsciiDoc header if page has only an AsciiDoc header but no body
|
15
|
+
* honor layout defined in frontmatter defaults (#187)
|
16
|
+
* allow page layout to be soft set in site config (#193)
|
17
|
+
* set asciidoc property to true on all AsciiDoc pages (#189)
|
18
|
+
* set asciidoc property to true on any (AsciiDoc) page enriched by this plugin (i.e., page.asciidoc) (#189)
|
19
|
+
* don't call nil_or_empty? outside of an Asciidoctor context (#142)
|
20
|
+
* don't delete category and tag; sync w/ first entry in array of matching property (#160)
|
21
|
+
* don't coerce a falsy value of page-layout defined in _config.yml to nil
|
22
|
+
* integrate collections that are not written (output flag is set to false) (#161)
|
23
|
+
* document how to enable STEM support (#163)
|
24
|
+
* document that a liquid tag that includes HTML must be enclosed in a passthrough block (#180)
|
25
|
+
* document that page attributes must be defined in the document header (#172)
|
26
|
+
* document both the plugins and gems config keys and when to use one vs the other (#159)
|
27
|
+
* document how to disable publishing for a page
|
28
|
+
* document how to make a draft post
|
29
|
+
* recommend installing gems into project and using a .ruby-version file
|
30
|
+
* pass standalone option through data instead of prepending to content
|
31
|
+
* set up code coverage reports (#196)
|
32
|
+
* set up code linter (Rubocop) (#201)
|
33
|
+
|
8
34
|
== 2.1.1 (2018-11-08) - @mojavelinux
|
9
35
|
|
10
36
|
* honor layout defined in frontmatter defaults (#187)
|
data/Gemfile
CHANGED
@@ -1,20 +1,8 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem 'jekyll', %(~> #{ENV['JEKYLL_VERSION']}) if ENV.key? 'JEKYLL_VERSION'
|
4
|
+
gem 'jekyll', %(~> #{ENV['JEKYLL_VERSION']}), require: false if ENV.key? 'JEKYLL_VERSION'
|
5
|
+
gem 'pygments.rb', '~> 1.2.1', require: false
|
6
|
+
gem 'rubocop', '~> 0.61.1', require: false
|
5
7
|
# NOTE Windows does not include zoneinfo files, so load tzinfo-data gem
|
6
|
-
gem 'tzinfo-data', platform: :mingw
|
7
|
-
|
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
|
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'
|
20
|
-
end
|
8
|
+
gem 'tzinfo-data', platform: [:x64_mingw, :mingw], require: false
|
data/LICENSE.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.The MIT License
|
2
2
|
....
|
3
|
-
Copyright (C) 2013-
|
3
|
+
Copyright (C) 2013-2018 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
|
data/README.adoc
CHANGED
@@ -1,7 +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
|
-
|
4
|
-
v2.1.0, 2017-05-21
|
3
|
+
v3.0.0.beta.1, 2018-12-29
|
5
4
|
// Settings:
|
6
5
|
:idprefix:
|
7
6
|
:idseparator: -
|
@@ -60,16 +59,18 @@ image:https://img.shields.io/travis/asciidoctor/jekyll-asciidoc/master.svg[Build
|
|
60
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}]
|
61
60
|
endif::[]
|
62
61
|
|
63
|
-
A plugin for {uri-jekyll}[Jekyll] (>=
|
62
|
+
A plugin for {uri-jekyll}[Jekyll] (>= 3.0.0) that converts {uri-asciidoc}[AsciiDoc] source files in your site to HTML pages using {uri-asciidoctor}[Asciidoctor].
|
64
63
|
|
65
64
|
ifeval::['{branch}' == 'master']
|
66
65
|
NOTE: You're viewing the documentation for the upcoming release.
|
67
66
|
If you're looking for the documentation for an older release, please refer to one of the following branches: +
|
68
|
-
{uri-repo}/tree/
|
67
|
+
{uri-repo}/tree/v2.1.x#readme[2.1.x]
|
69
68
|
⁃
|
70
|
-
{uri-repo}/tree/
|
69
|
+
{uri-repo}/tree/v2.0.x#readme[2.0.x]
|
71
70
|
⁃
|
72
|
-
{uri-repo}/tree/1.
|
71
|
+
{uri-repo}/tree/v1.1.x#readme[1.1.x]
|
72
|
+
⁃
|
73
|
+
{uri-repo}/tree/v1.0.x#readme[1.0.x]
|
73
74
|
endif::[]
|
74
75
|
|
75
76
|
toc::[]
|
@@ -88,10 +89,20 @@ These attributes are merged with the page variables defined in the front matter
|
|
88
89
|
|
89
90
|
Liquid Filters::
|
90
91
|
* `asciidocify` -- Uses the converter from this plugin to convert a string of AsciiDoc content to HTML.
|
91
|
-
* `tocify_asciidoc` -- Generates a table of contents in HTML from the parsed AsciiDoc document of the current page (since 2.1.0
|
92
|
+
* `tocify_asciidoc` -- Generates a table of contents in HTML from the parsed AsciiDoc document of the current page (since 2.1.0).
|
92
93
|
|
93
94
|
These extensions are registered automatically when the [.app]*jekyll-asciidoc* gem is required.
|
94
95
|
|
96
|
+
== Prerequisites
|
97
|
+
|
98
|
+
To use this plugin, you must be using Jekyll >= 3.0.0 and Ruby >= 2.2.0 (with development headers installed).
|
99
|
+
You should also be familiar with creating sites with Jekyll.
|
100
|
+
If you're not, you should first read the {uri-jekyll-docs}[Jekyll documentation] to familiarize yourself with how it works.
|
101
|
+
Experience with AsciiDoc and Asciidoctor is also helpful, but not a requirement.
|
102
|
+
|
103
|
+
Like Jekyll, this plugin was designed for developers, so some assembly is required.
|
104
|
+
That means you'll be expected to edit configuration, modify HTML templates, and customize CSS to use it fully.
|
105
|
+
|
95
106
|
== Installation
|
96
107
|
|
97
108
|
This plugin is packaged as a gem named [.app]*{uri-gem}[jekyll-asciidoc]* and published to RubyGems.org.
|
@@ -102,6 +113,9 @@ Your method of installation will depend on whether you use Bundler to manage the
|
|
102
113
|
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).
|
103
114
|
The instructions for how to install the Ruby development headers are platform-specific and outside of the scope of this document.
|
104
115
|
|
116
|
+
TIP: If you're using RVM, you should add a [.path]_.ruby-version_ file to the project so your shell automatically switches to the correct version of Ruby each time you enter the project.
|
117
|
+
For more information, refer to the the page https://rvm.io/workflow/projects[RVM Project Workflow].
|
118
|
+
|
105
119
|
=== Installation Using Bundler
|
106
120
|
|
107
121
|
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_:
|
@@ -117,6 +131,17 @@ Then, run the `bundle` command from Bundler to install the gem:
|
|
117
131
|
|
118
132
|
$ bundle
|
119
133
|
|
134
|
+
Jekyll will automatically activate any plugins listed in the `:jekyll_plugins` group.
|
135
|
+
|
136
|
+
If you want to keep the installed gems inside the project, use this command instead:
|
137
|
+
|
138
|
+
$ bundle --path=.bundle/gems
|
139
|
+
|
140
|
+
TIP: Subsequent calls to `bundle` will retain the `path` setting.
|
141
|
+
|
142
|
+
Keep in mind that the gems Bundler installs are linked to the current version of Ruby.
|
143
|
+
If you switch Ruby versions, you'll need to run `bundle` again.
|
144
|
+
|
120
145
|
=== Manual Installation
|
121
146
|
|
122
147
|
If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually:
|
@@ -128,10 +153,18 @@ To avoid this bad practice, we recommend using RVM (or another Ruby version mana
|
|
128
153
|
|
129
154
|
Then add the [.app]*jekyll-asciidoc* gem to the list of gems for Jekyll to load in your site's {path-config} file:
|
130
155
|
|
156
|
+
[source,yaml]
|
157
|
+
----
|
158
|
+
plugins:
|
159
|
+
- jekyll-asciidoc
|
160
|
+
----
|
161
|
+
|
162
|
+
If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`:
|
163
|
+
|
131
164
|
[source,yaml]
|
132
165
|
----
|
133
166
|
gems:
|
134
|
-
|
167
|
+
- jekyll-asciidoc
|
135
168
|
----
|
136
169
|
|
137
170
|
== Creating Pages
|
@@ -142,7 +175,7 @@ There are a few conditions that must be met in order for an AsciiDoc file to be
|
|
142
175
|
. The file must have an AsciiDoc file extension (see <<configuration>>).
|
143
176
|
. 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.]
|
144
177
|
. 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]
|
145
|
-
.
|
178
|
+
. While you can use a Jekyll front matter header, it is not required.
|
146
179
|
|
147
180
|
Here's a sample AsciiDoc file that meets these criteria:
|
148
181
|
|
@@ -186,10 +219,28 @@ Any AsciiDoc attribute defined in the AsciiDoc document header whose name begins
|
|
186
219
|
The part of the name after the `page-` prefix is _lowercased_ and used as the variable name (e.g., page-layout becomes layout).
|
187
220
|
The value is processed as {uri-yaml}[YAML] data (single-line form).
|
188
221
|
|
189
|
-
|
190
|
-
|
222
|
+
Since the attribute value is processed as YAML data, you can build nested data structure using the inline YAML syntax.
|
223
|
+
For example, here's how you can assign a value to the `page.header.image` page variable:
|
224
|
+
|
225
|
+
[source,asciidoc]
|
226
|
+
----
|
227
|
+
:page-header: { image: logo.png }
|
228
|
+
----
|
229
|
+
|
230
|
+
To define a page attribute that contains multiple words, use either a hyphen or underscore character to connect the words.
|
231
|
+
|
232
|
+
[source,asciidoc]
|
233
|
+
----
|
234
|
+
:page-short-name: slug
|
235
|
+
----
|
236
|
+
|
237
|
+
IMPORTANT: Page attributes must be defined in the document header.
|
238
|
+
That means either putting them directly below the document title (the line beginning with a single equals sign in the sample above) or above all other AsciiDoc content if the document title is not defined in AsciiDoc.
|
239
|
+
The AsciiDoc document header stops after the first blank line.
|
240
|
+
For more details about the document header, see the http://asciidoctor.org/docs/user-manual/#doc-header[Document Header] chapter in the Asciidoctor User Manual.
|
191
241
|
|
192
|
-
|
242
|
+
IMPORTANT: You may use include directives in the the document header.
|
243
|
+
However, you must ensure that the file included _does not_ contain blank lines.
|
193
244
|
|
194
245
|
=== Specifying a Layout
|
195
246
|
|
@@ -207,16 +258,69 @@ To review, here are the different ways to specify a layout using the AsciiDoc at
|
|
207
258
|
* `:page-layout: info` -- use the layout named `info` (e.g., [.path]__layout/info.html_)
|
208
259
|
* _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)
|
209
260
|
* `:!page-layout:` or `:page-layout: false` -- don't use a layout; instead, generate a standalone HTML document
|
210
|
-
* `:page-layout:
|
261
|
+
* `:page-layout: none` or `:page-layout: ~` -- don't use a layout or create a standalone HTML document (often produces an HTML fragment); use of the value `~` is discouraged; the value `none` is preferred
|
262
|
+
|
263
|
+
=== Disabling Publishing of a Page
|
264
|
+
|
265
|
+
To prevent a page from being published, set the page attribute named `page-published` to `false` (which, in turn, sets the page variable named `published` to `false`.
|
266
|
+
|
267
|
+
[source,asciidoc]
|
268
|
+
----
|
269
|
+
= Top Secret Info
|
270
|
+
:page-published: false
|
271
|
+
|
272
|
+
This page should not be published.
|
273
|
+
----
|
211
274
|
|
212
275
|
=== Implicit Page Variables
|
213
276
|
|
214
277
|
In addition to page attributes defined explicitly (e.g., layout, permalink, etc), the following implicit AsciiDoc attributes are also promoted to page variables:
|
215
278
|
|
216
|
-
* doctitle (aka the document title) (becomes title)
|
217
|
-
* id (becomes docid)
|
279
|
+
* doctitle (aka the document title) (becomes `title`)
|
280
|
+
* id (becomes `docid`)
|
218
281
|
* author
|
219
|
-
* revdate (becomes date
|
282
|
+
* revdate (becomes `date`; value is converted to a DateTime object; posts only)
|
283
|
+
|
284
|
+
Although not an implicit page variable, another very common page variable to set is `page-description`, which becomes `description` in the model.
|
285
|
+
|
286
|
+
==== Showing the Document Title
|
287
|
+
|
288
|
+
By default, when Asciidoctor converts your document, it does not include the document title in the body (aka `content`) part of the document that is passed to the layout.
|
289
|
+
Instead, it skims off the document title and assigns it to the model as `page.title`.
|
290
|
+
If you don't see the document title on the generated page at first, that's normal.
|
291
|
+
|
292
|
+
There are two ways to have the document title included in the page:
|
293
|
+
|
294
|
+
. Configure the layout to output the document title explicitly
|
295
|
+
. Configure Asciidoctor to include the document title in the body
|
296
|
+
|
297
|
+
The first option is the most typical.
|
298
|
+
Somewhere in your layout, you should include the following statement:
|
299
|
+
|
300
|
+
----
|
301
|
+
<h1>{{ page.title }}</h1>
|
302
|
+
----
|
303
|
+
|
304
|
+
This approach gives you the most control over how the document title appears and what HTML is used to enclose it.
|
305
|
+
|
306
|
+
If, instead, you want the document title to be included in the body, add the following configuration to your site's {path-config} file:
|
307
|
+
|
308
|
+
[source,yaml]
|
309
|
+
----
|
310
|
+
asciidoctor:
|
311
|
+
attributes:
|
312
|
+
- showtitle=@
|
313
|
+
----
|
314
|
+
|
315
|
+
It's also possible to enable or override this setting per page.
|
316
|
+
|
317
|
+
[source,asciidoc]
|
318
|
+
----
|
319
|
+
= Page Title
|
320
|
+
:showtitle:
|
321
|
+
----
|
322
|
+
|
323
|
+
Using either of these approaches, the document title will be shown on the generated page.
|
220
324
|
|
221
325
|
==== Giving Your Post the Time of Day
|
222
326
|
|
@@ -250,9 +354,47 @@ Lorem ipsum.
|
|
250
354
|
|
251
355
|
Note that the revision line must be preceded by the implicit author line.
|
252
356
|
|
357
|
+
==== Classifying Your Post
|
358
|
+
|
359
|
+
In Jekyll, you classify a post by assigning it to categories and/or tags.
|
360
|
+
While you can define them in the front matter, as normal, it's also possible to omit the front matter and assign them in the AsciiDoc header instead.
|
361
|
+
|
362
|
+
The AsciiDoc attributes to use to assign categories and tags to your post are `page-categories` and `page-tags`, respectively.
|
363
|
+
The attribute value must be expressed using the inline Array syntax for YAML, which is a comma-separated list of items surrounded by square brackets.
|
364
|
+
If you only have one item, you can omit the brackets.
|
365
|
+
In this case, you can also drop the plural from the attribute name.
|
366
|
+
|
367
|
+
[source,asciidoc]
|
368
|
+
----
|
369
|
+
= Introducing the Jekyll AsciiDoc Plugin
|
370
|
+
Author Name
|
371
|
+
:page-category: Tech
|
372
|
+
:page-tags: [ruby, jekyll, asciidoctor, ssg]
|
373
|
+
|
374
|
+
The Jekyll AsciiDoc plugin makes Jekyll awesome.
|
375
|
+
Why?
|
376
|
+
Because you can write posts like this one in AsciiDoc!
|
377
|
+
----
|
378
|
+
|
379
|
+
Recall that the value of page attributes is parsed as an inline YAML value.
|
380
|
+
|
381
|
+
==== Publishing a Draft Post
|
382
|
+
|
383
|
+
You can defer adding a date to a post until it's ready to publish by making it a draft.
|
384
|
+
To make a draft post, just place it in the [.path]_{empty}_drafts_ folder instead of the [.path]_posts_ folder.
|
385
|
+
But don't include the date in the filename or AsciiDoc header.
|
386
|
+
|
387
|
+
To include the drafts when building the site, pass the `--drafts` flag to the `jekyll` command:
|
388
|
+
|
389
|
+
$ jekyll build --drafts
|
390
|
+
|
391
|
+
The date of each draft post will be based on the file's last modification time.
|
392
|
+
|
393
|
+
When you're ready to publish the post, move the file from the [.path]_{empty}_drafts_ folder to the [.path]_posts_ folder and assign a date to it either by adding it to the filename or by defining the `revdate` attribute in the AsciiDoc header.
|
394
|
+
|
253
395
|
=== Enabling Liquid Preprocessing
|
254
396
|
|
255
|
-
Unlike other content files, the {uri-liquid-templates}[Liquid template preprocessor] is not applied to AsciiDoc files by default (
|
397
|
+
Unlike other content files, the {uri-liquid-templates}[Liquid template preprocessor] is not applied to AsciiDoc files by default (since version 2.0.0 of this plugin).
|
256
398
|
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).
|
257
399
|
|
258
400
|
[source,asciidoc]
|
@@ -264,12 +406,23 @@ IMPORTANT: AsciiDoc files may include a {uri-front-matter}[front matter header]
|
|
264
406
|
If present, the front matter header must be the very first character of the file.
|
265
407
|
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).
|
266
408
|
|
267
|
-
NOTE:
|
409
|
+
NOTE: Since version 2.0.0 of this plugin, you may exclude the front matter header, as shown in the second example above.
|
268
410
|
Prior to version 2.0.0, you had to include at least an empty front matter header (except for posts).
|
269
411
|
In these cases, you define all the page variables (e.g., layout) using AsciiDoc page attributes instead of in the front matter.
|
270
412
|
You can also use a combination of both.
|
271
413
|
When intermixed, the page attributes defined in the AsciiDoc header take precedence.
|
272
414
|
|
415
|
+
If you're using the Liquid include tag to include HTML into the AsciiDoc document, you need to enclose it in a passthrough block.
|
416
|
+
|
417
|
+
----
|
418
|
+
++++
|
419
|
+
{% include file.html %}
|
420
|
+
++++
|
421
|
+
----
|
422
|
+
|
423
|
+
This is necessary since AsciiDoc will escape HTML by default.
|
424
|
+
To pass it through as is requires enclosing in a passthrough block.
|
425
|
+
|
273
426
|
== Building and Previewing Your Site
|
274
427
|
|
275
428
|
You can build your site into the [.path]__site_ directory using:
|
@@ -285,12 +438,10 @@ You can preview your site at \http://localhost:4000 using:
|
|
285
438
|
|
286
439
|
$ jekyll serve
|
287
440
|
|
288
|
-
|
289
|
-
|
441
|
+
The `serve` command monitors the file system and rebuilds the site whenever a change is detected by default (i.e., watch mode).
|
442
|
+
To disable watch mode, use the `--no-watch` flag:
|
290
443
|
|
291
|
-
$ jekyll serve --watch
|
292
|
-
|
293
|
-
To disable watch mode explicitly, use the `--no-watch` flag instead.
|
444
|
+
$ jekyll serve --no-watch
|
294
445
|
|
295
446
|
You can also use the `--watch` flag with the `build` command:
|
296
447
|
|
@@ -396,22 +547,22 @@ idseparator=-
|
|
396
547
|
linkattrs=@
|
397
548
|
....
|
398
549
|
|
399
|
-
The following attributes are defined per page:
|
550
|
+
The following additional attributes are defined per page:
|
400
551
|
|
401
552
|
....
|
402
553
|
outpath=(path of page relative to baseurl)
|
403
554
|
....
|
404
555
|
|
405
|
-
You can pass
|
556
|
+
You can pass custom attributes to AsciiDoc, or override default attributes provided by the plugin, using the `attributes` option of the `asciidoctor` block in your {path-config}.
|
406
557
|
The value of this option can either be an Array containing key-value pairs:
|
407
558
|
|
408
559
|
[source,yaml]
|
409
560
|
----
|
410
561
|
asciidoctor:
|
411
562
|
attributes:
|
412
|
-
|
413
|
-
|
414
|
-
|
563
|
+
- idprefix=_
|
564
|
+
- source-highlighter=pygments
|
565
|
+
- pygments-css=style
|
415
566
|
----
|
416
567
|
|
417
568
|
or key-value pairs defined as a Hash:
|
@@ -434,7 +585,26 @@ asciidoctor:
|
|
434
585
|
sectanchors: ''
|
435
586
|
----
|
436
587
|
|
437
|
-
|
588
|
+
By default, an attribute value defined in {path-config} overrides the same attribute set in the front matter or header of a document.
|
589
|
+
For example, if you set `page-layout` in {path-config}, you won't be able to set it per page.
|
590
|
+
|
591
|
+
[source,yaml]
|
592
|
+
----
|
593
|
+
asciidoctor:
|
594
|
+
attributes:
|
595
|
+
- page-layout=false
|
596
|
+
----
|
597
|
+
|
598
|
+
If you want to allow individual pages to be able to override the attribute, append the charcter `@` to the value in {path-config}:
|
599
|
+
|
600
|
+
[source,yaml]
|
601
|
+
----
|
602
|
+
asciidoctor:
|
603
|
+
attributes:
|
604
|
+
- page-layout=false@
|
605
|
+
----
|
606
|
+
|
607
|
+
You may use attribute references in the attribute value to reference any attribute that's already defined, including implicit attributes.
|
438
608
|
For example, to set the `iconsdir` attribute based on the `imagesdir` attribute, use the following:
|
439
609
|
|
440
610
|
[source,yaml]
|
@@ -445,8 +615,8 @@ asciidoctor:
|
|
445
615
|
iconsdir: '{imagesdir}/icons'
|
446
616
|
----
|
447
617
|
|
448
|
-
CAUTION: If the value begins with an attribute reference, and you're defining the attributes using the Hash
|
449
|
-
|
618
|
+
CAUTION: If the value begins with an attribute reference, and you're defining the attributes using the Hash syntax, you must enclose the value in quotes.
|
619
|
+
There are additional edge cases when the value must be enclosed in quotes, so it's generally recommended to use them.
|
450
620
|
|
451
621
|
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):
|
452
622
|
|
@@ -458,7 +628,7 @@ asciidoctor:
|
|
458
628
|
----
|
459
629
|
|
460
630
|
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].
|
461
|
-
One of those is `base_dir`, which is covered in the next section.
|
631
|
+
One of those options is `base_dir`, which is covered in the next section.
|
462
632
|
|
463
633
|
==== Specifying the Base Directory
|
464
634
|
|
@@ -488,8 +658,6 @@ asciidoctor:
|
|
488
658
|
...
|
489
659
|
----
|
490
660
|
|
491
|
-
IMPORTANT: The `:docdir` setting is not available when using Jekyll 2.
|
492
|
-
|
493
661
|
You can also set the `base_dir` option to any relative or absolute path.
|
494
662
|
In that case, the same value will be used for all documents.
|
495
663
|
|
@@ -537,16 +705,16 @@ If you want to enable this behavior for AsciiDoc files, add the `hardbreaks-opti
|
|
537
705
|
----
|
538
706
|
asciidoctor:
|
539
707
|
attributes:
|
540
|
-
|
708
|
+
- hardbreaks-option
|
541
709
|
----
|
542
710
|
|
543
|
-
If you want to allow individual files to override
|
711
|
+
If you still want to allow individual files to be able to override the attribute, append the charcter `@` to the value in the site configuration:
|
544
712
|
|
545
713
|
[source,yaml]
|
546
714
|
----
|
547
715
|
asciidoctor:
|
548
716
|
attributes:
|
549
|
-
|
717
|
+
- hardbreaks-option=@
|
550
718
|
----
|
551
719
|
|
552
720
|
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.
|
@@ -560,7 +728,7 @@ If you want to use this plugin when running Jekyll in safe mode, you must add th
|
|
560
728
|
[source,yaml]
|
561
729
|
----
|
562
730
|
whitelist:
|
563
|
-
|
731
|
+
- jekyll-asciidoc
|
564
732
|
----
|
565
733
|
|
566
734
|
Safe mode is enabled either through the `--safe` flag:
|
@@ -601,7 +769,7 @@ TIP: This filter allows you to compose site-wide data in AsciiDoc, such your sit
|
|
601
769
|
|
602
770
|
=== Generating a Table of Contents
|
603
771
|
|
604
|
-
Since version 2.1.0 of this plugin,
|
772
|
+
Since version 2.1.0 of this plugin, you can use the `tocify_asciidoc` filter to generate a table of contents from the content of any page that is generated from AsciiDoc.
|
605
773
|
This filter gives you the ability to place this table of contents anywhere inside the page layout, but outside the main content.
|
606
774
|
|
607
775
|
You apply the `tocify_asciidoc` filter to `page.document`, the page variable that resolves to the parsed AsciiDoc document, as shown here:
|
@@ -728,10 +896,18 @@ Then, run the `bundle` command from Bundler to install the gem:
|
|
728
896
|
If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually.
|
729
897
|
Once that's done, add the gem to the list gems for Jekyll to load in your site's {path-config} file:
|
730
898
|
|
899
|
+
[source,ruby]
|
900
|
+
----
|
901
|
+
plugins:
|
902
|
+
- asciidoctor-extension-xyz
|
903
|
+
----
|
904
|
+
|
905
|
+
If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`:
|
906
|
+
|
731
907
|
[source,ruby]
|
732
908
|
----
|
733
909
|
gems:
|
734
|
-
|
910
|
+
- asciidoctor-extension-xyz
|
735
911
|
----
|
736
912
|
|
737
913
|
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.
|
@@ -758,7 +934,7 @@ For a concrete example of using an Asciidoctor extension, refer to the next sect
|
|
758
934
|
== Enabling Asciidoctor Diagram
|
759
935
|
|
760
936
|
{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.
|
761
|
-
In order to use Asciidoctor Diagram in a Jekyll project successfully, *you must use
|
937
|
+
In order to use Asciidoctor Diagram in a Jekyll project successfully, *you must use a version of this plugin >= 2.0.0*.
|
762
938
|
Other combinations are known to have issues.
|
763
939
|
|
764
940
|
IMPORTANT: For Graphviz and PlantUML diagram generation, {uri-graphviz}[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`.
|
@@ -784,7 +960,7 @@ end
|
|
784
960
|
|
785
961
|
Then, run Bundler's install command to install the new gem:
|
786
962
|
|
787
|
-
$ bundle
|
963
|
+
$ bundle
|
788
964
|
--
|
789
965
|
|
790
966
|
Without Bundler::
|
@@ -794,13 +970,22 @@ Install gems manually
|
|
794
970
|
|
795
971
|
$ [sudo] gem install asciidoctor-diagram
|
796
972
|
|
797
|
-
Then, add the `asciidoctor-diagram` gem to the list of
|
973
|
+
Then, add the `asciidoctor-diagram` gem to the list of plugins for Jekyll to load in your site's {path-config} file:
|
974
|
+
|
975
|
+
[source,yaml]
|
976
|
+
----
|
977
|
+
plugins:
|
978
|
+
- asciidoctor-diagram
|
979
|
+
- jekyll-asciidoc
|
980
|
+
----
|
981
|
+
|
982
|
+
If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`:
|
798
983
|
|
799
984
|
[source,yaml]
|
800
985
|
----
|
801
986
|
gems:
|
802
|
-
|
803
|
-
|
987
|
+
- asciidoctor-diagram
|
988
|
+
- jekyll-asciidoc
|
804
989
|
----
|
805
990
|
--
|
806
991
|
|
@@ -874,7 +1059,7 @@ An alternative to the monkeypath approach is to identify folders that contain ge
|
|
874
1059
|
[source,yaml]
|
875
1060
|
----
|
876
1061
|
keep_files:
|
877
|
-
|
1062
|
+
- images
|
878
1063
|
asciidoctor:
|
879
1064
|
base_dir: :docdir
|
880
1065
|
safe: unsafe
|
@@ -882,6 +1067,70 @@ asciidoctor:
|
|
882
1067
|
imagesdir: /images
|
883
1068
|
----
|
884
1069
|
|
1070
|
+
== Enabling STEM Support
|
1071
|
+
|
1072
|
+
Thanks to Asciidoctor, Jekyll AsciiDoc provides built-in support for processing STEM (Science, Technology, Engineering & Math) equations in your AsciiDoc documents.
|
1073
|
+
To enable this support, you just need to do a bit of configuration.
|
1074
|
+
|
1075
|
+
=== Activating the STEM processing
|
1076
|
+
|
1077
|
+
The first thing you need to do is activate the STEM processing integration in the processor itself.
|
1078
|
+
To do that, set the `stem` attribute on the document.
|
1079
|
+
One way is to set the `stem` attribute in the document header:
|
1080
|
+
|
1081
|
+
[source,asciidoc]
|
1082
|
+
----
|
1083
|
+
= Page Title
|
1084
|
+
:stem:
|
1085
|
+
----
|
1086
|
+
|
1087
|
+
Alternatively, you can enable it the `stem` attribute globally for all AsciiDoc documents in your site by adding the following to your site's {path-config} file:
|
1088
|
+
|
1089
|
+
[source,yaml]
|
1090
|
+
----
|
1091
|
+
asciidoctor:
|
1092
|
+
attributes:
|
1093
|
+
- stem
|
1094
|
+
----
|
1095
|
+
|
1096
|
+
To learn more about the built-in STEM integration, see the https://asciidoctor.org/docs/user-manual/#activating-stem-support[STEM] chapter in the Asciidoctor User Manual.
|
1097
|
+
|
1098
|
+
=== Adding the STEM assets to the page
|
1099
|
+
|
1100
|
+
Technically, Asciidoctor only prepares the STEM equations for interpretation by https://mathjax.org[MathJax].
|
1101
|
+
That means you have to load MathJax on any page that contains STEM equations (or all pages, if that's easier).
|
1102
|
+
To do so requires some customization of the page layout.
|
1103
|
+
|
1104
|
+
First, create the file [.path]__includes/mathjax.html_ and populate it with the following contents:
|
1105
|
+
|
1106
|
+
[source,html]
|
1107
|
+
----
|
1108
|
+
<script type="text/x-mathjax-config">
|
1109
|
+
MathJax.Hub.Config({
|
1110
|
+
messageStyle: "none",
|
1111
|
+
tex2jax: {
|
1112
|
+
inlineMath: [["\\(", "\\)"]],
|
1113
|
+
displayMath: [["\\[", "\\]"]],
|
1114
|
+
ignoreClass: "nostem|nolatexmath"
|
1115
|
+
},
|
1116
|
+
asciimath2jax: {
|
1117
|
+
delimiters: [["\\$", "\\$"]],
|
1118
|
+
ignoreClass: "nostem|noasciimath"
|
1119
|
+
},
|
1120
|
+
TeX: { equationNumbers: { autoNumber: "none" } }
|
1121
|
+
});
|
1122
|
+
</script>
|
1123
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
|
1124
|
+
----
|
1125
|
+
|
1126
|
+
Then, include this file before the closing `</body>` tag in your page layout.
|
1127
|
+
|
1128
|
+
----
|
1129
|
+
{% include mathjax.html %}
|
1130
|
+
----
|
1131
|
+
|
1132
|
+
With that configuration in place, the STEM equations in your AsciiDoc file will be presented beautifully using MathJax.
|
1133
|
+
|
885
1134
|
== Adding Supplemental Assets
|
886
1135
|
|
887
1136
|
Certain Asciidoctor features, such as icons, require additional CSS rules and other assets to work.
|
@@ -908,18 +1157,17 @@ You need to augment the layout to include resources typically present in a stand
|
|
908
1157
|
=== Stylesheet for Code Highlighting
|
909
1158
|
|
910
1159
|
Asciidoctor integrates with Pygments to provide code highlighting of source blocks in AsciiDoc content.
|
911
|
-
This integration is separate from the Pygments integration in Jekyll 2.
|
912
1160
|
|
913
1161
|
To enable Pygments, you must install the `pygments.rb` gem.
|
914
|
-
|
915
|
-
To use Pygments with Ruby >= 2.4 or JRuby, you must install pygments.rb >= 1.1.0, which also requires Jekyll >= 3.0.0.
|
916
|
-
If you're using Jekyll 3, add the `pygments.rb` gem to your [.path]_Gemfile_:
|
1162
|
+
To do so, add the `pygments.rb` gem to your [.path]_Gemfile_:
|
917
1163
|
|
918
1164
|
[source,ruby]
|
919
1165
|
----
|
920
1166
|
gem 'pygments.rb', '~> 1.1.2'
|
921
1167
|
----
|
922
1168
|
|
1169
|
+
IMPORTANT: To use Pygments with Ruby >= 2.4 or JRuby, you must install pygments.rb >= 1.1.0.
|
1170
|
+
|
923
1171
|
As part of this integration, Asciidoctor generates a custom stylesheet tailored specially to work with the HTML that Asciidocotor produces.
|
924
1172
|
Since this stylesheet is backed by the Pygments API, it provides access to all the themes in Pygments
|
925
1173
|
|
@@ -1015,8 +1263,8 @@ or in the site configuration:
|
|
1015
1263
|
----
|
1016
1264
|
asciidoctor:
|
1017
1265
|
attributes:
|
1018
|
-
|
1019
|
-
|
1266
|
+
- icons=font
|
1267
|
+
...
|
1020
1268
|
----
|
1021
1269
|
|
1022
1270
|
=== Image-based Admonition and Inline Icons
|
@@ -1038,8 +1286,8 @@ or your site configuration:
|
|
1038
1286
|
----
|
1039
1287
|
asciidoctor:
|
1040
1288
|
attributes:
|
1041
|
-
|
1042
|
-
|
1289
|
+
- icons
|
1290
|
+
- iconsdir=/images/icons
|
1043
1291
|
----
|
1044
1292
|
|
1045
1293
|
Then, simply put the icon images that the page needs in the [.path]_images/icons_ directory.
|
@@ -1062,7 +1310,30 @@ You can still automate publishing of the generated site to GitHub Pages using a
|
|
1062
1310
|
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.
|
1063
1311
|
You can also refer to the https://github.com/johncarl81/transfuse-site[Transfuse website build^] for an example in practice.
|
1064
1312
|
|
1065
|
-
|
1313
|
+
In fact, if you're using Travis CI, it's even easier than that.
|
1314
|
+
Travis CI provides a https://docs.travis-ci.com/user/deployment/pages/[deployer for GitLab Pages]!
|
1315
|
+
Using this deployer, Travis CI can push your generated site to GitHub Pages after a successful build on your behalf, as long as you've completed these steps:
|
1316
|
+
|
1317
|
+
. Create a personal access token on GitHub that has write access to your GitHub repository (public_repo or repo scope)
|
1318
|
+
. Define the token as a secure variable name GITHUB_TOKEN on the Travis CI settings page for your repository
|
1319
|
+
. Add a deploy configuration to your CI job configuration
|
1320
|
+
|
1321
|
+
Here's a sample deploy configuration you can use:
|
1322
|
+
|
1323
|
+
[source,yaml]
|
1324
|
+
----
|
1325
|
+
deploy:
|
1326
|
+
provider: pages
|
1327
|
+
github-token: $GITHUB_TOKEN
|
1328
|
+
local-dir: _site
|
1329
|
+
target-branch: gh-pages
|
1330
|
+
skip-cleanup: true
|
1331
|
+
keep-history: true
|
1332
|
+
on:
|
1333
|
+
branch: master
|
1334
|
+
----
|
1335
|
+
|
1336
|
+
TIP: When using this setup, don't forget to add the [.path]_.nojekyll_ file to the root of the source directory to tell GitHub Pages not to waste time running Jekyll again on the server.
|
1066
1337
|
|
1067
1338
|
==== Jekyll AsciiDoc Quickstart
|
1068
1339
|
|
@@ -1093,20 +1364,20 @@ You can then use the following [.path]_.gitlab-ci.yml_ file to get starting host
|
|
1093
1364
|
.gitlab-ci.yml
|
1094
1365
|
[source,yaml]
|
1095
1366
|
----
|
1096
|
-
image: ruby:2.
|
1367
|
+
image: ruby:2.5
|
1097
1368
|
cache:
|
1098
1369
|
paths:
|
1099
|
-
|
1370
|
+
- .bundle
|
1100
1371
|
before_script:
|
1101
|
-
|
1372
|
+
- bundle --path .bundle/gems
|
1102
1373
|
pages:
|
1103
1374
|
script:
|
1104
|
-
|
1375
|
+
- bundle exec jekyll build -d public --config _config.yml,_config-gitlab.yml -q
|
1105
1376
|
artifacts:
|
1106
1377
|
paths:
|
1107
|
-
|
1378
|
+
- public
|
1108
1379
|
only:
|
1109
|
-
|
1380
|
+
- master
|
1110
1381
|
----
|
1111
1382
|
|
1112
1383
|
This script runs Jekyll on the official Ruby Docker container.
|
@@ -1226,158 +1497,65 @@ Then, run RSpec with the `focus` flag enabled:
|
|
1226
1497
|
|
1227
1498
|
You should see that RSpec only runs the specifications that have this flag.
|
1228
1499
|
|
1229
|
-
===
|
1230
|
-
|
1231
|
-
You can install the development version of the gem as follows:
|
1232
|
-
|
1233
|
-
$ bundle exec rake install
|
1234
|
-
|
1235
|
-
This allows you to use an unreleased version of the gem in your site.
|
1236
|
-
If you want to build the gem and install it manually, use these commands instead:
|
1237
|
-
|
1238
|
-
$ bundle exec rake build
|
1239
|
-
$ [sudo] gem install pkg/jekyll-asciidoc-*.dev.gem
|
1240
|
-
|
1241
|
-
=== Coding Style
|
1242
|
-
|
1243
|
-
This project adheres to the coding style used throughout the Asciidoctor project.
|
1244
|
-
The coding style is as follows:
|
1245
|
-
|
1246
|
-
* Indent using 2 spaces, generally.
|
1247
|
-
|
1248
|
-
* Indent successive lines of conditions, method arguments or ternary expressions using 4 spaces (but not data structures or chained method calls).
|
1249
|
-
// QUESTION are we sure chained method calls should be an exception?
|
1250
|
-
|
1251
|
-
* Don't indent `when` lines in a case block.
|
1252
|
-
|
1253
|
-
* Wrap API docs at 120 characters.
|
1254
|
-
|
1255
|
-
* Leave a single space inside brackets of a Hash.
|
1256
|
-
|
1257
|
-
{ "key" => "value" }
|
1258
|
-
|
1259
|
-
* Use JSON-style key-value pair when key is a Symbol.
|
1260
|
-
|
1261
|
-
{ key: "value" }
|
1262
|
-
|
1263
|
-
* Fully qualify the class name (beginning with `::`) of any type not in the current namespace.
|
1264
|
-
|
1265
|
-
::File.extname path
|
1266
|
-
|
1267
|
-
* Use triple equals to check for type, placing the type on the left hand side.
|
1268
|
-
|
1269
|
-
::Hash === attrs
|
1270
|
-
|
1271
|
-
* Drop parentheses around method arguments of a method definition.
|
1272
|
-
|
1273
|
-
def integrate document, collection_name = nil
|
1274
|
-
...
|
1275
|
-
end
|
1276
|
-
|
1277
|
-
* Drop parentheses around method arguments of an isolated method call.
|
1278
|
-
|
1279
|
-
source = ::File.expand_path config['source']
|
1280
|
-
+
|
1281
|
-
if key.start_with? '!'
|
1282
|
-
...
|
1283
|
-
end
|
1284
|
-
|
1285
|
-
* For chained method calls, wrap parentheses around nested method call.
|
1286
|
-
(NOTE: This produces a warning in Ruby < 2).
|
1287
|
-
|
1288
|
-
asciidoctor_config.replace (Utils.symbolize_keys asciidoctor_config)
|
1289
|
-
|
1290
|
-
* Add `%r` prefix to inline regexp when used as the first argument of a method.
|
1291
|
-
|
1292
|
-
files.grep %r/^spec\//
|
1500
|
+
=== Generating Code Coverage
|
1293
1501
|
|
1294
|
-
|
1502
|
+
To generate a code coverage report when running tests using simplecov, set the `COVERAGE` environment variable as follows when running the tests:
|
1295
1503
|
|
1296
|
-
|
1297
|
-
+
|
1298
|
-
if (::Jekyll::Utils.method dlg_method.name).arity == -1
|
1299
|
-
...
|
1300
|
-
end
|
1301
|
-
|
1302
|
-
* Use parentheses where required, such as around the accumulator seed value for a collection predicate.
|
1303
|
-
|
1304
|
-
hash.each_with_object({}) {|(key, val), accum| accum[key.to_sym] = val }
|
1305
|
-
|
1306
|
-
* Don't put curly braces around entries in an options Hash (i.e., symbol keys).
|
1307
|
-
|
1308
|
-
record_path_info document, source_only: true
|
1309
|
-
|
1310
|
-
* Use a trailing condition for single-line statements.
|
1311
|
-
|
1312
|
-
clear_path_info if Document === document
|
1313
|
-
|
1314
|
-
* Put parantheses around a variable assignment inside a condition.
|
1315
|
-
|
1316
|
-
if (imagesdir = attrs['imagesdir'])
|
1317
|
-
|
1318
|
-
* Use variable reference to check for nil.
|
1319
|
-
|
1320
|
-
if base
|
1321
|
-
|
1322
|
-
* Use `%()` instead of double quotes around interpolated strings.
|
1504
|
+
$ COVERAGE=true bundle exec rake spec
|
1323
1505
|
|
1324
|
-
|
1506
|
+
You'll see a total coverage score as well as a link to the HTML report in the output.
|
1507
|
+
The HTML report helps you understand which lines and branches were missed, if any.
|
1325
1508
|
|
1326
|
-
|
1509
|
+
Despite being fast, the downside of using simplecov is that it misses branches.
|
1510
|
+
You can use deep-cover to generate a more thorough report.
|
1511
|
+
To do so, set the `COVERAGE` environment variable as follows when running the tests:
|
1327
1512
|
|
1328
|
-
|
1513
|
+
$ COVERAGE=deep bundle exec rake spec
|
1329
1514
|
|
1330
|
-
|
1515
|
+
You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output.
|
1516
|
+
The HTML report helps you understand which lines and branches were missed, if any.
|
1331
1517
|
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
Append `Rx` suffix to name.
|
1518
|
+
////
|
1519
|
+
As an alternative to deep cover's native HTML reporter, you can also use istanbul / nyc.
|
1520
|
+
First, you'll need to have the `nyc` command available on your system:
|
1336
1521
|
|
1337
|
-
|
1522
|
+
$ npm install -g nyc
|
1338
1523
|
|
1339
|
-
|
1524
|
+
or
|
1340
1525
|
|
1341
|
-
|
1342
|
-
+
|
1343
|
-
ExtensionRx.match ext
|
1526
|
+
$ yarn global add nyc
|
1344
1527
|
|
1345
|
-
|
1528
|
+
Next, in addition to the `COVERAGE` environment variable, also set the `DEEP_COVER_REPORTER` environment variable as follows when running the tests:
|
1346
1529
|
|
1347
|
-
|
1348
|
-
expect(result.key? 'icons').to be true
|
1349
|
-
expect(contents).to match('<div class="page-content">')
|
1530
|
+
$ COVERAGE=deep DEEP_COVER_REPORTER=istanbul bundle exec rake spec
|
1350
1531
|
|
1351
|
-
|
1532
|
+
You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output.
|
1533
|
+
The HTML report helps you understand which lines and branches were missed, if any.
|
1534
|
+
////
|
1352
1535
|
|
1353
|
-
|
1354
|
-
[1, 2, 3].size
|
1536
|
+
=== Running the Code Linter
|
1355
1537
|
|
1356
|
-
|
1357
|
-
|
1538
|
+
Before you commit code, you should run it through the linter to make sure it adheres to the coding style.
|
1539
|
+
You can run the linter using the following command:
|
1358
1540
|
|
1359
|
-
|
1360
|
-
a[0]
|
1361
|
-
a[-1]
|
1541
|
+
$ bundle exec rake lint
|
1362
1542
|
|
1363
|
-
|
1543
|
+
The coding style is enforced by Rubocop.
|
1544
|
+
The rules are defined in [.path]_.rubocop.yml_.
|
1545
|
+
These rules extend from the default rule set provided by Rubocop to match the style of the project.
|
1364
1546
|
|
1365
|
-
|
1547
|
+
=== Installing the Gem Locally
|
1366
1548
|
|
1367
|
-
|
1368
|
-
Write the message as a sentence, but exclude the period.
|
1549
|
+
You can install the development version of the gem as follows:
|
1369
1550
|
|
1370
|
-
|
1551
|
+
$ bundle exec rake install
|
1371
1552
|
|
1372
|
-
|
1553
|
+
This allows you to use an unreleased version of the gem to build your site.
|
1373
1554
|
|
1374
|
-
|
1555
|
+
If you want to build the gem and install it yourself, use these commands instead:
|
1375
1556
|
|
1376
|
-
|
1377
|
-
|
1378
|
-
* try to make assignments in condition if scoped to that block
|
1379
|
-
* close empty block on same line if empty - `rescue ::NameError; end`
|
1380
|
-
////
|
1557
|
+
$ bundle exec rake build
|
1558
|
+
$ [sudo] gem install pkg/jekyll-asciidoc-*.dev.gem
|
1381
1559
|
|
1382
1560
|
=== Releasing the Gem
|
1383
1561
|
|
@@ -1394,7 +1572,7 @@ Next, package, tag and release the gem to RubyGems.org, run the following rake t
|
|
1394
1572
|
|
1395
1573
|
IMPORTANT: Ensure you have the proper credentials setup as described in the guide {uri-guide-publish-gem}[Publishing to RubyGems.org].
|
1396
1574
|
|
1397
|
-
Once you finish the release, you should update the version to the next micro version in the sequence using the `.dev` suffix (e.g.,
|
1575
|
+
Once you finish the release, you should update the version to the next micro version in the sequence using the `.dev` suffix (e.g., 3.0.1.dev).
|
1398
1576
|
|
1399
1577
|
== About the Project
|
1400
1578
|
|
@@ -1407,7 +1585,7 @@ This plugin was created by Dan Allen and Paul Rayner and has received contributi
|
|
1407
1585
|
|
1408
1586
|
=== Copyright and License
|
1409
1587
|
|
1410
|
-
Copyright (C) 2013-
|
1588
|
+
Copyright (C) 2013-2018 Dan Allen, Paul Rayner, and the Asciidoctor Project.
|
1411
1589
|
Free use of this software is granted under the terms of the MIT License.
|
1412
1590
|
See <<LICENSE#,LICENSE>> for details.
|
1413
1591
|
|