Skip to content

Commit

Permalink
reduce the scope of render_with automagically being inserted
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed May 4, 2024
1 parent 9015c29 commit cc786ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bridgetown-routes/lib/bridgetown-routes/code_blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def eval_route_file(file, file_slug, app) # rubocop:disable Lint/UnusedMethodArg
code = ruby_content[1]
code_postmatch = ruby_content.post_match.lstrip
front_matter_line_count = code.lines.count - 1
code.concat("\nrender_with {}") unless code.match?(%r!^\s*render_with\s|\(!)
if code.match?(%r!^\s*render_with\s|\(!).! && code.match?(%r!r\.[a-z]+\s+do!).!
code.concat("\nrender_with {}")
end
end

# rubocop:disable Style/DocumentDynamicEvalDefinition, Style/EvalWithLocation
Expand Down

0 comments on commit cc786ae

Please sign in to comment.