Skip to content

Commit

Permalink
Make etanni template work with frozen string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed May 22, 2024
1 parent 8ccaa9b commit b803c18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## master

* Support commonmarker 1.0+ API (unasuke) (#10)
* Make etanni template work with frozen string literals (jeremyevans)

## 2.3.0 (2023-09-14)

Expand Down
4 changes: 2 additions & 2 deletions lib/tilt/etanni.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ module Tilt
class EtanniTemplate < Template
def prepare
separator = data.hash.abs
chomp = "<<#{separator}.chomp!"
chomp = "<<#{separator}.chomp"
start = "\n_out_ << #{chomp}\n"
stop = "\n#{separator}\n"
replacement = "#{stop}\\1#{start}"

temp = @data.strip
temp.gsub!(/<\?r\s+(.*?)\s+\?>/m, replacement)

@code = "_out_ = [<<#{separator}.chomp!]\n#{temp}#{stop}_out_.join"
@code = "_out_ = [<<#{separator}.chomp]\n#{temp}#{stop}_out_.join"
end

def precompiled_template(locals)
Expand Down

0 comments on commit b803c18

Please sign in to comment.