|
|
|
|
|
by kayodelycaon
1201 days ago
|
|
Rails has had Builder::XmlMarkup for a long time. It's been extracted into a gem: https://www.rubydoc.info/gems/builder/Builder/XmlMarkup You could easily write a method to do this: def html(&blk)
io = StringIO.new()
builder = Builder::XmlMarkup.new(:target => io, :indent => 2)
blk.call(builder)
io.to_s
end
html do |t|
t.span "#{@first_name} #{@last_name}"
end
Not the prettiest, but it doesn't require additional gems or a new syntax highlighter and linter. |
|