avm-eac_asciidoctor_base0 0.10.0 → 0.12.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/child_docs_macro_value.rb +51 -0
- data/lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb +23 -7
- data/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb +3 -1
- data/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +14 -26
- data/lib/avm/eac_asciidoctor_base0/instances/build.rb +3 -2
- 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/instance_to_build.rb +45 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +40 -0
- data/lib/avm/eac_asciidoctor_base0/sources/base.rb +12 -0
- data/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +1 -1
- data/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
- data/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +4 -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 +8 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a21301e5b4d214f60ea11c0a72abf0f81c124f29d4a5223040245fe6d5af2f
|
4
|
+
data.tar.gz: 90c8796e831fc3dbe5f475c36f764660c7013ebb48bbfccd0a96e690263478c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79821526b12c35e2479df0b6f189952486988a1d4b5ea9d41aa342358e4421478ff3673cf4fe8cde467083294f8697466965f63c135f5c44bcb8441ca4b59792
|
7
|
+
data.tar.gz: bcfe9649156e7ea68484f5ab9c376630fe2509646d12e9fdc9f7079a55973f283f62b2b3d6e1d9b11a80aaec0cee2921fa14b807e683649e8bff22ce83d06fe6
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacAsciidoctorBase0
|
7
|
+
module Instances
|
8
|
+
class Build
|
9
|
+
class Document
|
10
|
+
class ChildDocsMacroValue
|
11
|
+
enable_method_class
|
12
|
+
common_constructor :document
|
13
|
+
|
14
|
+
# @return [Array<String>]
|
15
|
+
def result
|
16
|
+
document.children.map { |child_doc| ChildDocLine.new(document, child_doc) }.sort
|
17
|
+
.map(&:result)
|
18
|
+
end
|
19
|
+
|
20
|
+
class ChildDocLine
|
21
|
+
common_constructor :document, :child
|
22
|
+
compare_by :title, :address
|
23
|
+
|
24
|
+
# @return [Pathname]
|
25
|
+
def address
|
26
|
+
child.body_target_path.relative_path_from(
|
27
|
+
document.body_target_path.dirname
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def link
|
33
|
+
"link:#{address}[#{title}]"
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def result
|
38
|
+
"* #{link}"
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def title
|
43
|
+
child.source_document.title
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -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)
|
@@ -40,12 +43,25 @@ module Avm
|
|
40
43
|
"#{author_name} <#{author_email}>"
|
41
44
|
end
|
42
45
|
|
46
|
+
# @return [Array<String>]
|
43
47
|
def result
|
44
|
-
|
48
|
+
[stylesheet_line, title_line, author_line] + attributes_lines
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [String]
|
52
|
+
def stylesheet_line
|
53
|
+
attribute_line('stylesheet', stylesheet_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Pathname]
|
57
|
+
def stylesheet_path
|
58
|
+
source_document.source.theme_stylesheet_path
|
59
|
+
.relative_path_from(document.convert_base_dir)
|
45
60
|
end
|
46
61
|
|
47
|
-
|
48
|
-
|
62
|
+
# @return [String]
|
63
|
+
def title_line
|
64
|
+
"= #{source_document.title}"
|
49
65
|
end
|
50
66
|
|
51
67
|
def website
|
@@ -17,11 +17,12 @@ module Avm
|
|
17
17
|
|
18
18
|
common_constructor :document, :line
|
19
19
|
|
20
|
+
# @return [Array<String>]
|
20
21
|
def result
|
21
22
|
if macro?
|
22
23
|
macro_value
|
23
24
|
else
|
24
|
-
line
|
25
|
+
[line]
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -33,6 +34,7 @@ module Avm
|
|
33
34
|
MACRO_PARSER
|
34
35
|
end
|
35
36
|
|
37
|
+
# @return [Array<String>]
|
36
38
|
def macro_value
|
37
39
|
document.send("#{macro_name}_macro_value")
|
38
40
|
end
|
@@ -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.subpath
|
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,20 @@ 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
|
+
.flat_map { |line| pre_process_line(line.rstrip) }
|
55
|
+
.map { |line| "#{line.rstrip}\n" }.join
|
57
56
|
end
|
58
57
|
|
59
58
|
def tree_documents_count
|
60
59
|
children.inject(1) { |a, e| a + e.tree_documents_count }
|
61
60
|
end
|
62
61
|
|
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
62
|
private
|
75
63
|
|
76
64
|
def children_uncached
|
77
|
-
|
78
|
-
|
65
|
+
source_document.children
|
66
|
+
.map { |source_child| self.class.new(build, self, source_child) }
|
79
67
|
end
|
80
68
|
end
|
81
69
|
end
|
@@ -19,7 +19,7 @@ module Avm
|
|
19
19
|
SOURCE_EXTNAMES = %w[.adoc .asc].freeze
|
20
20
|
|
21
21
|
def perform
|
22
|
-
infov '
|
22
|
+
infov 'Documents to build', root_document.tree_documents_count
|
23
23
|
target_directory.clear
|
24
24
|
root_document.perform
|
25
25
|
end
|
@@ -29,7 +29,8 @@ module Avm
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def root_document
|
32
|
-
::Avm::EacAsciidoctorBase0::Instances::Build::Document
|
32
|
+
::Avm::EacAsciidoctorBase0::Instances::Build::Document
|
33
|
+
.new(self, nil, source.root_document)
|
33
34
|
end
|
34
35
|
|
35
36
|
# @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,45 @@
|
|
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 InstanceToBuild
|
11
|
+
AUTHOR_EMAIL = 'author@local.net'
|
12
|
+
AUTHOR_NAME = 'Local Author'
|
13
|
+
AUTHOR_NAME_INITIALS = 'L.A.'
|
14
|
+
|
15
|
+
common_constructor :source
|
16
|
+
|
17
|
+
# @return [Struct]
|
18
|
+
def application
|
19
|
+
::Struct.new(:local_source).new(source)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [String]
|
23
|
+
def author_email
|
24
|
+
AUTHOR_EMAIL
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [String]
|
28
|
+
def author_name
|
29
|
+
AUTHOR_NAME
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
def author_name_initials
|
34
|
+
AUTHOR_NAME_INITIALS
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
def web_url
|
39
|
+
"file://#{source.path.expand_path.join('build', 'index.html')}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
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,22 @@ 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::InstanceToBuild]
|
22
|
+
def instance_to_build
|
23
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::InstanceToBuild.new(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Avm::EacAsciidoctorBase0::Sources::Base::Document
|
27
|
+
def root_document
|
28
|
+
::Avm::EacAsciidoctorBase0::Sources::Base::Document.new(self, nil, nil)
|
29
|
+
end
|
30
|
+
|
19
31
|
def valid?
|
20
32
|
path.join(MAIN_FILE_SUBPATH).file?
|
21
33
|
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.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/avm/eac_asciidoctor_base0/instances/base.rb
|
140
140
|
- lib/avm/eac_asciidoctor_base0/instances/build.rb
|
141
141
|
- lib/avm/eac_asciidoctor_base0/instances/build/document.rb
|
142
|
+
- lib/avm/eac_asciidoctor_base0/instances/build/document/child_docs_macro_value.rb
|
142
143
|
- lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb
|
143
144
|
- lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb
|
144
145
|
- lib/avm/eac_asciidoctor_base0/instances/deploy.rb
|
@@ -148,10 +149,16 @@ files:
|
|
148
149
|
- lib/avm/eac_asciidoctor_base0/source_generators/base.rb
|
149
150
|
- lib/avm/eac_asciidoctor_base0/sources.rb
|
150
151
|
- lib/avm/eac_asciidoctor_base0/sources/base.rb
|
152
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/document.rb
|
153
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb
|
154
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/instance_to_build.rb
|
155
|
+
- lib/avm/eac_asciidoctor_base0/sources/base/theme.rb
|
151
156
|
- lib/avm/eac_asciidoctor_base0/sources/runners.rb
|
152
157
|
- lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
|
153
158
|
- lib/avm/eac_asciidoctor_base0/version.rb
|
154
159
|
- template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc
|
160
|
+
- template/avm/eac_asciidoctor_base0/source_generators/base/content/title
|
161
|
+
- template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css
|
155
162
|
homepage:
|
156
163
|
licenses: []
|
157
164
|
metadata: {}
|