avm-eac_asciidoctor_base0 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fedf83f89dc4a475b21c86075c5c712cbc860cd99fdf5e883696bf68f7df37e5
4
- data.tar.gz: 40c9413c0a65301d1ac7fee6f06ed91cc9d7f354af23a608c9d69fab7c40c3f5
3
+ metadata.gz: bce06fc28656156949473438b7da99a0b2bf92cb7f831f6a2cb4c4d787694ef0
4
+ data.tar.gz: cfc9ffbc638e1aebdf84e75ed645c7bddaa5ccb03d21b17c83ca09b3b6b31174
5
5
  SHA512:
6
- metadata.gz: aab3202bc90bfd3d1adf57a1eb652d279d6a65ed482fa3fe74c3ab9daff056ef2207d2f25c943785fca721e26b5e88f9080a6bd9c595dd5910c54cf7cb79540c
7
- data.tar.gz: 6e83abf9c59d111760c7a0ed9619b851193f461b24c9806a4ac06e70b1404aa6602d76df1b8a62e765f3188369f5d65db2480c696e9de316516f427053d831e2
6
+ metadata.gz: 6ac6bb3faca6ed2312310a11f893526a7ee28c0213bb0d4b65349a2da54646f9a0654df1ff6cfd9341790b01344b11c0485248f40dec90370968964df48c7029
7
+ data.tar.gz: 58153e3f2b5c8c95b6e5b972d1307eac5b769340ab3d323809613917531991983a75705638c086ba3bdab3b0a75ce7e261e1a0c19cd0095cdd67704846436537
@@ -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
@@ -43,11 +43,8 @@ module Avm
43
43
  "#{author_name} <#{author_email}>"
44
44
  end
45
45
 
46
+ # @return [Array<String>]
46
47
  def result
47
- result_lines.join("\n")
48
- end
49
-
50
- def result_lines
51
48
  [stylesheet_line, title_line, author_line] + attributes_lines
52
49
  end
53
50
 
@@ -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
@@ -36,7 +36,7 @@ module Avm
36
36
  end
37
37
 
38
38
  def perform_self
39
- infov 'Building', source_document.root_path
39
+ infov 'Building', source_document.subpath
40
40
  ::Asciidoctor.convert(
41
41
  pre_processed_body_source_content,
42
42
  base_dir: convert_base_dir,
@@ -51,7 +51,8 @@ module Avm
51
51
  # @return [String]
52
52
  def pre_processed_body_source_content
53
53
  source_document.body_path.read.each_line
54
- .map { |line| pre_process_line(line.rstrip) + "\n" }.join
54
+ .flat_map { |line| pre_process_line(line.rstrip) }
55
+ .map { |line| "#{line.rstrip}\n" }.join
55
56
  end
56
57
 
57
58
  def tree_documents_count
@@ -13,14 +13,13 @@ 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')
17
16
  self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
18
17
  end
19
18
 
20
19
  SOURCE_EXTNAMES = %w[.adoc .asc].freeze
21
20
 
22
21
  def perform
23
- infov 'Files to build', root_document.tree_documents_count
22
+ infov 'Documents to build', root_document.tree_documents_count
24
23
  target_directory.clear
25
24
  root_document.perform
26
25
  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
@@ -18,6 +18,11 @@ module Avm
18
18
  path.join(CONTENT_DIRECTORY_SUBPATH)
19
19
  end
20
20
 
21
+ # @return [Avm::EacAsciidoctorBase0::Sources::Base::InstanceToBuild]
22
+ def instance_to_build
23
+ ::Avm::EacAsciidoctorBase0::Sources::Base::InstanceToBuild.new(self)
24
+ end
25
+
21
26
  # @return [Avm::EacAsciidoctorBase0::Sources::Base::Document
22
27
  def root_document
23
28
  ::Avm::EacAsciidoctorBase0::Sources::Base::Document.new(self, nil, nil)
@@ -25,7 +25,7 @@ module Avm
25
25
 
26
26
  def build_uncached
27
27
  ::Avm::EacAsciidoctorBase0::Instances::Build.new(
28
- runner_context.call(:source).instance,
28
+ runner_context.call(:source).instance_to_build,
29
29
  target_directory: parsed.target_dir
30
30
  )
31
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.11.0'
5
+ VERSION = '0.13.0'
6
6
  end
7
7
  end
@@ -1,5 +1,9 @@
1
1
  //#header
2
2
 
3
+ == Child Documents
4
+
5
+ //#child_docs
6
+
3
7
  == First Section
4
8
 
5
9
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sapien.
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.11.0
4
+ version: 0.13.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: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2022-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -36,34 +36,28 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.12'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.12.2
39
+ version: '0.13'
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
45
  - !ruby/object:Gem::Version
49
- version: '0.12'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.12.2
46
+ version: '0.13'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: eac_ruby_utils
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '0.107'
53
+ version: '0.109'
60
54
  type: :runtime
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - "~>"
65
59
  - !ruby/object:Gem::Version
66
- version: '0.107'
60
+ version: '0.109'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: os
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -139,17 +133,17 @@ files:
139
133
  - lib/avm/eac_asciidoctor_base0/instances/base.rb
140
134
  - lib/avm/eac_asciidoctor_base0/instances/build.rb
141
135
  - lib/avm/eac_asciidoctor_base0/instances/build/document.rb
136
+ - lib/avm/eac_asciidoctor_base0/instances/build/document/child_docs_macro_value.rb
142
137
  - lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb
143
138
  - lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb
144
139
  - lib/avm/eac_asciidoctor_base0/instances/deploy.rb
145
- - lib/avm/eac_asciidoctor_base0/runners.rb
146
- - lib/avm/eac_asciidoctor_base0/runners/base.rb
147
140
  - lib/avm/eac_asciidoctor_base0/source_generators.rb
148
141
  - lib/avm/eac_asciidoctor_base0/source_generators/base.rb
149
142
  - lib/avm/eac_asciidoctor_base0/sources.rb
150
143
  - lib/avm/eac_asciidoctor_base0/sources/base.rb
151
144
  - lib/avm/eac_asciidoctor_base0/sources/base/document.rb
152
145
  - lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb
146
+ - lib/avm/eac_asciidoctor_base0/sources/base/instance_to_build.rb
153
147
  - lib/avm/eac_asciidoctor_base0/sources/base/theme.rb
154
148
  - lib/avm/eac_asciidoctor_base0/sources/runners.rb
155
149
  - lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/runner'
4
-
5
- module Avm
6
- module EacAsciidoctorBase0
7
- module Runners
8
- class Base < ::Avm::EacWebappBase0::Runner
9
- require_sub __FILE__
10
- end
11
- end
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module EacAsciidoctorBase0
7
- module Runners
8
- require_sub __FILE__
9
- end
10
- end
11
- end