avm-eac_asciidoctor_base0 0.10.0 → 0.11.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/instances/build/document/header_macro_value.rb +24 -5
- data/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +13 -26
- data/lib/avm/eac_asciidoctor_base0/instances/build.rb +3 -1
- data/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +1 -1
- data/lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb +28 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +47 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +40 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base.rb +7 -0
- data/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +0 -1
- data/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +1 -0
- data/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fedf83f89dc4a475b21c86075c5c712cbc860cd99fdf5e883696bf68f7df37e5
|
4
|
+
data.tar.gz: 40c9413c0a65301d1ac7fee6f06ed91cc9d7f354af23a608c9d69fab7c40c3f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab3202bc90bfd3d1adf57a1eb652d279d6a65ed482fa3fe74c3ab9daff056ef2207d2f25c943785fca721e26b5e88f9080a6bd9c595dd5910c54cf7cb79540c
|
7
|
+
data.tar.gz: 6e83abf9c59d111760c7a0ed9619b851193f461b24c9806a4ac06e70b1404aa6602d76df1b8a62e765f3188369f5d65db2480c696e9de316516f427053d831e2
|
@@ -13,7 +13,7 @@ module Avm
|
|
13
13
|
enable_simple_cache
|
14
14
|
common_constructor :document
|
15
15
|
|
16
|
-
delegate :build, to: :document
|
16
|
+
delegate :build, :source_document, to: :document
|
17
17
|
delegate :instance, to: :build
|
18
18
|
delegate :author_email, :author_name, to: :instance
|
19
19
|
|
@@ -22,10 +22,13 @@ module Avm
|
|
22
22
|
ICONS = ''
|
23
23
|
NUMBERED = ''
|
24
24
|
|
25
|
+
# @return [String]
|
26
|
+
def attribute_line(name, value)
|
27
|
+
[":#{name}:", value].reject(&:blank?).join(' ')
|
28
|
+
end
|
29
|
+
|
25
30
|
def attributes_lines
|
26
|
-
ATTRIBUTES.map
|
27
|
-
[":#{attr}:", attribute_value(attr)].reject(&:blank?).join(' ')
|
28
|
-
end
|
31
|
+
ATTRIBUTES.map { |attr| attribute_line(attr, attribute_value(attr)) }
|
29
32
|
end
|
30
33
|
|
31
34
|
def attribute_value(attr)
|
@@ -45,7 +48,23 @@ module Avm
|
|
45
48
|
end
|
46
49
|
|
47
50
|
def result_lines
|
48
|
-
[author_line] + attributes_lines
|
51
|
+
[stylesheet_line, title_line, author_line] + attributes_lines
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [String]
|
55
|
+
def stylesheet_line
|
56
|
+
attribute_line('stylesheet', stylesheet_path)
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Pathname]
|
60
|
+
def stylesheet_path
|
61
|
+
source_document.source.theme_stylesheet_path
|
62
|
+
.relative_path_from(document.convert_base_dir)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [String]
|
66
|
+
def title_line
|
67
|
+
"= #{source_document.title}"
|
49
68
|
end
|
50
69
|
|
51
70
|
def website
|
@@ -14,35 +14,32 @@ module Avm
|
|
14
14
|
|
15
15
|
enable_simple_cache
|
16
16
|
enable_speaker
|
17
|
-
common_constructor :build, :parent_document, :
|
18
|
-
|
19
|
-
# Absolute path to the Asciidoctor file.
|
20
|
-
#
|
21
|
-
# @return [Pathname]
|
22
|
-
def body_source_path
|
23
|
-
root_source_path.join(
|
24
|
-
::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
|
25
|
-
)
|
26
|
-
end
|
17
|
+
common_constructor :build, :parent_document, :source_document
|
27
18
|
|
28
19
|
# Absolute path to the output of Asciidoctor's source file.
|
29
20
|
#
|
30
21
|
# @return [Pathname]
|
31
22
|
def body_target_path
|
32
23
|
build.target_directory.join(
|
33
|
-
parent_document.present? ? subpath : ROOT_BODY_TARGET_BASENAME
|
24
|
+
parent_document.present? ? source_document.subpath : ROOT_BODY_TARGET_BASENAME
|
34
25
|
).basename_sub('.*') { |b| "#{b}.html" }
|
35
26
|
end
|
36
27
|
|
28
|
+
# @return [Pathname]
|
29
|
+
def convert_base_dir
|
30
|
+
source_document.root_path
|
31
|
+
end
|
32
|
+
|
37
33
|
def perform
|
38
34
|
perform_self
|
39
35
|
perform_children
|
40
36
|
end
|
41
37
|
|
42
38
|
def perform_self
|
43
|
-
infov 'Building',
|
39
|
+
infov 'Building', source_document.root_path
|
44
40
|
::Asciidoctor.convert(
|
45
41
|
pre_processed_body_source_content,
|
42
|
+
base_dir: convert_base_dir,
|
46
43
|
to_file: body_target_path.to_path, safe: :unsafe, mkdirs: true
|
47
44
|
)
|
48
45
|
end
|
@@ -53,29 +50,19 @@ module Avm
|
|
53
50
|
|
54
51
|
# @return [String]
|
55
52
|
def pre_processed_body_source_content
|
56
|
-
|
53
|
+
source_document.body_path.read.each_line
|
54
|
+
.map { |line| pre_process_line(line.rstrip) + "\n" }.join
|
57
55
|
end
|
58
56
|
|
59
57
|
def tree_documents_count
|
60
58
|
children.inject(1) { |a, e| a + e.tree_documents_count }
|
61
59
|
end
|
62
60
|
|
63
|
-
# Absolute path to the document's source root.
|
64
|
-
#
|
65
|
-
# @return [Pathname]
|
66
|
-
def root_source_path
|
67
|
-
build.source.content_directory.join(subpath)
|
68
|
-
end
|
69
|
-
|
70
|
-
def subpath
|
71
|
-
parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
|
72
|
-
end
|
73
|
-
|
74
61
|
private
|
75
62
|
|
76
63
|
def children_uncached
|
77
|
-
|
78
|
-
|
64
|
+
source_document.children
|
65
|
+
.map { |source_child| self.class.new(build, self, source_child) }
|
79
66
|
end
|
80
67
|
end
|
81
68
|
end
|
@@ -13,6 +13,7 @@ module Avm
|
|
13
13
|
enable_listable
|
14
14
|
lists.add_symbol :option, :target_directory
|
15
15
|
common_constructor :instance, :options, default: [{}] do
|
16
|
+
instance.assert_argument(::Avm::EacAsciidoctorBase0::Instances::Base, 'instance')
|
16
17
|
self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
|
17
18
|
end
|
18
19
|
|
@@ -29,7 +30,8 @@ module Avm
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def root_document
|
32
|
-
::Avm::EacAsciidoctorBase0::Instances::Build::Document
|
33
|
+
::Avm::EacAsciidoctorBase0::Instances::Build::Document
|
34
|
+
.new(self, nil, source.root_document)
|
33
35
|
end
|
34
36
|
|
35
37
|
# @return [Avm::EacAsciidoctorBase0::Sources::Base]
|
@@ -10,7 +10,7 @@ module Avm
|
|
10
10
|
class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
|
11
11
|
def build_content
|
12
12
|
::Avm::EacAsciidoctorBase0::Instances::Build.new(
|
13
|
-
|
13
|
+
instance,
|
14
14
|
::Avm::EacAsciidoctorBase0::Instances::Build::OPTION_TARGET_DIRECTORY => build_dir
|
15
15
|
).perform
|
16
16
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
class Document
|
11
|
+
module Title
|
12
|
+
TITLE_BASENAME = 'title'
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
def title
|
16
|
+
title_path.read.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [Pathname]
|
20
|
+
def title_path
|
21
|
+
root_path.join(TITLE_BASENAME)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
class Document
|
11
|
+
enable_simple_cache
|
12
|
+
enable_speaker
|
13
|
+
require_sub __FILE__, include_modules: true
|
14
|
+
common_constructor :source, :parent_document, :basename
|
15
|
+
|
16
|
+
# Absolute path to the Asciidoctor file.
|
17
|
+
#
|
18
|
+
# @return [Pathname]
|
19
|
+
def body_path
|
20
|
+
root_path.join(
|
21
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Absolute path to the document's source root.
|
26
|
+
#
|
27
|
+
# @return [Pathname]
|
28
|
+
def root_path
|
29
|
+
source.content_directory.join(subpath)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Pathname]
|
33
|
+
def subpath
|
34
|
+
parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def children_uncached
|
40
|
+
root_path.children.select(&:directory?)
|
41
|
+
.map { |path| self.class.new(source, self, path.basename) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'asciidoctor'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacAsciidoctorBase0
|
8
|
+
module Sources
|
9
|
+
class Base
|
10
|
+
module Theme
|
11
|
+
CONFIGURATION_THEME_KEY = 'theme'
|
12
|
+
DEFAULT_THEME_DIRECTORY_SUBPATH = 'theme'
|
13
|
+
THEME_STYLESHEET_BASENAME = 'main.css'
|
14
|
+
|
15
|
+
# @return [Pathname]
|
16
|
+
def default_theme_directory
|
17
|
+
path.join(DEFAULT_THEME_DIRECTORY_SUBPATH)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Pathname]
|
21
|
+
def theme_directory
|
22
|
+
theme_directory_by_configuration || default_theme_directory
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Pathname]
|
26
|
+
def theme_directory_by_configuration
|
27
|
+
configuration_entry(CONFIGURATION_THEME_KEY).value.if_present do |v|
|
28
|
+
v.to_pathname.expand_path(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Pathname]
|
33
|
+
def theme_stylesheet_path
|
34
|
+
theme_directory.join(THEME_STYLESHEET_BASENAME)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -12,10 +12,17 @@ module Avm
|
|
12
12
|
CONTENT_DOCUMENT_BASENAME = ::Pathname.new('body.adoc')
|
13
13
|
MAIN_FILE_SUBPATH = CONTENT_DIRECTORY_SUBPATH.join(CONTENT_DOCUMENT_BASENAME)
|
14
14
|
|
15
|
+
require_sub __FILE__, include_modules: true
|
16
|
+
|
15
17
|
def content_directory
|
16
18
|
path.join(CONTENT_DIRECTORY_SUBPATH)
|
17
19
|
end
|
18
20
|
|
21
|
+
# @return [Avm::EacAsciidoctorBase0::Sources::Base::Document
|
22
|
+
def root_document
|
23
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::Document.new(self, nil, nil)
|
24
|
+
end
|
25
|
+
|
19
26
|
def valid?
|
20
27
|
path.join(MAIN_FILE_SUBPATH).file?
|
21
28
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
EacAsciidoctorBase0 Generated Source
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
@@ -148,10 +148,15 @@ files:
|
|
148
148
|
- lib/avm/eac_asciidoctor_base0/source_generators/base.rb
|
149
149
|
- lib/avm/eac_asciidoctor_base0/sources.rb
|
150
150
|
- lib/avm/eac_asciidoctor_base0/sources/base.rb
|
151
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/document.rb
|
152
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb
|
153
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/theme.rb
|
151
154
|
- lib/avm/eac_asciidoctor_base0/sources/runners.rb
|
152
155
|
- lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
|
153
156
|
- lib/avm/eac_asciidoctor_base0/version.rb
|
154
157
|
- template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc
|
158
|
+
- template/avm/eac_asciidoctor_base0/source_generators/base/content/title
|
159
|
+
- template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css
|
155
160
|
homepage:
|
156
161
|
licenses: []
|
157
162
|
metadata: {}
|