asciidoctor-include-ext 0.2.0 → 0.3.0

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.

Potentially problematic release.


This version of asciidoctor-include-ext might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 426f9fc65b85c68d988632d3b123f9e21ed8f539bed5cb8dfb389b9bf9bcc066
4
- data.tar.gz: bb40b284130e5c1bc0f6774471da10e0405b1240dbbec51ff05d9be568cd8c70
3
+ metadata.gz: c09062c7f60a41e49ba4ce647bc0301b677c05bf09ef6f9a5125db7a00df851d
4
+ data.tar.gz: 186ad2f7d1acb06b4ebe019abd53df04ca566d023d48193fdf5614babeb01002
5
5
  SHA512:
6
- metadata.gz: 5418ef883794df0cf2df411516592c58a058e5a7a8b13bf1d9130aba246a62630752748b1056413d82c48d2196454dbf25c75fabda3001132d02d99feb9ce5d6
7
- data.tar.gz: 1aa743cb0820f82f3d670ae44649ce4e20f385a68a08110fb213ac63aa9b0cd21d1d8f4835c315be728463a85e2d2f9b969eaf17cef558969424b2b4f403107c
6
+ metadata.gz: 2060b533b60f107692a4e4080d48ee9b90293e45aa0f424184bc83832337f354bbc74d0b5375be68dad335545f33be2718daa9392c37241b442d16c60c654fbd
7
+ data.tar.gz: b24613a918ab75e405eac251d369d34806385285cd7d97bc75ae2f6ba63ced3fa45604e4e93174b0574df9cd4dd6445680094d54007577fa7678ec8b82c15dcc
@@ -5,6 +5,7 @@ require 'open-uri'
5
5
  require 'asciidoctor/include_ext/version'
6
6
  require 'asciidoctor/include_ext/reader_ext'
7
7
  require 'asciidoctor/include_ext/lineno_lines_selector'
8
+ require 'asciidoctor/include_ext/logging'
8
9
  require 'asciidoctor/include_ext/tag_lines_selector'
9
10
  require 'asciidoctor'
10
11
  require 'asciidoctor/extensions'
@@ -22,7 +23,7 @@ module Asciidoctor::IncludeExt
22
23
  # @param logger [Logger] the logger to use for logging warning and errors
23
24
  # from this object and selectors.
24
25
  def initialize(selectors: [LinenoLinesSelector, TagLinesSelector],
25
- logger: Logger.new(STDERR), **)
26
+ logger: Logging.default_logger, **)
26
27
  super
27
28
  @selectors = selectors.dup.freeze
28
29
  @logger = logger
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ require 'logger'
3
+ require 'asciidoctor'
4
+ require 'asciidoctor/include_ext/version'
5
+
6
+ module Asciidoctor::IncludeExt
7
+ # Helper module for getting default Logger based on the Asciidoctor version.
8
+ module Logging
9
+ module_function
10
+
11
+ # @return [Logger] the default `Asciidoctor::Logger` if using Asciidoctor
12
+ # 1.5.7 or later, or Ruby's `Logger` that outputs to `STDERR`.
13
+ def default_logger
14
+ if defined? ::Asciidoctor::LoggerManager
15
+ ::Asciidoctor::LoggerManager.logger
16
+ else
17
+ ::Logger.new(STDERR)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -4,6 +4,7 @@ require 'set'
4
4
 
5
5
  require 'asciidoctor'
6
6
  require 'asciidoctor/include_ext/version'
7
+ require 'asciidoctor/include_ext/logging'
7
8
 
8
9
  module Asciidoctor::IncludeExt
9
10
  # Lines selector that selects lines of the content based on the specified tags.
@@ -39,7 +40,7 @@ module Asciidoctor::IncludeExt
39
40
  # @param attributes [Hash<String, String>] the attributes parsed from the
40
41
  # `include::[]`s attributes slot. It must contain a key `"tag"` or `"tags"`.
41
42
  # @param logger [Logger]
42
- def initialize(target, attributes, logger: Logger.new(STDERR), **)
43
+ def initialize(target, attributes, logger: Logging.default_logger, **)
43
44
  tag_flags =
44
45
  if attributes.key? 'tag'
45
46
  parse_attribute(attributes['tag'], true)
@@ -3,6 +3,6 @@
3
3
  module Asciidoctor
4
4
  module IncludeExt
5
5
  # Version of the asciidoctor-include-ext gem.
6
- VERSION = '0.2.0'.freeze
6
+ VERSION = '0.3.0'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-include-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Jirutka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -140,6 +140,7 @@ files:
140
140
  - lib/asciidoctor/include_ext.rb
141
141
  - lib/asciidoctor/include_ext/include_processor.rb
142
142
  - lib/asciidoctor/include_ext/lineno_lines_selector.rb
143
+ - lib/asciidoctor/include_ext/logging.rb
143
144
  - lib/asciidoctor/include_ext/reader_ext.rb
144
145
  - lib/asciidoctor/include_ext/tag_lines_selector.rb
145
146
  - lib/asciidoctor/include_ext/version.rb