jekyll-asciidoc 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.adoc +6 -0
- data/README.adoc +2 -1
- data/lib/jekyll-asciidoc/converter.rb +3 -2
- data/lib/jekyll-asciidoc/integrator.rb +3 -5
- data/lib/jekyll-asciidoc/version.rb +1 -1
- data/spec/fixtures/basic_site/with-front-matter-header-only.adoc +4 -0
- data/spec/fixtures/front_matter_defaults/_config.yml +10 -0
- data/spec/fixtures/front_matter_defaults/_layouts/docs.html +15 -0
- data/spec/fixtures/front_matter_defaults/_layouts/general.html +15 -0
- data/spec/fixtures/front_matter_defaults/docs/page.adoc +3 -0
- data/spec/fixtures/front_matter_defaults/page.adoc +3 -0
- data/spec/jekyll-asciidoc_spec.rb +30 -0
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 700e623dddf15c30365dc58b3a9c59edaba9d852682d03436e10442e1edc8627
|
4
|
+
data.tar.gz: 3a3daa57c865884b73bf6dfdc4002381954adb3d284905d67dea1840d9597806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9307232a92356f4a83f73b0b40f2ab919dabf3c7c05351ba6f27e9f7fda2e9ba3e5d2d012d7531dd9d4282c5d8360619bd915aa44217fc63e1b0dee54167b9fd
|
7
|
+
data.tar.gz: 431a2f10d4871ed4db7465620a25eb617e90196d5ff481ba9a7676df462ac0772be216222db05dc67ad5f3412a7658869f0c55701b82c45bdd0b53006d1d07a0
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,12 @@
|
|
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.1 (2018-11-08) - @mojavelinux
|
9
|
+
|
10
|
+
* honor layout defined in frontmatter defaults (#187)
|
11
|
+
* don't call nil_or_empty? outside of an Asciidoctor context (#142)
|
12
|
+
* handle case when document body is empty (#179)
|
13
|
+
|
8
14
|
== 2.1.0 (2017-05-21) - @mojavelinux
|
9
15
|
|
10
16
|
* Add `tocify_asciidoc` Liquid filter for generating a table of contents from the parsed AsciiDoc document (Jekyll 3+ only) (#37)
|
data/README.adoc
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
= Jekyll AsciiDoc Plugin (powered by Asciidoctor)
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Paul Rayner <https://github.com/paulrayner[@paulrayner]>
|
3
|
+
v2.1.1, 2018-11-08
|
3
4
|
v2.1.0, 2017-05-21
|
4
5
|
// Settings:
|
5
6
|
:idprefix:
|
@@ -206,7 +207,7 @@ To review, here are the different ways to specify a layout using the AsciiDoc at
|
|
206
207
|
* `:page-layout: info` -- use the layout named `info` (e.g., [.path]__layout/info.html_)
|
207
208
|
* _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)
|
208
209
|
* `:!page-layout:` or `:page-layout: false` -- don't use a layout; instead, generate a standalone HTML document
|
209
|
-
* `:page-layout: ~` -- don't use a layout (often
|
210
|
+
* `:page-layout: ~` or `:page-layout: none` -- don't use a layout or create a standalone HTML document (often produces an HTML fragment); the `~` value only works when defined as an AsciiDoc page attribute; otherwise, the value `none` must be used
|
210
211
|
|
211
212
|
=== Implicit Page Variables
|
212
213
|
|
@@ -181,7 +181,7 @@ module Jekyll
|
|
181
181
|
setup
|
182
182
|
record_paths document, source_only: true if defined? ::Jekyll::Hooks
|
183
183
|
# NOTE merely an optimization; if this doesn't match, the header still gets isolated by the processor
|
184
|
-
header = (document.content.split HeaderBoundaryRx, 2)[0]
|
184
|
+
header = (document.content.split HeaderBoundaryRx, 2)[0] || ''
|
185
185
|
case @asciidoc_config['processor']
|
186
186
|
when 'asciidoctor'
|
187
187
|
opts = @asciidoctor_config.merge parse_header_only: true
|
@@ -204,7 +204,8 @@ module Jekyll
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def convert content
|
207
|
-
|
207
|
+
# NOTE don't use nil_or_empty? since that's only provided only by Asciidoctor
|
208
|
+
return '' unless content && !content.empty?
|
208
209
|
setup
|
209
210
|
if (standalone = content.start_with? StandaloneOptionLine)
|
210
211
|
content = content[StandaloneOptionLine.length..-1]
|
@@ -56,7 +56,7 @@ module Jekyll
|
|
56
56
|
# Returns a [Boolean] indicating whether the document should be published.
|
57
57
|
def integrate document, collection_name = nil
|
58
58
|
data = document.data
|
59
|
-
document.content = [%(:#{@page_attr_prefix}layout: _auto), document.content] * NewLine unless data
|
59
|
+
document.content = [%(:#{@page_attr_prefix}layout: _auto), document.content] * NewLine unless data['layout']
|
60
60
|
return true unless (doc = @converter.load_header document)
|
61
61
|
|
62
62
|
# NOTE id is already reserved in Jekyll for another purpose, so we'll map id to docid instead
|
@@ -93,7 +93,7 @@ module Jekyll
|
|
93
93
|
layout = collection_name ? (collection_name.chomp 's') : 'page'
|
94
94
|
data['layout'] = (document.site.layouts.key? layout) ? layout : 'default'
|
95
95
|
when false
|
96
|
-
data
|
96
|
+
data['layout'] = 'none'
|
97
97
|
document.content = %(#{StandaloneOptionLine}#{document.content})
|
98
98
|
end
|
99
99
|
|
@@ -107,9 +107,7 @@ module Jekyll
|
|
107
107
|
unless (css_dir = (attrs['stylesdir'] || '').chomp '@').empty? || (css_dir.start_with? '/')
|
108
108
|
css_dir = %(/#{css_dir})
|
109
109
|
end
|
110
|
-
|
111
|
-
css_name = 'asciidoc-pygments.css'
|
112
|
-
end
|
110
|
+
css_name = attrs['pygments-stylesheet'] || 'asciidoc-pygments.css'
|
113
111
|
css_file = ::File.join css_base, css_dir, css_name
|
114
112
|
css_style = (attrs['pygments-style'] || 'vs').chomp '@'
|
115
113
|
css = ::Asciidoctor::Stylesheets.instance.pygments_stylesheet_data css_style
|
@@ -446,6 +446,14 @@ describe 'Jekyll::AsciiDoc' do
|
|
446
446
|
expect(contents).to include('<p>Lorem ipsum.</p>')
|
447
447
|
end
|
448
448
|
|
449
|
+
it 'should convert an AsciiDoc file with only a front matter header' do
|
450
|
+
file = output_file 'with-front-matter-header-only.html'
|
451
|
+
expect(::File).to exist(file)
|
452
|
+
contents = ::File.read file
|
453
|
+
expect(contents).to include('<title>Front Matter Only</title>')
|
454
|
+
expect(contents).to include(%(<div class="page-content">\n\n</div>))
|
455
|
+
end
|
456
|
+
|
449
457
|
it 'should apply explicit id and role attributes on section titles' do
|
450
458
|
file = output_file 'section-with-id-and-role.html'
|
451
459
|
expect(::File).to exist(file)
|
@@ -633,6 +641,28 @@ describe 'Jekyll::AsciiDoc' do
|
|
633
641
|
end
|
634
642
|
end
|
635
643
|
|
644
|
+
describe 'use front matter defaults' do
|
645
|
+
let :name do
|
646
|
+
'front_matter_defaults'
|
647
|
+
end
|
648
|
+
|
649
|
+
before(:each) { site.process }
|
650
|
+
|
651
|
+
it 'should use the layout for the default scope when no layout is specified' do
|
652
|
+
file = output_file 'page.html'
|
653
|
+
expect(::File).to exist(file)
|
654
|
+
contents = ::File.read file
|
655
|
+
expect(contents).to include('<p>Footer for general layout.</p>')
|
656
|
+
end
|
657
|
+
|
658
|
+
it 'should use the layout for the matching scope when no layout is specified' do
|
659
|
+
file = output_file 'docs/page.html'
|
660
|
+
expect(::File).to exist(file)
|
661
|
+
contents = ::File.read file
|
662
|
+
expect(contents).to include('<p>Footer for docs layout.</p>')
|
663
|
+
end
|
664
|
+
end
|
665
|
+
|
636
666
|
describe 'require front matter header' do
|
637
667
|
let :name do
|
638
668
|
'require_front_matter_header'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-asciidoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- spec/fixtures/basic_site/standalone-a.adoc
|
113
113
|
- spec/fixtures/basic_site/standalone-b.adoc
|
114
114
|
- spec/fixtures/basic_site/subdir/page-in-subdir.adoc
|
115
|
+
- spec/fixtures/basic_site/with-front-matter-header-only.adoc
|
115
116
|
- spec/fixtures/basic_site/with-front-matter-header.adoc
|
116
117
|
- spec/fixtures/basic_site/without-front-matter-header.adoc
|
117
118
|
- spec/fixtures/blank_page_attribute_prefix/_config.yml
|
@@ -126,6 +127,11 @@ files:
|
|
126
127
|
- spec/fixtures/fallback_to_default_layout/_layouts/default.html
|
127
128
|
- spec/fixtures/fallback_to_default_layout/_posts/2016-01-01-post.adoc
|
128
129
|
- spec/fixtures/fallback_to_default_layout/home.adoc
|
130
|
+
- spec/fixtures/front_matter_defaults/_config.yml
|
131
|
+
- spec/fixtures/front_matter_defaults/_layouts/docs.html
|
132
|
+
- spec/fixtures/front_matter_defaults/_layouts/general.html
|
133
|
+
- spec/fixtures/front_matter_defaults/docs/page.adoc
|
134
|
+
- spec/fixtures/front_matter_defaults/page.adoc
|
129
135
|
- spec/fixtures/hybrid_config/_config.yml
|
130
136
|
- spec/fixtures/imagesdir_relative_to_root/_config.yml
|
131
137
|
- spec/fixtures/include_relative_to_docdir/_config.yml
|
@@ -204,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
210
|
version: '0'
|
205
211
|
requirements: []
|
206
212
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
213
|
+
rubygems_version: 2.7.8
|
208
214
|
signing_key:
|
209
215
|
specification_version: 4
|
210
216
|
summary: A Jekyll plugin that converts the AsciiDoc source files in your site to HTML
|
@@ -233,6 +239,7 @@ test_files:
|
|
233
239
|
- spec/fixtures/basic_site/standalone-a.adoc
|
234
240
|
- spec/fixtures/basic_site/standalone-b.adoc
|
235
241
|
- spec/fixtures/basic_site/subdir/page-in-subdir.adoc
|
242
|
+
- spec/fixtures/basic_site/with-front-matter-header-only.adoc
|
236
243
|
- spec/fixtures/basic_site/with-front-matter-header.adoc
|
237
244
|
- spec/fixtures/basic_site/without-front-matter-header.adoc
|
238
245
|
- spec/fixtures/blank_page_attribute_prefix/_config.yml
|
@@ -247,6 +254,11 @@ test_files:
|
|
247
254
|
- spec/fixtures/fallback_to_default_layout/_layouts/default.html
|
248
255
|
- spec/fixtures/fallback_to_default_layout/_posts/2016-01-01-post.adoc
|
249
256
|
- spec/fixtures/fallback_to_default_layout/home.adoc
|
257
|
+
- spec/fixtures/front_matter_defaults/_config.yml
|
258
|
+
- spec/fixtures/front_matter_defaults/_layouts/docs.html
|
259
|
+
- spec/fixtures/front_matter_defaults/_layouts/general.html
|
260
|
+
- spec/fixtures/front_matter_defaults/docs/page.adoc
|
261
|
+
- spec/fixtures/front_matter_defaults/page.adoc
|
250
262
|
- spec/fixtures/hybrid_config/_config.yml
|
251
263
|
- spec/fixtures/imagesdir_relative_to_root/_config.yml
|
252
264
|
- spec/fixtures/include_relative_to_docdir/_config.yml
|