jekyll-asciidoc 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c4135124b7d7842c3e199e5208d4c267e87a259d
4
- data.tar.gz: 0d4051c81249eb6259e97bab4a0dc3c91c1e881b
2
+ SHA256:
3
+ metadata.gz: 700e623dddf15c30365dc58b3a9c59edaba9d852682d03436e10442e1edc8627
4
+ data.tar.gz: 3a3daa57c865884b73bf6dfdc4002381954adb3d284905d67dea1840d9597806
5
5
  SHA512:
6
- metadata.gz: f18fd97d2472bec92a0ddecaaca4fd6d31a10f5620ade52f81e6f20fc00e1adf4c4d4410c06864cbb1bdffab4dcb2a64f6762db4363c0d5b678f8f3c5a7e680c
7
- data.tar.gz: f377c0cfc83c0ca2edd23009011412aacbd7f302d6d636e064d9699a867ec4681b82eed07fadc1ba6982a6b7608f2a9eb6178153c781063fdf4da19c9a7c722e
6
+ metadata.gz: 9307232a92356f4a83f73b0b40f2ab919dabf3c7c05351ba6f27e9f7fda2e9ba3e5d2d012d7531dd9d4282c5d8360619bd915aa44217fc63e1b0dee54167b9fd
7
+ data.tar.gz: 431a2f10d4871ed4db7465620a25eb617e90196d5ff481ba9a7676df462ac0772be216222db05dc67ad5f3412a7658869f0c55701b82c45bdd0b53006d1d07a0
@@ -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)
@@ -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 results in an incomplete HTML file)
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
- return '' if content.nil_or_empty?
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.key? 'layout'
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.delete 'layout'
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
- if (css_name = attrs['pygments-stylesheet']).nil_or_empty?
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
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AsciiDoc
3
- VERSION = '2.1.0'
3
+ VERSION = '2.1.1'
4
4
  end
5
5
  end
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Front Matter Only
3
+ layout: page
4
+ ---
@@ -0,0 +1,10 @@
1
+ gems:
2
+ - jekyll-asciidoc
3
+ defaults:
4
+ - values:
5
+ layout: general
6
+ - scope:
7
+ path: docs
8
+ type: pages
9
+ values:
10
+ layout: docs
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>{{ page.title }}</title>
6
+ </head>
7
+ <body>
8
+ <div class="page-content">
9
+ {{ content }}
10
+ </div>
11
+ <footer>
12
+ <p>Footer for docs layout.</p>
13
+ </footer>
14
+ </body>
15
+ </html>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>{{ page.title }}</title>
6
+ </head>
7
+ <body>
8
+ <div class="page-content">
9
+ {{ content }}
10
+ </div>
11
+ <footer>
12
+ <p>Footer for general layout.</p>
13
+ </footer>
14
+ </body>
15
+ </html>
@@ -0,0 +1,3 @@
1
+ = Docs Page
2
+
3
+ Content of docs page.
@@ -0,0 +1,3 @@
1
+ = General Page
2
+
3
+ Content of general page.
@@ -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.0
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: 2017-05-21 00:00:00.000000000 Z
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.4.5
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