asciidoctor-html5s 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +1 -1
- data/asciidoctor-html5s.gemspec +3 -4
- data/data/templates/_header.html.slim +1 -1
- data/data/templates/document.html.slim +12 -4
- data/data/templates/embedded.html.slim +1 -1
- data/data/templates/example.html.slim +11 -3
- data/data/templates/helpers.rb +85 -57
- data/data/templates/inline_anchor.html.slim +3 -5
- data/data/templates/inline_quoted.html.slim +11 -13
- data/data/templates/listing.html.slim +8 -4
- data/data/templates/olist.html.slim +1 -1
- data/data/templates/outline.html.slim +1 -1
- data/data/templates/table.html.slim +6 -8
- data/data/templates/ulist.html.slim +2 -2
- data/data/templates/video.html.slim +1 -0
- data/lib/asciidoctor/html5s.rb +4 -0
- data/lib/asciidoctor/html5s/attached_colist_treeprocessor.rb +2 -0
- data/lib/asciidoctor/html5s/converter.rb +148 -105
- data/lib/asciidoctor/html5s/html_pipeline_highlighter.rb +31 -0
- data/lib/asciidoctor/html5s/version.rb +1 -1
- metadata +9 -23
- data/lib/asciidoctor/html5s/logger.rb +0 -21
@@ -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
|
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.
|
4
|
+
version: 0.4.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: 2020-
|
11
|
+
date: 2020-04-06 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.
|
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.
|
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.
|
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.
|
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: '
|
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: '
|
116
|
+
version: '13.0'
|
131
117
|
- !ruby/object:Gem::Dependency
|
132
118
|
name: slim
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +206,7 @@ files:
|
|
220
206
|
- lib/asciidoctor/html5s.rb
|
221
207
|
- lib/asciidoctor/html5s/attached_colist_treeprocessor.rb
|
222
208
|
- lib/asciidoctor/html5s/converter.rb
|
223
|
-
- lib/asciidoctor/html5s/
|
209
|
+
- lib/asciidoctor/html5s/html_pipeline_highlighter.rb
|
224
210
|
- lib/asciidoctor/html5s/replacements.rb
|
225
211
|
- lib/asciidoctor/html5s/version.rb
|
226
212
|
homepage: https://github.com/jirutka/asciidoctor-html5s
|
@@ -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
|