Replacing Font Tags in HTML Pages with Dreamweaver Templates
Posted: Thu Dec 23, 2004 10:08 pm
I have an eval version of TextPipe Web which will be purchased IMMEDIATELY if I can use it to solve the following problem
I have inherited 5-6,000 web pages built using Dreamweaver templates and lots of horrible <FONT tags. As part of a site revamp, we will be updating the templates to use CSS and reapplying them to the pages in the site. This will fix the template-driven parts of each page (such as the menus), but will not change the content sections of each page - "Editable Areas" in Dreamweaver parlance.
Dreamweaver marks each Editable Area with a pair of HTML comment tags like this
Within the content there is a variety of (mostly) standard <FONT tags that I want to transform to normal HTML tags and style using CSS.
For example, I have thousands of pages containing HTML like the following
Note:
Others are causing me concern where there are nested tags.
For example, I want to convert
into
Note that some font tags will be converted to <p>, others to <span> and still others eliminated altogether.
Question
I have inherited 5-6,000 web pages built using Dreamweaver templates and lots of horrible <FONT tags. As part of a site revamp, we will be updating the templates to use CSS and reapplying them to the pages in the site. This will fix the template-driven parts of each page (such as the menus), but will not change the content sections of each page - "Editable Areas" in Dreamweaver parlance.
Dreamweaver marks each Editable Area with a pair of HTML comment tags like this
Code: Select all
<!-- #BeginEditable "body text" -->
<p>The HTML for the body content</p>
<!-- #EndEditable -->
For example, I have thousands of pages containing HTML like the following
Code: Select all
<p><font face="Arial, Helvetica, sans-serif" size="3" color="#000000"><a href="media/pressrel/41027p.htm"><font size="2" color="#FF0000">Paper gives church theological reasons to tackle HIV</font></a></font><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"></font><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Christian Aid has written a paper, <i>Theology and the HIV/AIDS epidemic, </i>that offers churches a theological model on which to base their support for people living with HIV.<b> <font color="#666666">/27.10.04</font></b></font></p>
- 1. Empty Tag pairs that need to be eliminated
2. Nested font tags - often three or more deep
3. "Standard" groups such as <b> <font color="#666666"> ... </font></b>
Others are causing me concern where there are nested tags.
For example, I want to convert
Code: Select all
<font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Christian Aid has written a paper, <i>Theology and the HIV/AIDS epidemic, </i>that offers churches a theological model on which to base their support for people living with HIV.<b> <font color="#666666">/27.10.04</font></b></font>
Code: Select all
<p>Christian Aid has written a paper, <i>Theology and the HIV/AIDS epidemic, </i>that offers churches a theological model on which to base their support for people living with HIV.<span class="date"> /27.10.04</span></p>
Question
- 1. How do I do a replace that will match up opening and closing HTML tags (font tags in this case)? I could only find a restrict rule that seemed to know about HTML tags, and that didn't like all the attributes such as <font face="Arial, Helvetica, sans-serif" size="2" color="#000000">