asciidoctor-templates-compiler 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.adoc +3 -5
- data/asciidoctor-templates-compiler.gemspec +3 -3
- data/bin/asciidoctor-templates-compiler +1 -2
- data/lib/asciidoctor/templates_compiler/converter_generator.rb +5 -15
- data/lib/asciidoctor/templates_compiler/version.rb +1 -1
- metadata +11 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 864030a8f7ec20d74c097fd05117aeba9bf59b85a6b827a709396ff1d9c633ed
|
4
|
+
data.tar.gz: 6d10be25f6334171a7ecfca4ca2a643760a4985ae0a0eb72725e3b0c0de21d60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc7113d301ff525f06cf23d6f4ecba39e860b66dd9c4e9b2622da3522adfe7dd4d46ad730a68e90a4845b9cb46d95c4a5045bd9a336881ff7f6f1d67d840aee
|
7
|
+
data.tar.gz: 9768e3952ff6f54a52bc4a19eadefc8c5cf8d8e4ce3f25631b3cf6d90b98203a9c5e0d6ebbc697c08afa2e53afd5908bb37aba32e552fff0bb2428462d40a726
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright 2017-
|
3
|
+
Copyright 2017-present Jakub Jirutka <jakub@jirutka.cz>.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.adoc
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
:source-language: ruby
|
3
3
|
// custom
|
4
4
|
:gem-name: asciidoctor-templates-compiler
|
5
|
-
:gem-version: 0.
|
5
|
+
:gem-version: 0.7.0
|
6
6
|
:gh-name: jirutka/{gem-name}
|
7
7
|
:gh-branch: master
|
8
8
|
:codacy-id: b23b8c6503474ea5b13537eaef0c73d5
|
9
9
|
|
10
10
|
ifdef::env-github[]
|
11
|
-
image:https://
|
11
|
+
image:https://github.com/{gh-name}/workflows/CI/badge.svg[CI Status, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22]
|
12
12
|
image:https://api.codacy.com/project/badge/Coverage/{codacy-id}["Test Coverage", link="https://www.codacy.com/app/{gh-name}"]
|
13
13
|
image:https://api.codacy.com/project/badge/Grade/{codacy-id}["Codacy Code quality", link="https://www.codacy.com/app/{gh-name}"]
|
14
14
|
image:https://img.shields.io/gem/v/{gem-name}.svg?style=flat[Gem Version, link="https://rubygems.org/gems/{gem-name}"]
|
@@ -16,8 +16,6 @@ endif::env-github[]
|
|
16
16
|
|
17
17
|
This tool allows to precompile Slim templates into Ruby code and assemble them into a single-file pure Ruby converter (backend).
|
18
18
|
|
19
|
-
TODO
|
20
|
-
|
21
19
|
|
22
20
|
== Installation
|
23
21
|
|
@@ -44,7 +42,7 @@ $ bundle install
|
|
44
42
|
The main entry point is method `Asciidoctor::TemplatesCompiler::Slim#compile_converter` (for Slim) that accepts the following keyword arguments.
|
45
43
|
|
46
44
|
backend_info::
|
47
|
-
A hash of keys for `backend_info`: `basebackend`, `outfilesuffix`, `filetype`, `htmlsyntax`, `supports_templates
|
45
|
+
A hash of keys for `backend_info`: `basebackend`, `outfilesuffix`, `filetype`, `htmlsyntax`, `supports_templates`.
|
48
46
|
|
49
47
|
class_name::
|
50
48
|
Full name of the converter class to generate (e.g. `My::HTML::Converter`).
|
@@ -15,13 +15,13 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.required_ruby_version = '>= 2.1'
|
17
17
|
|
18
|
-
s.add_runtime_dependency 'asciidoctor', '
|
18
|
+
s.add_runtime_dependency 'asciidoctor', '~> 2.0'
|
19
19
|
s.add_runtime_dependency 'corefines', '~> 1.2'
|
20
20
|
s.add_runtime_dependency 'docopt', '~> 0.6'
|
21
|
-
s.add_runtime_dependency 'slim', '>= 2.1', '<
|
21
|
+
s.add_runtime_dependency 'slim', '>= 2.1', '< 6.0'
|
22
22
|
s.add_runtime_dependency 'ruby-beautify2', '~> 0.98'
|
23
23
|
|
24
|
-
s.add_development_dependency 'rake', '~>
|
24
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
25
25
|
s.add_development_dependency 'rspec', '~> 3.6'
|
26
26
|
s.add_development_dependency 'rubocop', '~> 0.49.0'
|
27
27
|
s.add_development_dependency 'simplecov', '~> 0.14'
|
@@ -22,8 +22,7 @@ HELP_MSG = <<-EOF.unindent
|
|
22
22
|
|
23
23
|
Options:
|
24
24
|
-b --backend-info KEY=VAL[,...] Parameters for backend_info: basebackend, outfilesuffix,
|
25
|
-
filetype, htmlsyntax, and supports_templates
|
26
|
-
Asciidoctor >= 1.5.7).
|
25
|
+
filetype, htmlsyntax, and supports_templates.
|
27
26
|
|
28
27
|
-n --class-name NAME Full name of the converter class to generate (e.g.
|
29
28
|
My::HTML::Converter) [default: Converter].
|
@@ -72,7 +72,6 @@ module Asciidoctor::TemplatesCompiler
|
|
72
72
|
out << helpers_code << "\n" unless @helpers_code.blank?
|
73
73
|
out << initialization_code << "\n"
|
74
74
|
out << convert_method_code << "\n"
|
75
|
-
out << handles_method_code << "\n"
|
76
75
|
transform_methods_code(out)
|
77
76
|
out << support_methods_code << "\n"
|
78
77
|
out << tail_code
|
@@ -151,35 +150,26 @@ module Asciidoctor::TemplatesCompiler
|
|
151
150
|
|
152
151
|
def convert_method_code
|
153
152
|
converter = if @delegate_backend
|
154
|
-
'respond_to?(
|
153
|
+
'respond_to?(meth_name) ? self : @delegate_converter'
|
155
154
|
else
|
156
155
|
'self'
|
157
156
|
end
|
158
157
|
|
159
158
|
<<-EOF.reindent(2)
|
160
159
|
def convert(node, transform = nil, opts = {})
|
161
|
-
transform
|
160
|
+
meth_name = "convert_\#{transform || node.node_name}"
|
162
161
|
opts ||= {}
|
163
162
|
converter = #{converter}
|
164
163
|
|
165
164
|
if opts.empty?
|
166
|
-
converter.send(
|
165
|
+
converter.send(meth_name, node)
|
167
166
|
else
|
168
|
-
converter.send(
|
167
|
+
converter.send(meth_name, node, opts)
|
169
168
|
end
|
170
169
|
end
|
171
170
|
EOF
|
172
171
|
end
|
173
172
|
|
174
|
-
# This is for compatibility with Asciidoctor >=2.0.0 (see #5).
|
175
|
-
def handles_method_code
|
176
|
-
<<-EOF.reindent(2)
|
177
|
-
def handles?(transform)
|
178
|
-
respond_to?("convert_\#{transform}") || respond_to?(transform)
|
179
|
-
end
|
180
|
-
EOF
|
181
|
-
end
|
182
|
-
|
183
173
|
def support_methods_code
|
184
174
|
return '' if @ignore_convert_opts
|
185
175
|
|
@@ -197,7 +187,7 @@ module Asciidoctor::TemplatesCompiler
|
|
197
187
|
|
198
188
|
@transforms_code.each do |name, code|
|
199
189
|
out << "\n"
|
200
|
-
out << " def #{name}(node, opts = {})\n"
|
190
|
+
out << " def convert_#{name}(node, opts = {})\n"
|
201
191
|
out << " node.extend(Helpers)\n" unless @helpers_code.blank?
|
202
192
|
out << " node.instance_eval do\n"
|
203
193
|
out << " converter.set_local_variables(binding, opts) unless opts.empty?\n" unless @ignore_convert_opts # rubocop:disable LineLength
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-templates-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.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:
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.0
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2.
|
19
|
+
version: '2.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.5.0
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2.
|
26
|
+
version: '2.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: corefines
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +61,7 @@ dependencies:
|
|
67
61
|
version: '2.1'
|
68
62
|
- - "<"
|
69
63
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
64
|
+
version: '6.0'
|
71
65
|
type: :runtime
|
72
66
|
prerelease: false
|
73
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -77,7 +71,7 @@ dependencies:
|
|
77
71
|
version: '2.1'
|
78
72
|
- - "<"
|
79
73
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
74
|
+
version: '6.0'
|
81
75
|
- !ruby/object:Gem::Dependency
|
82
76
|
name: ruby-beautify2
|
83
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,14 +92,14 @@ dependencies:
|
|
98
92
|
requirements:
|
99
93
|
- - "~>"
|
100
94
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
95
|
+
version: '13.0'
|
102
96
|
type: :development
|
103
97
|
prerelease: false
|
104
98
|
version_requirements: !ruby/object:Gem::Requirement
|
105
99
|
requirements:
|
106
100
|
- - "~>"
|
107
101
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
102
|
+
version: '13.0'
|
109
103
|
- !ruby/object:Gem::Dependency
|
110
104
|
name: rspec
|
111
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,8 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
181
|
- !ruby/object:Gem::Version
|
188
182
|
version: '0'
|
189
183
|
requirements: []
|
190
|
-
|
191
|
-
rubygems_version: 2.7.7
|
184
|
+
rubygems_version: 3.4.10
|
192
185
|
signing_key:
|
193
186
|
specification_version: 4
|
194
187
|
summary: Compile templates-based Asciidoctor converter (backend) into a single Ruby
|