I have a simple helper function containing this to spit out a list of links from a hash: ... links.each_pair do |label, link| li { a label, :href => link } end ... my hash elements are (obviously): ''Link label'' => ''http-link'', I''d now like to add a ''strong'' tag around some of the text in the labels (which I didn''t foresee), but the tag would be within the hash key. Ideas? Warnings? DaveE
So essentially you want the ''label'' string inserted verbatim as html code, rather than as plain text? li { a(:href => link) { label } } In markaby and presumably mab, strings passed as arguments are escaped, and html is inserted as bodies of elements via blocks - you can build that body either by calling more markaby functions inside the block, or by simply returning the fully formed html contents as a string, as above. Hope this helps! ? Jenna On Saturday, 5 May 2012 at 12:24 AM, Dave Everitt wrote:> I have a simple helper function containing this to spit out a list of > links from a hash: > > ... > links.each_pair do |label, link| > li { a label, :href => link } > end > ... > > my hash elements are (obviously): > > ''Link label'' => ''http-link'', > > I''d now like to add a ''strong'' tag around some of the text in the > labels (which I didn''t foresee), but the tag would be within the hash > key. Ideas? Warnings? > > DaveE > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > http://rubyforge.org/mailman/listinfo/camping-list > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120505/0cf9c57f/attachment.html>
That did it very nicely - thanks, Jenna! - D> So essentially you want the ''label'' string inserted verbatim as html > code, rather than as plain text? > > li { a(:href => link) { label } } > > In markaby and presumably mab, strings passed as arguments are > escaped, and html is inserted as bodies of elements via blocks - you > can build that body either by calling more markaby functions inside > the block, or by simply returning the fully formed html contents as > a string, as above. > > Hope this helps! > > ? > Jenna > > On Saturday, 5 May 2012 at 12:24 AM, Dave Everitt wrote: > >> I have a simple helper function containing this to spit out a list >> of links from a hash: >> >> ... >> links.each_pair do |label, link| >> li { a label, :href => link } >> end >> ... >> >> my hash elements are (obviously): >> >> ''Link label'' => ''http-link'', >> >> I''d now like to add a ''strong'' tag around some of the text in the >> labels (which I didn''t foresee), but the tag would be within the >> hash key. Ideas? Warnings? >> >> DaveE