asciidoctor-html5s 0.3.0 → 0.5.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.
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Asciidoctor::Html5s
4
+
5
+ # Modification of Asciidoctor::SyntaxHighlighter::HtmlPipelineAdapter that
6
+ # uses attribute `data-lang` instead of `lang`.
7
+ #
8
+ # Rationale: Attribute `lang` is defined for natural language of text, not
9
+ # for programming languages.
10
+ class HtmlPipelineHighlighter < ::Asciidoctor::SyntaxHighlighter::Base
11
+ register_for 'html-pipeline'
12
+
13
+ def initialize(name, backend, opts = {})
14
+ super
15
+ # Use this version of the #format method only for our backend, otherwise
16
+ # use the original variant.
17
+ singleton_class.send(:alias_method, :format, :format_orig) if backend != 'html5s'
18
+ end
19
+
20
+ def format(node, lang, _opts)
21
+ %(<pre><code#{%{ data-lang="#{lang}"} if lang}>#{node.content}</code></pre>)
22
+ end
23
+
24
+ # Copied from Asciidoctor::SyntaxHighlighter::HtmlPipelineAdapter#format.
25
+ # Note: HtmlPipelineAdapter is not available in asciidoctor.js, that's why
26
+ # it's done like this instead of delegation or inheritance.
27
+ def format_orig(node, lang, _opts)
28
+ %(<pre#{%{ lang="#{lang}"} if lang}><code>#{node.content}</code></pre>)
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Html5s
5
- VERSION = '0.3.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-html5s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Jirutka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-13 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.5
19
+ version: 1.5.7
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '3.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.5
29
+ version: 1.5.7
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3.0'
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0.beta.6
53
+ version: 2.0.0.beta.7
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 2.0.0.beta.6
60
+ version: 2.0.0.beta.7
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: asciidoctor-templates-compiler
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '1.6'
89
- - !ruby/object:Gem::Dependency
90
- name: coderay
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '1.1'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '1.1'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: pandoc-ruby
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +106,14 @@ dependencies:
120
106
  requirements:
121
107
  - - "~>"
122
108
  - !ruby/object:Gem::Version
123
- version: '12.0'
109
+ version: '13.0'
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - "~>"
129
115
  - !ruby/object:Gem::Version
130
- version: '12.0'
116
+ version: '13.0'
131
117
  - !ruby/object:Gem::Dependency
132
118
  name: slim
133
119
  requirement: !ruby/object:Gem::Requirement
@@ -172,9 +158,7 @@ files:
172
158
  - data/templates/_attribution.html.slim
173
159
  - data/templates/_footer.html.slim
174
160
  - data/templates/_footnotes.html.slim
175
- - data/templates/_hdlist.html.slim
176
161
  - data/templates/_header.html.slim
177
- - data/templates/_qanda.html.slim
178
162
  - data/templates/_toc.html.slim
179
163
  - data/templates/admonition.html.slim
180
164
  - data/templates/audio.html.slim
@@ -220,7 +204,7 @@ files:
220
204
  - lib/asciidoctor/html5s.rb
221
205
  - lib/asciidoctor/html5s/attached_colist_treeprocessor.rb
222
206
  - lib/asciidoctor/html5s/converter.rb
223
- - lib/asciidoctor/html5s/logger.rb
207
+ - lib/asciidoctor/html5s/html_pipeline_highlighter.rb
224
208
  - lib/asciidoctor/html5s/replacements.rb
225
209
  - lib/asciidoctor/html5s/version.rb
226
210
  homepage: https://github.com/jirutka/asciidoctor-html5s
@@ -242,8 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
226
  - !ruby/object:Gem::Version
243
227
  version: '0'
244
228
  requirements: []
245
- rubyforge_project:
246
- rubygems_version: 2.7.7
229
+ rubygems_version: 3.1.6
247
230
  signing_key:
248
231
  specification_version: 4
249
232
  summary: Semantic HTML5 backend (converter) for Asciidoctor
@@ -1,20 +0,0 @@
1
- = block_with_title :class=>'hdlist'
2
- table
3
- - if (attr? :labelwidth) || (attr? :itemwidth)
4
- colgroup
5
- col style=style_value(width: [(attr :labelwidth), '%'])
6
- col style=style_value(width: [(attr :itemwidth), '%'])
7
- - items.each do |terms, dd|
8
- tr
9
- th.hdlist1 class=('strong' if option? 'strong')
10
- - terms = [*terms]
11
- - terms.each_with_index do |dt, idx|
12
- =dt.text
13
- - unless idx >= terms.count - 1
14
- br
15
- td.hdlist2
16
- - unless dd.nil?
17
- - if dd.text?
18
- p =dd.text
19
- - if dd.blocks?
20
- =dd.content
@@ -1,12 +0,0 @@
1
- = block_with_title :class=>'qlist qanda', :role=>'doc-qna'
2
- dl.qanda
3
- - items.each do |questions, answer|
4
- - [*questions].each do |question|
5
- dt.qanda-question =question.text
6
- - unless answer.nil?
7
- dd.qanda-answer
8
- - if answer.text?
9
- = html_tag_if answer.blocks?, :p
10
- =answer.text
11
- - if answer.blocks?
12
- =answer.content
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'logger' unless RUBY_PLATFORM == 'opal'
3
- require 'asciidoctor' unless RUBY_PLATFORM == 'opal'
4
- require 'asciidoctor/html5s/version'
5
-
6
- module Asciidoctor::Html5s
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