I have a big legacy app with a bunch of CGI.pm tags like:
li(font({-face=>'verdana, arial, sans-serif', -color=>'red'}, $errorstring))
However, I have been tasked with redesigning the site, and need to be able to do most of the styling with CSS. I'm kind of stumped on a clean way to clean them up. My first stab was to try a simple regex:
find . |xargs grep -l 'font' | xargs
perl -ne 'if(s/font\s*\(([^()]+)\) )/<span class="$1"/g) {print;}'
However, that seems to be heading somewhere int he right direction, but not really what I want. A better approach may be to split up the tags and just dump portions in a class (perhaps something like
<li><span class="verdana red">$errorstring</span></li>
Is there a simple way to do that in regex? Or is there a better approach to cleaning up the cgi.pm code?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.