SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    some software to turn (<font span bull ****>) into (h1) or (p)

    Hi Guys,

    As a developer i often spend hours turning **** like this:

    <b><a href="index.php"><font size="4">
    <span style="background-color: #FF6600">Click Here</span></font></a></b>
    into this:

    <a href="index.php">Click Here</a>
    Then using CSS to style it.

    So can anyone tell me if there is a software that some genious has created that will fix the 'frontpage/dw/extremly bad developer' code and turn <span>'s, <font>'s and the rest of the crap u come across into good old <p>'s and <h1>'s. I don't expect a table to div miricle or anything, just somthing to clean up the mess.

    cheers,

    mascali

  2. #2
    SitePoint Evangelist Maujor's Avatar
    Join Date
    Mar 2005
    Location
    Rio de Janeiro - Brazil - South America
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Mascali,
    Yes, the software is just in yours hands!
    This is a very simple task for DreamWeaver to perform.
    BUT, you need know a little of "Regular Expressions".
    Let's go step by step:

    Open the document in your DW and go to Menu >> Edit >> Find and Replace (or press Ctrl + F) to shows up the Find/Repalce dialog box.

    For your example:
    On the Find text field type:
    <b><a href="([a-z/.]+)"><font size="[1-7]+">
    <span style="background-color: #[a-fA-F0-9]+">Click Here</span></font></a></b>

    On the Replace text field type:
    <a href="$1">Click Here</a>

    (Red code is regular expression - a kind of * wild card)

    Uncheck all the checkboxs but "Use regular expression" (must be checked).

    Now the magic!
    While in the "Code view mode" click "Find next". If you do all right the next bad code to replace will be highlighted on the code window, now click "Replace" and go with the Find Next and so on or click "Replace all" for the job to be done in one click only.
    Play around and you will see all this works.

    Well, now the good news. If do not know Regular Expression you must first to learn it (it's a good new because you will improve yours skills).

    For regular expressions go to Google.
    Mauricio Samy Silva
    http://www.maujor.com/

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Mauricio,

    I have been using dreamweaver for years and have never herd of this, i will be sure to learn regular expressions. Thanks heaps, this will save me hours a day.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •