Class: Metanorma::Document::Components::Lists::ListItem
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Metanorma::Document::Components::Lists::ListItem
- Defined in:
- lib/metanorma/document/components/lists/list_item.rb
Overview
List item inside an ordered or unordered list. Contains text content.
Instance Method Summary collapse
Instance Method Details
#json_text ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/metanorma/document/components/lists/list_item.rb', line 84 def json_text if paragraphs && !paragraphs.empty? return paragraphs.map { |p| p.text || "" }.join(" ").strip end ct = content_text if ct.is_a?(Array) && !ct.empty? return ct.compact.join.strip end text&.filter_map do |t| t.respond_to?(:text) ? t.text : t.to_s end&.join end |