builder question - Can I comment blocks that I want to build?

19 views
Skip to first unread message

Wayne Brissette

unread,
Feb 2, 2021, 9:56:32 AM2/2/21
to nokogi...@googlegroups.com
I have a script which has been working fine. One part of it though
requires folks to comment out a few areas before they can be imported
into our content management system because it tries to validate content
and some of it isn't available until after the import process.

I know I can add comments by using a string and then adding them
directly to a node like this:

 xml << '<!-- <p>comment out for now -->'

but is there a way to open a comment and let builder continue building
the struture?

so instead of using the << or xml.comment I could somehow indicate that
I need several things build still has to build but build them within a
comment? I suspect this sounds odd, but I have a very good reason for
needing something like this. The other option for me is to after stuff
is built, wrap it in a comment.

-Wayne

Mike Dalessio

unread,
Feb 2, 2021, 1:18:53 PM2/2/21
to nokogiri-talk
Hi Wayne,

Today there isn't a way to do this within Builder, unfortunately.

I can imagine a feature that enables `Builder#comment` to accept a block that is evaluated, then serialized and injected into the comment. If that's interesting to you, can you open a github issue describing it and we can discuss the UX there?


--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nokogiri-talk/f4773dfd-eb8c-5a5a-eb09-a2524d39eef7%40att.net.

Wayne Brissette

unread,
Feb 2, 2021, 2:09:09 PM2/2/21
to nokogi...@googlegroups.com
Thanks Mike, I'll do that. I did the workaround for now and after builder was done with it, wrapped the sections I needed in comments.

I'll open the ticket/issue on github.

-Wayne
Reply all
Reply to author
Forward
0 new messages