We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ab6109d commit 1b4a0a6Copy full SHA for 1b4a0a6
lib/syntax_tree/xml/format.rb
@@ -226,14 +226,11 @@ def visit_misc(node)
226
227
# Format a text by splitting nicely at newlines and spaces.
228
def format_text(q, value)
229
- q.seplist(
230
- value.strip.split("\n"),
231
- -> { q.breakable(force: true, indent: false) }
232
- ) do |line|
233
234
- line.split(/\b(?: +)\b/),
235
- -> { q.group { q.breakable } }
236
- ) { |segment| q.text(segment) }
+ sep_line = -> { q.breakable(force: true, indent: false) }
+ sep_word = -> { q.group { q.breakable } }
+
+ q.seplist(value.strip.split("\n"), sep_line) do |line|
+ q.seplist(line.split(/\b(?: +)\b/), sep_word) { |word| q.text(word) }
237
end
238
239
0 commit comments