Skip to content

Commit

Permalink
Don't break around text lines
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Apr 25, 2012
1 parent 68afd2e commit 7bd6839
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/web2script.rb
Expand Up @@ -146,6 +146,7 @@ def code(element, indent='', flat=false)
method = (text.include? '<' or text.include? '&') ? '_?' : '_'
flow_text "#{indent} #{method} #{text.enquote}",
"\" +\n #{indent}\""
first = true # stop break
elsif child.comment?
flow_text "#{indent} _.comment #{child.text.strip.enquote}",
"\" +\n #{indent}\""
Expand All @@ -155,11 +156,11 @@ def code(element, indent='', flat=false)

# insert a blank line if either this or the previous block was large
if $group and start + $group < $q.length
$q[start].sub! /^(\s+_\w+)([! .])/, '\1_\2'
$q.insert(start,'') if not first and breakable
blank = true
$q[start].sub! /^(\s+_\w+)([! .])/, '\1_\2' if breakable
$q.insert(start,'') if not first
blank = !child.text?
else
$q.insert(start,'') if blank and breakable
$q.insert(start,'') if blank
blank = false
end
start = $q.length
Expand Down

0 comments on commit 7bd6839

Please sign in to comment.