Recently I had the 'fun' assignment of cleaning up a number
of 'Word HTML' documents for use on a web site. Thankfully, Dreamweaver's
'Clean Up Word HTML' command completed about 80 percent of the
task. But that still left a sticky 20 percent to be edited. To
repair the remaining offending code I decided to use the 'Find'
and 'Replace' commands. I'm sure most Dreamweaver users out there
have used the 'Replace' tool to remove problem tags or text.
Unfortunately, the usual 'Replace' command was not refined enough
for my needs. I was going to have to explore the power of editing
individual tags within the 'Replace' tool.
The document in question had a number of and tags I wanted to
replace with a simple tag. To accomplish this with minimal labor,
I followed these steps: I selected Edit > Replace. Under 'Find
What' I chose 'Tag.'
Select 'Tag' Then I selected the specific tag I wanted to affect.
I chose 'p' for paragraph.
Select the HTML 'Tag' to be edited After that, I had to set
the parameters for the tag. These parameters available include
with attribute, without attribute, containing, not containing,
inside tag, and not inside tag. I chose 'With Attribute' and
'class.'
Select 'class' attribute. Then I selected 'any value' so all
'class' tags would be affected by my 'Replace' edit.
Select '[any value]' Finally I selected the 'Action' to be performed
on the chosen tag. I selected 'Replace Tag & Contents' with new
tag '.'
Select 'Replace Tag & Contents' Important - Remember to save
your 'Replace Queries.' The page I was editing was just one of
a dozen I needed to convert. Later I could bring up my saved
queries and apply it to the other eleven pages. This is a great
time saver.
Remember - Save those queries The real power of this tool is
the ability to expand the replace parameters by adding more search
layers with different settings, allowing you to include or exclude
other attributes within a tag. For example I could edit the 'p
class=[any tag]' but preserve any tags with the 'align' attribute
by clicking the '+ button' and choosing 'Without Attribute' & 'align.'
Adding to a 'replace query' This is what my 'Replace' query
looked like. Then I selected 'Replace All' and let Dreamweaver
do the heavy lifting.
Screenshot of my 'Replace' edit Unfortunately you won't find
much help in the manual that ships with Dreamweaver. There is
some information if you go Help > Using Dreamweaver. But ultimately
you are going to have to take the plunge and learn the power
of this tool on your own. Believe me, it will be time well spent.