instance method
join_children
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
join_children(child_values)
No documentation comment.
Parameters
-
child_valuesreq
Source
# File actiontext/lib/action_text/markdown_conversion.rb, line 307
def join_children(child_values)
merged = []
child_values.each do |value|
# Merge adjacent bold/italic runs which Lexxy emits
if value.is_a?(Array) && (value[0] == :bold || value[0] == :italic)
if merged.last.is_a?(Array) && merged.last[0] == value[0]
merged.last[1] = merged.last[1] + value[1]
else
merged << [ value[0], value[1] ]
end
else
merged << value
end
end
parts = merged.map { |v| stringify(v) }
result = +""
parts.each do |part|
# Nested block elements (e.g., lists and blockquotes) need an initial newline injected
if !result.empty? && !result.end_with?("\n") && part.end_with?("\n\n")
result << "\n"
end
result << part
end
result
end
Defined in actiontext/lib/action_text/markdown_conversion.rb line 307
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionText::MarkdownConversion