# Post processing of generated HTML

**URL:** <https://www.ruby-forum.com/t/post-processing-of-generated-html/116506>\
**Category:** Rails\
**Created:** [October 6, 2007, 8:05am UTC](https://www.ruby-forum.com/t/post-processing-of-generated-html/116506 "2007-10-06T08:05:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![d2kagw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@d2kagw](https://www.ruby-forum.com/u/d2kagw)\
**Post date:** [October 6, 2007, 8:05am UTC](https://www.ruby-forum.com/t/post-processing-of-generated-html/116506/1 "2007-10-06T08:05:05Z")

</div>

Hi there!  
(noob here, so this q may be really dumb)

I’ve got a function that generates some HTML to assist the developers  
(very similar to the form\_tag ones):  
def lozenge\_bar ( black=false, blue=false, id="", &block )  
content = capture( &block )  
concat( tag(:div, {:class =\> “lozenge bar #{black||blue}”, :id =\> id},  
true ), block.binding )  
concat( content, block.binding )  
concat( “”, block.binding )  
end

I need to extend it so it processes the html assigned to “content”.  
As an example, I need it to get the first and last div in “content” and  
alter it a little.  
Are there any helpers built into RoR that can assist me in this?

I’ve had a look at HTML::Selector, but I can never seem to get it to  
work (I keep on getting “uninitialized constant HTML::Selector”), not  
sure if its going to do what I need it to do anyway…

Thanks!
