You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In trying to enhance an existing script, I asked on the Nokogiri list about the possibility of enabling Builder to open a comment block, continue serializing data, then closing the comment. It was mentioned that's not currently possible. I am requesting that folks consider this enhancement to builder.
The text was updated successfully, but these errors were encountered:
#! /usr/bin/env rubyrequire'nokogiri'require'minitest/autorun'classTest < MiniTest::Specdescribe"Builder support for commenting out subtrees"doit"works like this currently"dobuilder=Nokogiri::HTML::Builder.newdo |doc|
doc.htmldodoc.bodydodoc.spandodoc.text"Hello world"endendendendassert_includes(builder.to_html,<<~EOF) <html><body><span>Hello world</span></body></html> EOFendit"might be extended to do this"dobuilder=Nokogiri::HTML::Builder.newdo |doc|
doc.htmldodoc.bodydodoc.commentdo# addeddoc.spandodoc.text"Hello world"endendendendendassert_includes(builder.to_html,<<~EOF) <html><body><!-- <span>Hello world</span> --></body></html> EOFendendend
I really think the "extended to do this" version is cleaner and it honestly follows what you have been doing in builder, that is, opens up a block, then you build inside that block until it's time to close.
However, this is exactly what I was hoping for, and if you said, I could only have the first one, I'd find ways to make that work.
In trying to enhance an existing script, I asked on the Nokogiri list about the possibility of enabling Builder to open a comment block, continue serializing data, then closing the comment. It was mentioned that's not currently possible. I am requesting that folks consider this enhancement to builder.
The text was updated successfully, but these errors were encountered: