Class: Coradoc::AsciiDoc::Model::Image::Core
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Base
- Coradoc::AsciiDoc::Model::Image::Core
- Includes:
- Anchorable
- Defined in:
- lib/coradoc/asciidoc/model/image/core.rb,
lib/coradoc/asciidoc/model/image/core/attribute_list.rb
Overview
Base class for image elements in AsciiDoc documents.
Images can be block-level (standalone paragraphs) or inline (within text). This base class provides common functionality for both types.
Direct Known Subclasses
Defined Under Namespace
Classes: AttributeList
Instance Attribute Summary collapse
-
#annotate_missing ⇒ String?
readonly
Annotation text for missing images.
-
#attributes ⇒ Coradoc::AsciiDoc::Model::Image::Core::AttributeList
readonly
Image-specific attributes.
-
#colons ⇒ String?
readonly
Colon positioning for attributes.
-
#id ⇒ String?
readonly
Optional identifier for the image.
-
#line_break ⇒ String
readonly
Line break character (default: “”).
-
#src ⇒ String
(also: #path)
readonly
The image source URL or path.
-
#title ⇒ String?
(also: #alt)
readonly
Optional image title/alt text.
Instance Method Summary collapse
-
#to_adoc ⇒ String
Custom to_adoc implementation that uses ElementRegistry directly to avoid recursion issues with image serialization.
Methods included from Anchorable
#default_anchor, #gen_anchor, included, #initialize
Methods inherited from Base
#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_h, visit, #visit
Instance Attribute Details
#annotate_missing ⇒ String? (readonly)
Returns Annotation text for missing images.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#attributes ⇒ Coradoc::AsciiDoc::Model::Image::Core::AttributeList (readonly)
Returns Image-specific attributes.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#colons ⇒ String? (readonly)
Returns Colon positioning for attributes.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#id ⇒ String? (readonly)
Returns Optional identifier for the image.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#line_break ⇒ String (readonly)
Returns Line break character (default: “”).
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#src ⇒ String (readonly) Also known as: path
Returns The image source URL or path.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
#title ⇒ String? (readonly) Also known as: alt
Returns Optional image title/alt text.
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 64 65 66 67 68 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 36 class Core < Coradoc::AsciiDoc::Model::Base # Autoload nested AttributeList class autoload :AttributeList, 'coradoc/asciidoc/model/image/core/attribute_list' include Coradoc::AsciiDoc::Model::Anchorable attribute :id, :string attribute :title, :string attribute :src, :string attribute :attributes, Coradoc::AsciiDoc::Model::Image::Core::AttributeList, default: lambda { ::Coradoc::AsciiDoc::Model::AttributeList.new } attribute :annotate_missing, :string attribute :line_break, :string, default: -> { '' } attribute :colons, :string # Aliases for common attribute accessors alias path src alias alt title # Custom to_adoc implementation that uses ElementRegistry directly # to avoid recursion issues with image serialization. # # @return [String] AsciiDoc representation of this image def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end end |
Instance Method Details
#to_adoc ⇒ String
Custom to_adoc implementation that uses ElementRegistry directly to avoid recursion issues with image serialization.
62 63 64 65 66 67 |
# File 'lib/coradoc/asciidoc/model/image/core.rb', line 62 def to_adoc # Use the registered serializer rather than Coradoc::AsciiDoc::Serializer.serialize # to avoid recursion serializer_class = Coradoc::AsciiDoc::Serializer::ElementRegistry.lookup(self.class) serializer_class.new.to_adoc(self) end |