avm-eac_asciidoctor_base0 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fedf83f89dc4a475b21c86075c5c712cbc860cd99fdf5e883696bf68f7df37e5
4
- data.tar.gz: 40c9413c0a65301d1ac7fee6f06ed91cc9d7f354af23a608c9d69fab7c40c3f5
3
+ metadata.gz: f8a21301e5b4d214f60ea11c0a72abf0f81c124f29d4a5223040245fe6d5af2f
4
+ data.tar.gz: 90c8796e831fc3dbe5f475c36f764660c7013ebb48bbfccd0a96e690263478c4
5
5
  SHA512:
6
- metadata.gz: aab3202bc90bfd3d1adf57a1eb652d279d6a65ed482fa3fe74c3ab9daff056ef2207d2f25c943785fca721e26b5e88f9080a6bd9c595dd5910c54cf7cb79540c
7
- data.tar.gz: 6e83abf9c59d111760c7a0ed9619b851193f461b24c9806a4ac06e70b1404aa6602d76df1b8a62e765f3188369f5d65db2480c696e9de316516f427053d831e2
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
@@ -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.12.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,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.11.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
@@ -150,6 +151,7 @@ files:
150
151
  - lib/avm/eac_asciidoctor_base0/sources/base.rb
151
152
  - lib/avm/eac_asciidoctor_base0/sources/base/document.rb
152
153
  - lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb
154
+ - lib/avm/eac_asciidoctor_base0/sources/base/instance_to_build.rb
153
155
  - lib/avm/eac_asciidoctor_base0/sources/base/theme.rb
154
156
  - lib/avm/eac_asciidoctor_base0/sources/runners.rb
155
157
  - lib/avm/eac_asciidoctor_base0/sources/runners/build.rb