Getting HTML attributes, and dropping that HTML tag

P

Phillip Gawlowski

I'm stumped a bit, at the current problem in ClothRed development:

Since Textile supports HTML-attributes, I have to implement them
somehow. The suggestion to look at Hpricot was neat, but it doesn't do
what I need (at least, I can't find it).

Let me give an example:
This:
<p id="big-red">Red here</p>
Has to become:
p(#big-red). Red here

So, I'd need a way of: Finding a given attribute, extract it's contents,
place it inside the Textile-markup, and get rid of the HTML tag.

I've been digging through Google and Hpricot's documentation, but
haven't found anything, that does what I want.

My guess is: I need a Regexp, but I have no clue how to match unknown
contents, while discarding known content..

Does anyone have ideas? Or a hint where I should look?

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #15:

If you like it, let the author know. If you hate it, let the author
know why.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top