Class: Coradoc::AsciiDoc::Model::Include
- Includes:
- Resolvable
- Defined in:
- lib/coradoc/asciidoc/model/include.rb
Overview
Include directive element for AsciiDoc documents.
Include directives allow incorporating content from external files into the current document at processing time.
Instance Attribute Summary collapse
-
#attributes ⇒ Coradoc::AsciiDoc::Model::AttributeList
readonly
Include attributes.
-
#line_break ⇒ String
readonly
Line break character (default: “n”).
-
#path ⇒ String
readonly
The path to the file to include.
Attributes inherited from Base
Instance Method Summary collapse
-
#reference_options ⇒ Hash
Include options (leveloffset, lines, tags, etc.).
-
#reference_path ⇒ String
The path to the included file.
-
#reference_type ⇒ Symbol
The reference type.
Methods included from Resolvable
#local_reference?, #remote_reference?
Methods inherited from Base
#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_adoc, #to_h, visit, #visit
Instance Attribute Details
#attributes ⇒ Coradoc::AsciiDoc::Model::AttributeList (readonly)
Returns Include attributes.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 27 class Include < Base include Resolvable attribute :path, :string attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList, default: lambda { Coradoc::AsciiDoc::Model::AttributeList.new } attribute :line_break, :string, default: -> { "\n" } # @return [String] the path to the included file def reference_path path end # @return [Symbol] the reference type def reference_type :include end # @return [Hash] include options (leveloffset, lines, tags, etc.) def = {} if attributes.is_a?(Coradoc::AsciiDoc::Model::AttributeList) attributes.named.each do |attr| case attr.name.to_s when 'leveloffset' [:leveloffset] = attr.value when 'lines' [:lines] = attr.value when 'tags' [:tags] = attr.value.to_s.split(';') end end end end end |
#line_break ⇒ String (readonly)
Returns Line break character (default: “n”).
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 27 class Include < Base include Resolvable attribute :path, :string attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList, default: lambda { Coradoc::AsciiDoc::Model::AttributeList.new } attribute :line_break, :string, default: -> { "\n" } # @return [String] the path to the included file def reference_path path end # @return [Symbol] the reference type def reference_type :include end # @return [Hash] include options (leveloffset, lines, tags, etc.) def = {} if attributes.is_a?(Coradoc::AsciiDoc::Model::AttributeList) attributes.named.each do |attr| case attr.name.to_s when 'leveloffset' [:leveloffset] = attr.value when 'lines' [:lines] = attr.value when 'tags' [:tags] = attr.value.to_s.split(';') end end end end end |
#path ⇒ String (readonly)
Returns The path to the file to include.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 27 class Include < Base include Resolvable attribute :path, :string attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList, default: lambda { Coradoc::AsciiDoc::Model::AttributeList.new } attribute :line_break, :string, default: -> { "\n" } # @return [String] the path to the included file def reference_path path end # @return [Symbol] the reference type def reference_type :include end # @return [Hash] include options (leveloffset, lines, tags, etc.) def = {} if attributes.is_a?(Coradoc::AsciiDoc::Model::AttributeList) attributes.named.each do |attr| case attr.name.to_s when 'leveloffset' [:leveloffset] = attr.value when 'lines' [:lines] = attr.value when 'tags' [:tags] = attr.value.to_s.split(';') end end end end end |
Instance Method Details
#reference_options ⇒ Hash
Returns include options (leveloffset, lines, tags, etc.).
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 47 def = {} if attributes.is_a?(Coradoc::AsciiDoc::Model::AttributeList) attributes.named.each do |attr| case attr.name.to_s when 'leveloffset' [:leveloffset] = attr.value when 'lines' [:lines] = attr.value when 'tags' [:tags] = attr.value.to_s.split(';') end end end end |
#reference_path ⇒ String
Returns the path to the included file.
37 38 39 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 37 def reference_path path end |
#reference_type ⇒ Symbol
Returns the reference type.
42 43 44 |
# File 'lib/coradoc/asciidoc/model/include.rb', line 42 def reference_type :include end |