Class: Coradoc::AsciiDoc::Model::Inline::Link

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/asciidoc/model/inline/link.rb

Overview

Link inline element for AsciiDoc documents.

Links can be external URLs or internal references.

Examples:

Create an external link

link = Coradoc::AsciiDoc::Model::Inline::Link.new
link.path = "https://example.com"
link.name = "Example Site"
link.to_adoc # => "https://example.com[Example Site]"

Create a link with title

link = Coradoc::AsciiDoc::Model::Inline::Link.new
link.path = "https://example.com"
link.title = "Visit example"
link.name = "Click here"

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Method Summary

Methods inherited from Base

#inline?

Methods inherited from Base

#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_adoc, #to_h, visit, #visit

Instance Attribute Details

#nameString? (readonly)

Returns Optional link text/alias.

Returns:

  • (String, nil)

    Optional link text/alias



37
38
39
40
41
42
# File 'lib/coradoc/asciidoc/model/inline/link.rb', line 37

class Link < Base
  attribute :path, :string
  attribute :title, :string
  attribute :name, :string
  attribute :right_constrain, :boolean, default: -> { false }
end

#pathString (readonly)

Returns The URL or path the link points to.

Returns:

  • (String)

    The URL or path the link points to



37
38
39
40
41
42
# File 'lib/coradoc/asciidoc/model/inline/link.rb', line 37

class Link < Base
  attribute :path, :string
  attribute :title, :string
  attribute :name, :string
  attribute :right_constrain, :boolean, default: -> { false }
end

#right_constrainBoolean (readonly)

Returns Whether to constrain the link on the right (default: false).

Returns:

  • (Boolean)

    Whether to constrain the link on the right (default: false)



37
38
39
40
41
42
# File 'lib/coradoc/asciidoc/model/inline/link.rb', line 37

class Link < Base
  attribute :path, :string
  attribute :title, :string
  attribute :name, :string
  attribute :right_constrain, :boolean, default: -> { false }
end

#titleString? (readonly)

Returns Optional tooltip text for the link.

Returns:

  • (String, nil)

    Optional tooltip text for the link



37
38
39
40
41
42
# File 'lib/coradoc/asciidoc/model/inline/link.rb', line 37

class Link < Base
  attribute :path, :string
  attribute :title, :string
  attribute :name, :string
  attribute :right_constrain, :boolean, default: -> { false }
end