jekyll-asciidoc 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97faf9f23f10a720b2ac0b8110ccd556ce089a34
4
- data.tar.gz: ebdeb3ce72ecb28138262ef94bd995f65e5b8e7e
3
+ metadata.gz: 038ace39e983d8f6e710306e70ba7acd02af1c80
4
+ data.tar.gz: 81a0bed37126dce92290fb9fc8eb20369e9c27be
5
5
  SHA512:
6
- metadata.gz: 6f498445e512a283e7b7599efe904e8a58713bb01b10c8441e345749d580818ba794fd7014d2a5e5cc889870d11a37238b49bc05cb309442e5aa6eff0288860f
7
- data.tar.gz: b10dc4780ab898db1059665f79c3b433dcebd1b078967d16b51ae315c68613ac73fb84710d4df2b51e04f55c6d14c4ee24f0b73871426c31b6d931a0c9a9364d
6
+ metadata.gz: 67b47225a5f907acd69454fe83570c95192ec9b07e968ebeb23b4a192aa912f19a5025ed74cab9e73461c2a1c5d31364a67d988fae00a10ba11f4846a0cf4db1
7
+ data.tar.gz: 02bb49e0c9b2a1943ab637fd9e8def0d6e06cf490fc7af444b80feccdfccb1ec9b93463652e52c7428c7cd25812c12c408099d599cc5afaed3e443620ea434b4
data/README.adoc CHANGED
@@ -1,7 +1,13 @@
1
1
  = Jekyll AsciiDoc Plugin (powered by Asciidoctor)
2
- Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
2
+ Paul Rayner <https://github.com/paulrayner[@paulrayner]>; Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
3
+ :toc: preamble
4
+ :toclevels: 1
3
5
 
4
- A http://jekyllrb.com[Jekyll] plugin that converts http://asciidoc.org[AsciiDoc] files in your site source to HTML pages using http://asciidoctor.org[Asciidoctor].
6
+ image:https://badge.fury.io/rb/jekyll-asciidoc.svg["Gem Version", link="https://badge.fury.io/rb/jekyll-asciidoc"]
7
+
8
+ A plugin for http://jekyllrb.com[Jekyll] that converts http://asciidoc.org[AsciiDoc] files in your site source to HTML pages using http://asciidoctor.org[Asciidoctor].
9
+
10
+ == Overview
5
11
 
6
12
  The plugin consists of three extensions:
7
13
 
@@ -12,16 +18,16 @@ The plugin consists of three extensions:
12
18
  `Jekyll::Filters.asciidocify`::
13
19
  A Liquid filter for converting AsciiDoc content to HTML using the AsciiDocConverter
14
20
 
15
- All these extensions are included in the file `lib/asciidoc_plugin.rb`.
21
+ These extensions are loaded automatically when the jekyll-asciidoc is required.
16
22
 
17
23
  == Installation
18
24
 
