Module: Idml::Render::ListMarker

Defined in:
lib/idml/render/list_marker.rb

Overview

Produces a list-marker string for a paragraph (bullet glyph or numbered-list expression). IDML stores the resolved marker directly on the PSR (BulletCharacterValue as a Unicode codepoint, NumberingExpression as the rendered text), so the renderer doesn't need to maintain its own counter.

Used by StyleResolver to prepend the marker to the paragraph's first run's text. The marker becomes part of the run's natural text flow — no special positioning needed for MVP.

Hanging-indent layout (bullet aligned in a left gutter with wrapped lines indented to align with text after the marker) is a follow-up; for now the marker sits inline before the text.

Constant Summary collapse

DEFAULT_BULLET =

BULLET

"".freeze
DEFAULT_TEXT_AFTER =
"\t".freeze

Class Method Summary collapse

Class Method Details

.marker_for(paragraph) ⇒ Object

Returns the marker string for the paragraph, or nil when the paragraph isn't part of a list.



24
25
26
27
28
29
30
31
# File 'lib/idml/render/list_marker.rb', line 24

def self.marker_for(paragraph)
  return nil unless paragraph

  case paragraph.bullets_and_numbering_list_type
  when "BulletList" then bullet_marker(paragraph)
  when "NumberedList" then numbered_marker(paragraph)
  end
end