Loading ...
Sorry, an error occurred while loading the content.

5258Re: [NH] Color coding Cells

Expand Messages
  • Marcelo de Castro Bastos
    Oct 22, 2005
    • 0 Attachment
      On 22/10/2005 16:19, Jeffery Scism invited the wrath of the gods by saying:

      >I am attempting to build a clip for modifying a HTML table, adding
      >BGCOLORs to cells.
      >
      >How do I get the Clip to run each command line in succession on an
      >existing HTML document which contains Tables?
      >
      >Here are the command lines I want to have executed on all instances.
      >
      >
      >
      Well, from what I'm seeing, you may be having a number of different
      problems:
      Are you trying to run this only inside a selection? If not, the "H"
      parameter might be confusing the issue.
      - a. If you ARE trying to run inside a selection, you probably need to
      "reset" the cursor position to the top of the file between each search.
      If you don't, it will only search from the "current" (meaning, "last
      found") position to the end.
      - b. If you are NOT trying to run inside a selection, replace the "H"
      parameter with an "W" (for "whole document" search and replace). This
      has the bonus of not needing to "reset" cursor position -- it will
      always go top-to-bottom, regardless.

      Whatever the result, might I suggest you try a slightly different
      replacing string? For instance, instead of

      >^!REPLACE '<td>8</td>' >> '<td align="center"
      >bgcolor="#33FF00">8</td>' HTSA
      >
      >
      >

      You might try

      ^!REPLACE '<td>8</td>' >> '<td class="td-8">8</td>' HTSA

      and then place an style like this on your stylesheet:

      td.td-8 {background-color:#33ff00;
      text-align:center;}

      That way, you get a smaller, cleaner HTML page AND can experiment with formatting in an easier way -- for instance, to change the color on the cells, you will only have to edit one place: the stylesheet.

      Also, this allows to do the ENTIRE replacing sequence with just ONE command (using regular expressions):

      ^!REPLACE '<td>{\d+}</td>' >> '<td class="td-\1">\1</td>' HTSRA

      Marcelo Bastos


      -=-=-
      ... Nanosecond: Mork's stunt man.
      * TagZilla 0.057
    • Show all 2 messages in this topic