19
- The plugin depends on the Asciidoctor gem (named http://rubygems.org/gems/asciidoctor[asciidoctor]).
25
+ The plugin depends on the http://rubygems.org/gems/asciidoctor[asciidoctor] gem.
20
26
  You can install the gem using:
21
27
 
22
28
  $ gem install asciidoctor
23
29
 
24
- If you are using Bundler to manage the dependencies in your Jekyll project, then add the Asciidoctor gem to your `Gemfile` (below the Jekyll gem, named jekyll):
30
+ If you're using Bundler to manage the dependencies in your Jekyll project, instead add the asciidoctor gem to your [path]_Gemfile_ (beneath the jekyll gem):
25
31
 
26
32
  [source,ruby]
27
33
  ----
@@ -31,7 +37,7 @@ gem 'jekyll'
31
37
  gem 'asciidoctor'
32
38
  ----
33
39
 
34
- Then, run the Bundler install command
40
+ Then, run the Bundler install command:
35
41
 
36
42
  $ bundle install
37
43
 
@@ -39,45 +45,49 @@ Then, run the Bundler install command
39
45
 
40
46
  Using Bundler::
41
47
  +
42
- Add `jekyll-asciidoc` plugin gem to your `Gemfile`
43
- +
48
+ --
49
+ Add the `jekyll-asciidoc` plugin gem to your [path]_Gemfile_
50
+
44
51
  [source,ruby]
45
- ----
46
52
  group :jekyll_plugins do
47
- gem "jekyll-asciidoc"
53
+ gem 'jekyll-asciidoc'
48
54
  end
49
- ----
50
- +
55
+
51
56
  Then, run the Bundler command to install it:
52
57
 
53
58
  $ bundle install
59
+ --
54
60
 
55
61
  Without Bundler::
56
62
  +
63
+ --
57
64
  If you are not using Bundler for managing Jekyll then install gems manually
58
- +
59
- $ gem install jekyll-asciidoc
60
- +
61
- And then, add `jekyll-asciidoc` gem to the list of gems for Jekyll to load in your site's `_config.yml` file:
62
- +
65
+
66
+ $ gem install jekyll-asciidoc
67
+
68
+ And then, add the `jekyll-asciidoc` gem to the list of gems for Jekyll to load in your site's [path]_{empty}_config.yml_ file:
69
+
63
70
  [source,yaml]
64
- ----
65
71
  gems:
66
72
  - jekyll-asciidoc
67
- ----
73
+ --
68
74
 
69
75
  === Installing development version of the plugin
70
76
 
71
- To install the development version of this plugin, copy `lib/asciidoc_plugin.rb` to the `_plugins` directory in the root of your site source.
77
+ To install the development version of this plugin, use:
72
78
 
73
- NOTE: If no `_plugins` directory exists, you need to first create it.
79
+ $ rake install
74
80
 
75
- == Creating Pages
81
+ An alternative--though not recommend--approach is to copy the file [path]_lib/jekyll-asciidoc.rb_ to the [path]_{empty}_plugins_ directory in the root of your site source.
82
+
83
+ NOTE: If the [path]_{empty}_plugins_ directory does not exist, you need to first create it.
84
+
85
+ == Creating pages
76
86
 
77
87
  To add a page composed in AsciiDoc, simply add an AsciiDoc file to the root of the project with an AsciiDoc file extension.
78
88
 
79
89
  .sample.adoc
80
- [source,asciidoc]
90
+ [listing]
81
91
  ....
82
92
  ---
83
93
  ---
@@ -100,7 +110,7 @@ You can use an empty front matter header, as shown above, or you can define all
100
110
  You can now build your site using:
101
111
 
102
112
  $ jekyll build
103
-
113
+
104
114
  and preview it using:
105
115
 
106
116
  $ jekyll serve
@@ -109,26 +119,26 @@ If you are using Bundler then use following commands to do the same
109
119
 
110
120
  $ bundle exec jekyll build
111
121
  $ bundle exec jekyll serve
112
-
122
+
113
123
  IMPORTANT: If you use the `--safe` option, the AsciiDoc plugin will not be activated.
114
124
  The `--safe` flag disables third-party plugins such as this one.
115
125
 
116
- == Configuration (Optional)
126
+ == Configuration (optional)
117
127
 
118
128
  By default, this plugin uses Asciidoctor to convert AsciiDoc files.
119
- Since Asciidoctor is the only option, the default setting is equivalent to the following configuration in `_config.yml`:
129
+ Since Asciidoctor is the only option, the default setting is equivalent to the following configuration in [path]_{empty}_config.yml_:
120
130
 
121
131
  [source,yaml]
122
132
  asciidoc: asciidoctor
123
133
 
124
- To tell Jekyll which extensions to recognize as AsciiDoc files, add the following line to your `_config.yml`:
134
+ To tell Jekyll which extensions to recognize as AsciiDoc files, add the following line to your [path]_{empty}_config.yml_:
125
135
 
126
136
  [source,yaml]
127
137
  asciidoc_ext: asciidoc,adoc,ad
128
138
 
129
139
  The extensions shown in the previous listing are the default values, so you don't need to specify this option if those defaults are sufficient.
130
140
 
131
- To pass additional attributes to AsciiDoc, or override the default attributes defined in the plugin, add the following lines to your `_config.yml`:
141
+ To pass additional attributes to AsciiDoc, or override the default attributes defined in the plugin, add the following lines to your [path]_{empty}_config.yml_:
132
142
 
133
143
  [source,yaml]
134
144
  asciidoctor:
@@ -137,18 +147,196 @@ asciidoctor:
137
147
  - source-highlighter=pygments
138
148
  - pygments-css=style
139
149
 
140
- === Hard line breaks
150
+ === Disabling hard line breaks
141
151
 
142
152
  The Jekyll AsciiDoc integration is configured to preserve hard line breaks in paragraph content by default.
143
153
  Since many Jekyll users are used to writing in GitHub-flavored Markdown (GFM), this default was selected to ease the transition to AsciiDoc.
144
- If you want the standard AsciiDoc behavior of collapsing hard line breaks in paragraph content, add the following settings to your site's `_config.yml` file:
154
+ If you want the standard AsciiDoc behavior of collapsing hard line breaks in paragraph content, add the following settings to your site's [path]_{empty}_config.yml_ file:
145
155
 
146
156
  [source,yaml]
147
157
  asciidoctor:
148
158
  attributes:
149
159
  - hardbreaks!
150
160
 
151
- If you already have AsciiDoc attributes defined in the `_config.yml`, the `hardbreaks!` attribute should be added as a sibling entry in the YAML collection.
161
+ If you already have AsciiDoc attributes defined in the [path]_{empty}_config.yml_, the `hardbreaks!` attribute should be added as a sibling entry in the YAML collection.
162
+
163
+ == Enabling Asciidoctor Diagram (optional)
164
+
165
+ Asciidoctor Diagram is a set of extensions for Asciidoctor that allow you to embed diagrams written using the PlantUML, Graphviz, ditaa, or Shaape syntax inside your AsciiDoc documents.
166
+
167
+ [IMPORTANT]
168
+ For Graphviz and PlantUML diagram generation, http://www.graphviz.org[Graphviz] must be installed (i.e., the `dot` utility must be available on your `$PATH`.
169
+
170
+ === Installation
171
+
172
+ Using Bundler::
173
+ +
174
+ --
175
+ Add `asciidoctor-diagram` gem to your [path]_Gemfile_
176
+
177
+ [source,ruby]
178
+ ----
179
+ group :jekyll_plugins do
180
+ ....
181
+ gem 'asciidoctor-diagram', '>= 1.3.1' <1>
182
+ ...
183
+ end
184
+ ----
185
+ <1> version can be configured differently
186
+
187
+ Then, run the Bundler command to install it:
188
+
189
+ $ bundle install
190
+ --
191
+
192
+ Without Bundler::
193
+ +
194
+ --
195
+ Install gems manually
196
+
197
+ $ gem install asciidoctor-diagram
198
+
199
+ Then, add the `asciidoctor-diagram` gem to the list of gems for Jekyll to load in your site's [path]_{empty}_config.yml_ file:
200
+
201
+ [source,yaml]
202
+ gems:
203
+ - asciidoctor-diagram
204
+ --
205
+
206
+ Both of the previous configurations are the equivalent of passing `-r asciidoctor-diagram` to the `asciidoctor` command.
207
+
208
+ === Generated image location
209
+
210
+ By default diagram images are generated in the root folder.
211
+ Thus, images URLs are not properly referenced from the generated HTML pages.
212
+
213
+ To fix this, set the `imagesdir` attribute in any AsciiDoc file that contains diagrams.
214
+
215
+ ._posts/2015-12-24-diagrams.adoc
216
+ [listing]
217
+ ....
218
+ ---
219
+ ---
220
+ = Diagrams
221
+ :imagesdir: /images/2015-12-24 <1>
222
+
223
+ [graphviz, dot-example, svg]
224
+ ----
225
+ digraph g {
226
+ a -> b
227
+ b -> c
228
+ c -> d
229
+ d -> a
230
+ }
231
+ ----
232
+ ....
233
+ <1> the date in the imagesdir value must match the date of the post (e.g., 2015-12-24)
234
+
235
+ WARNING: The images are generated after Jekyll copies assets to the [path]_{empty}_site_ directory.
236
+ Therefore, you'll have to run `jeykll` twice before you see the images in the preview.
237
+
238
+ == Supplemental AsciiDoc Assets
239
+
240
+ Certain Asciidoctor features, such as icons, require additional CSS rules and other assets to work.
241
+ These CSS rules and other assets do not get automatically included in the pages generated by Jekyll.
242
+ This section documents how to configure these additional resources.
243
+
244
+ TIP: If you want to take a shortcut that skips all this configuration, clone the https://github.com/asciidoctor/jekyll-asciidoc-quickstart[Jekyll AsciiDoc Quickstart (JAQ)] repository and use it as a starting point for your site.
245
+ JAQ provides a page layout out of the box configured to fully style body content generated from AsciiDoc.
246
+
247
+ === Setup
248
+
249
+ The Jekyll AsciiDoc plugin converts AsciiDoc to embeddable HTML.
250
+ This HTML is then inserted into the page layout.
251
+ You need to augment the page layout to include resources typically present in a standalone HTML document that Asciidoctor produces.
252
+
253
+ . Create a stylesheet in the [path]_css_ directory named [path]_asciidoc.css_ to hold additional CSS for body content generated from AsciiDoc.
254
+ . Add this stylesheet to the HTML `<head>` in [path]_{empty}_includes/head.html_ under the main.css declaration:
255
+ +
256
+ [source,html]
257
+ <link rel="stylesheet" href="{{ "/css/asciidoc.css" | prepend: site.baseurl }}">
258
+
259
+ === Font-based Admonition and Inline Icons
260
+
261
+ 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:
262
+
263
+ [source,html]
264
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
265
+
266
+ NOTE: You can also link to local copy of Font Awesome.
267
+
268
+ Next, you need to add the following CSS rules from the default Asciidoctor stylesheet to the [path]_css/asciidoc.css_ file:
269
+
270
+ [source,css]
271
+ ----
272
+ span.icon>.fa {
273
+ cursor: default;
274
+ }
275
+ .admonitionblock td.icon {
276
+ text-align: center;
277
+ width: 80px;
278
+ }
279
+ .admonitionblock td.icon [class^="fa icon-"] {
280
+ font-size: 2.5em;
281
+ text-shadow: 1px 1px 2px rgba(0,0,0,.5);
282
+ cursor: default;
283
+ }
284
+ .admonitionblock td.icon .icon-note:before {
285
+ content: "\f05a";
286
+ color: #19407c;
287
+ }
288
+ .admonitionblock td.icon .icon-tip:before {
289
+ content: "\f0eb";
290
+ text-shadow: 1px 1px 2px rgba(155,155,0,.8);
291
+ color: #111;
292
+ }
293
+ .admonitionblock td.icon .icon-warning:before {
294
+ content: "\f071";
295
+ color: #bf6900;
296
+ }
297
+ .admonitionblock td.icon .icon-caution:before {
298
+ content: "\f06d";
299
+ color: #bf3400;
300
+ }
301
+ .admonitionblock td.icon .icon-important:before {
302
+ content: "\f06a";
303
+ color: #bf0000;
304
+ }
305
+ ----
306
+
307
+ Feel free to modify the CSS to your liking.
308
+
309
+ Finally, you need to enable the font-based icons in the header of the document:
310
+
311
+ :icons: font
312
+
313
+ or in the site configuration:
314
+
315
+ [source,yaml]
316
+ asciidoctor:
317
+ attributes:
318
+ - icons=font
319
+ ...
320
+
321
+ === Image-based Admonition and Inline Icons
322
+
323
+ As an alternative to font-based icons, you can configure Asciidoctor to use image-based icons.
324
+ In this case, all you need to do is provide the icons at the proper location.
325
+
326
+ First, enable image-based icons and configure the path to the icons in the header of the document:
327
+
328
+ :icons:
329
+ :iconsdir: /images/icons
330
+
331
+ or your site configuration:
332
+
333
+ [source,yaml]
334
+ asciidoctor:
335
+ attributes:
336
+ - icons
337
+ - iconsdir=/images/icons
338
+
339
+ Then, simply put the icon images that the page needs in the [path]_images/icons_ directory.
152
340
 
153
341
  == GitHub Pages
154
342
 
@@ -162,3 +350,20 @@ Refer to the tutorial http://eshepelyuk.github.io/2014/10/28/automate-github-pag
162
350
  You can also refer to the https://github.com/johncarl81/transfuse/tree/transfuse-jeykll-site[Tranfuse website build^] for an example in practice.
163
351
 
164
352
  Refer to the https://help.github.com/articles/using-jekyll-plugins-with-github-pages[Jekyll Plugins on GitHub Pages] for a list of the plugins currently supported on the server-side (in addition to Markdown, which isn't listed).
353
+
354
+ == Releasing the gem to RubyGems.org
355
+
356
+ When you are ready for a release, first set the version in the file [path]_lib/jekyll-asciidoc/version.rb_.
357
+ Then, commit the change using the following commit message template:
358
+
359
+ Release X.Y.Z
360
+
361
+ where `X.Y.Z` is the version number of the gem.
362
+
363
+ Next, package, tag and release the gem to RubyGems.org, run the following rake task:
364
+
365
+ $ rake release
366
+
367
+ IMPORTANT: Ensure you have the proper credentials setup as described in the guide http://guides.rubygems.org/publishing/#publishing-to-rubygemsorg[Publishing to RubyGems.org].
368
+
369
+ Once you finish the release, you should update the version to the next micro version in the sequence using the `.dev` suffix (e.g., 1.0.1.dev).
data/Rakefile CHANGED
@@ -6,6 +6,10 @@ begin
6
6
  require 'bundler/gem_tasks'
7
7
  default_tasks << :build
8
8
  rescue LoadError
9
+ warn 'jekyll-asciidoc: Bundler is required to build this gem.
10
+ You can install Bundler using the `gem install` command:
11
+
12
+ $ gem install bundler' + %(\n\n)
9
13
  end
10
14
 
11
15
  task :default => default_tasks unless default_tasks.empty?
@@ -1,3 +1,5 @@
1
+ JEKYLL_MIN_VERSION_3 = Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new('3.0.0') unless defined? JEKYLL_MIN_VERSION_3
2
+
1
3
  module Jekyll
2
4
  module Converters
3
5
  class AsciiDocConverter < Converter
@@ -17,7 +19,7 @@ module Jekyll
17
19
  end
18
20
  @asciidoctor_config[:safe] ||= 'safe'
19
21
  user_defined_attributes = @asciidoctor_config[:attributes]
20
- @asciidoctor_config[:attributes] = %w(notitle! hardbreaks idprefix= idseparator=- linkattrs)
22
+ @asciidoctor_config[:attributes] = %w(notitle hardbreaks idprefix= idseparator=- linkattrs)
21
23
  unless user_defined_attributes.nil?
22
24
  @asciidoctor_config[:attributes].concat(user_defined_attributes)
23
25
  end
@@ -81,7 +83,9 @@ module Jekyll
81
83
  # Promotes select AsciiDoc attributes to Jekyll front matter
82
84
  class AsciiDocPreprocessor < Generator
83
85
  def generate(site)
84
- asciidoc_converter = site.getConverterImpl(Jekyll::Converters::AsciiDocConverter)
86
+ asciidoc_converter = JEKYLL_MIN_VERSION_3 ?
87
+ site.find_converter_instance(Jekyll::Converters::AsciiDocConverter) :
88
+ site.getConverterImpl(Jekyll::Converters::AsciiDocConverter)
85
89
  asciidoc_converter.setup
86
90
  key_prefix = (site.config['asciidoc_key_prefix'] || 'jekyll-')
87
91
  key_prefix_len = key_prefix.length
@@ -108,8 +112,8 @@ module Jekyll
108
112
  end
109
113
  end
110
114
  end
111
- site.posts.each do |post|
112
- if asciidoc_converter.matches(post.ext)
115
+ (JEKYLL_MIN_VERSION_3 ? site.posts.docs : site.posts).each do |post|
116
+ if asciidoc_converter.matches(JEKYLL_MIN_VERSION_3 ? post.data['ext'] : post.ext)
113
117
  doc = asciidoc_converter.load(post.content)
114
118
  next if doc.nil?
115
119
 
@@ -146,7 +150,9 @@ module Jekyll
146
150
  # Returns the HTML formatted String.
147
151
  def asciidocify(input)
148
152
  site = @context.registers[:site]
149
- converter = site.getConverterImpl(Jekyll::Converters::AsciiDocConverter)
153
+ converter = JEKYLL_MIN_VERSION_3 ?
154
+ site.find_converter_instance(Jekyll::Converters::AsciiDocConverter) :
155
+ site.getConverterImpl(Jekyll::Converters::AsciiDocConverter)
150
156
  converter.convert(input)
151
157
  end
152
158
  end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module AsciiDoc
3
+ VERSION = '1.0.1'
4
+ end
5
+ end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-asciidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
- - Paul Rayner
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: asciidoctor
@@ -25,6 +24,20 @@ dependencies:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  version: 0.1.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
28
41
  - !ruby/object:Gem::Dependency
29
42
  name: jekyll
30
43
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +56,6 @@ description: A Jekyll plugin that converts AsciiDoc files in your site source to
43
56
  pages using Asciidoctor.
44
57
  email:
45
58
  - dan.j.allen@gmail.com
46
- - paul@virtual-genius.com
47
59
  executables: []
48
60
  extensions: []
49
61
  extra_rdoc_files: []
@@ -52,6 +64,7 @@ files:
52
64
  - README.adoc
53
65
  - Rakefile
54
66
  - lib/jekyll-asciidoc.rb
67
+ - lib/jekyll-asciidoc/version.rb
55
68
  homepage: https://github.com/asciidoctor/jekyll-asciidoc
56
69
  licenses:
57
70
  - MIT
@@ -72,10 +85,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
85
  version: '0'
73
86
  requirements: []
74
87
  rubyforge_project:
75
- rubygems_version: 2.2.2
88
+ rubygems_version: 2.5.1
76
89
  signing_key:
77
90
  specification_version: 4
78
91
  summary: A Jekyll plugin that converts AsciiDoc files in your site source to HTML
79
92
  pages using Asciidoctor.
80
93
  test_files: []
81
- has_rdoc: