avm-eac_asciidoctor_base0 0.22.1 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_asciidoctor_base0/documents_owner.rb +1 -1
- data/lib/avm/eac_asciidoctor_base0/instances/build/document/body_target.rb +10 -0
- data/lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb +15 -6
- data/lib/avm/eac_asciidoctor_base0/instances/build/theme.rb +41 -0
- data/lib/avm/eac_asciidoctor_base0/instances/build.rb +10 -1
- data/lib/avm/eac_asciidoctor_base0/logging/catcher.rb +47 -0
- data/lib/avm/eac_asciidoctor_base0/logging/error.rb +18 -0
- data/lib/avm/eac_asciidoctor_base0/logging.rb +11 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +6 -0
- data/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- metadata +42 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a2fbf3a41bc705973e5d72606bb82f9e490c2dc1be92e69374c1daaaede203
|
4
|
+
data.tar.gz: bae73a31143d7ab4f3bcd3b792087780b72a613173828751341ed7e0280345a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9de587064b412d52b4d081780f484edb1112544edcbd2c7fbce3c77098136e76246f328063b751bd41baefaaff03b7ea5767f9c9082351ec73aecdf484e594
|
7
|
+
data.tar.gz: 90eee15a5f8dfb0a8aeb93c947d3b29c0e6a6cce830ab5d4915126af4cc14c2a8358a98eaa314ee2c0ae42c19bb7e9b32859a76e3d6b99d7fd352ee0a6c85a43
|
@@ -13,7 +13,7 @@ module Avm
|
|
13
13
|
# @raise [KeyError]
|
14
14
|
def document(subpath)
|
15
15
|
documents.find { |d| d.subpath.to_pathname == subpath.to_pathname } ||
|
16
|
-
raise(::KeyError, "Document not found with
|
16
|
+
raise(::KeyError, "Document not found with subpath = \"#{subpath}\"")
|
17
17
|
end
|
18
18
|
|
19
19
|
# @return [Enumerable<Avm::EacAsciidoctorBase0::Sources::Document>]
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'asciidoctor'
|
4
4
|
require 'avm/eac_asciidoctor_base0/instances/macros'
|
5
|
+
require 'avm/eac_asciidoctor_base0/logging/catcher'
|
5
6
|
require 'eac_ruby_utils/core_ext'
|
6
7
|
|
7
8
|
module Avm
|
@@ -23,6 +24,15 @@ module Avm
|
|
23
24
|
|
24
25
|
# @return [Asciidoctor::Document]
|
25
26
|
def body_target_write
|
27
|
+
::Avm::EacAsciidoctorBase0::Logging::Catcher.on do
|
28
|
+
body_target_write_without_logging_catch
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
# @return [Asciidoctor::Document]
|
35
|
+
def body_target_write_without_logging_catch
|
26
36
|
::Asciidoctor.convert(
|
27
37
|
pre_processed_body_source_content,
|
28
38
|
base_dir: convert_base_dir,
|
@@ -56,17 +56,17 @@ module Avm
|
|
56
56
|
breadcrumbs_lines
|
57
57
|
end
|
58
58
|
|
59
|
+
# @return [Pathname]
|
60
|
+
def relative_path_to_stylesheet
|
61
|
+
build.theme.target_stylesheet_path
|
62
|
+
.relative_path_from(document.body_target_path.dirname)
|
63
|
+
end
|
64
|
+
|
59
65
|
# @return [String]
|
60
66
|
def stylesheet_line
|
61
67
|
attribute_line('stylesheet', stylesheet_path)
|
62
68
|
end
|
63
69
|
|
64
|
-
# @return [Pathname]
|
65
|
-
def stylesheet_path
|
66
|
-
source_document.source.theme_stylesheet_path
|
67
|
-
.relative_path_from(document.convert_base_dir)
|
68
|
-
end
|
69
|
-
|
70
70
|
# @return [String]
|
71
71
|
def title_line
|
72
72
|
"= #{source_document.title}"
|
@@ -75,6 +75,15 @@ module Avm
|
|
75
75
|
def website
|
76
76
|
instance.web_url
|
77
77
|
end
|
78
|
+
|
79
|
+
protected
|
80
|
+
|
81
|
+
# @return [Pathname]
|
82
|
+
def stylesheet_path_uncached
|
83
|
+
temp = ::EacRubyUtils::Fs::Temp.file
|
84
|
+
temp.write("@import '#{relative_path_to_stylesheet}'\n")
|
85
|
+
temp.to_pathname
|
86
|
+
end
|
78
87
|
end
|
79
88
|
end
|
80
89
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/instances/macros'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Instances
|
9
|
+
class Build
|
10
|
+
class Theme
|
11
|
+
TARGET_SUBPATH = '_theme'
|
12
|
+
|
13
|
+
common_constructor :build
|
14
|
+
|
15
|
+
# @return [void]
|
16
|
+
def perform
|
17
|
+
copy_theme_to_target
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Pathname]
|
21
|
+
def target_path
|
22
|
+
build.target_directory.join(TARGET_SUBPATH)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Pathname]
|
26
|
+
def target_stylesheet_path
|
27
|
+
target_path
|
28
|
+
.join(Avm::EacAsciidoctorBase0::Sources::Base::Theme::THEME_STYLESHEET_BASENAME)
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
# @return [void]
|
34
|
+
def copy_theme_to_target
|
35
|
+
build.source.copy_theme_directory_to(target_path)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -23,11 +23,13 @@ module Avm
|
|
23
23
|
def perform
|
24
24
|
infov 'Documents to build', root_document.tree_documents_count
|
25
25
|
target_directory.clear
|
26
|
+
theme.perform
|
26
27
|
root_document.perform
|
27
28
|
end
|
28
29
|
|
30
|
+
# @return [Pathname]
|
29
31
|
def default_target_directory
|
30
|
-
source.path.join('build')
|
32
|
+
source.path.join('build/site')
|
31
33
|
end
|
32
34
|
|
33
35
|
def root_document
|
@@ -45,6 +47,13 @@ module Avm
|
|
45
47
|
options[OPTION_TARGET_DIRECTORY] || default_target_directory
|
46
48
|
)
|
47
49
|
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
# @return [Avm::EacAsciidoctorBase0::Instances::Build::Theme]
|
54
|
+
def theme_uncached
|
55
|
+
::Avm::EacAsciidoctorBase0::Instances::Build::Theme.new(self)
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_asciidoctor_base0/logging/error'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Logging
|
9
|
+
class Catcher < ::SimpleDelegator
|
10
|
+
CATCH_LEVEL = ::Logger::ERROR
|
11
|
+
LOGGER_METHODS = %i[unknown fatal error warn info debug].freeze
|
12
|
+
|
13
|
+
class << self
|
14
|
+
# @param [String]
|
15
|
+
# @return [Integer]
|
16
|
+
def level_by_method(method_name)
|
17
|
+
::Logger.const_get(method_name.to_s.underscore.upcase)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Hash<Symbol, Integer]
|
21
|
+
def methods_levels
|
22
|
+
LOGGER_METHODS.to_h { |method_name| [method_name, level_by_method(method_name)] }
|
23
|
+
end
|
24
|
+
|
25
|
+
def on
|
26
|
+
real_logger = ::Asciidoctor::LoggerManager.logger
|
27
|
+
begin
|
28
|
+
::Asciidoctor::LoggerManager.logger = new(real_logger)
|
29
|
+
yield
|
30
|
+
ensure
|
31
|
+
::Asciidoctor::LoggerManager.logger = real_logger
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
methods_levels.each do |method_name, level|
|
37
|
+
define_method method_name do |*args, &block|
|
38
|
+
__getobj__.send(method_name, *args, &block)
|
39
|
+
return unless level >= CATCH_LEVEL
|
40
|
+
|
41
|
+
raise ::Avm::EacAsciidoctorBase0::Logging::Error.new(level, *args, &block)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacAsciidoctorBase0
|
7
|
+
module Logging
|
8
|
+
class Error < ::RuntimeError
|
9
|
+
attr_reader :level
|
10
|
+
|
11
|
+
def initialize(level, *args)
|
12
|
+
@level = level
|
13
|
+
super(*args)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -12,6 +12,12 @@ module Avm
|
|
12
12
|
DEFAULT_THEME_DIRECTORY_SUBPATH = 'theme'
|
13
13
|
THEME_STYLESHEET_BASENAME = 'main.css'
|
14
14
|
|
15
|
+
# @param target_directory_path [Pathname]
|
16
|
+
def copy_theme_directory_to(target_directory_path)
|
17
|
+
target_directory_path.parent.mkpath
|
18
|
+
::FileUtils.copy_entry(theme_directory, target_directory_path)
|
19
|
+
end
|
20
|
+
|
15
21
|
# @return [Pathname]
|
16
22
|
def default_theme_directory
|
17
23
|
path.join(DEFAULT_THEME_DIRECTORY_SUBPATH)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-eac_asciidoctor_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '2.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.0.
|
22
|
+
version: 2.0.23
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,41 +29,69 @@ dependencies:
|
|
29
29
|
version: '2.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.0.
|
32
|
+
version: 2.0.23
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: avm-eac_webapp_base0
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.20'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.20.1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.20'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.20.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: eac_fs
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.18'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.18'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: eac_ruby_gem_support
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.10'
|
74
|
+
type: :runtime
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.10'
|
53
81
|
- !ruby/object:Gem::Dependency
|
54
82
|
name: eac_ruby_utils
|
55
83
|
requirement: !ruby/object:Gem::Requirement
|
56
84
|
requirements:
|
57
85
|
- - "~>"
|
58
86
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
87
|
+
version: '0.122'
|
60
88
|
type: :runtime
|
61
89
|
prerelease: false
|
62
90
|
version_requirements: !ruby/object:Gem::Requirement
|
63
91
|
requirements:
|
64
92
|
- - "~>"
|
65
93
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
94
|
+
version: '0.122'
|
67
95
|
- !ruby/object:Gem::Dependency
|
68
96
|
name: os
|
69
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +174,7 @@ files:
|
|
146
174
|
- lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb
|
147
175
|
- lib/avm/eac_asciidoctor_base0/instances/build/document/media.rb
|
148
176
|
- lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb
|
177
|
+
- lib/avm/eac_asciidoctor_base0/instances/build/theme.rb
|
149
178
|
- lib/avm/eac_asciidoctor_base0/instances/deploy.rb
|
150
179
|
- lib/avm/eac_asciidoctor_base0/instances/macros.rb
|
151
180
|
- lib/avm/eac_asciidoctor_base0/instances/macros/base.rb
|
@@ -153,6 +182,9 @@ files:
|
|
153
182
|
- lib/avm/eac_asciidoctor_base0/instances/macros/child_docs.rb
|
154
183
|
- lib/avm/eac_asciidoctor_base0/instances/macros/child_docs/document_builder.rb
|
155
184
|
- lib/avm/eac_asciidoctor_base0/instances/macros/default_body.rb
|
185
|
+
- lib/avm/eac_asciidoctor_base0/logging.rb
|
186
|
+
- lib/avm/eac_asciidoctor_base0/logging/catcher.rb
|
187
|
+
- lib/avm/eac_asciidoctor_base0/logging/error.rb
|
156
188
|
- lib/avm/eac_asciidoctor_base0/source_generators.rb
|
157
189
|
- lib/avm/eac_asciidoctor_base0/source_generators/base.rb
|
158
190
|
- lib/avm/eac_asciidoctor_base0/sources.rb
|