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

changing case of html tags

Expand Messages
  • Nicole Lallande
    Greetings, How do I change the case of all html tags in a file from uppercase to lowercase? BTW, is there an archive for this list - I hate to think I am
    Message 1 of 3 , May 2, 2001
    • 0 Attachment
      Greetings,

      How do I change the case of all html tags in a file from uppercase to
      lowercase? BTW, is there an archive for this list - I hate to think I
      am asking a question that has been asked a zillion times before. (My
      apologies if this is one of those questions.)

      TIA,

      Nicole
      --
      ########################
      Nicole Lallande
      nicole@...
      760.753.6766
      ########################
    • David Huttleston Jr
      Hi Nicole, The easiest way to manipulate HTML and XML is using a separate utility called Tidy or JTidy (the excellent java implementation of Tidy). These
      Message 2 of 3 , May 2, 2001
      • 0 Attachment
        Hi Nicole,
        The easiest way to manipulate HTML and XML is using a
        separate utility called Tidy or JTidy (the excellent java
        implementation of Tidy). These programs cleanup, modify,
        and/or beautify HTML and XML. We use JTidy to automatically
        cleanup and indent machine generated HTML and XML to make it
        easiler on human eyes.

        Tidy is at http://www.w3.org/People/Raggett/tidy/
        JTidy is at http://sourceforge.net/projects/jtidy/

        It's not a VIM solution, but tidy is easy to incorporate
        into a script (shell or vim) and could be invoked on
        the current buffer.

        Hope this helps,
        Dave

        On Wed, May 02, 2001 at 09:37:56AM -0700, Nicole Lallande wrote:
        > Greetings,
        >
        > How do I change the case of all html tags in a file from uppercase to
        > lowercase? BTW, is there an archive for this list - I hate to think I
        > am asking a question that has been asked a zillion times before. (My
        > apologies if this is one of those questions.)
        >
        > TIA,
        >
        > Nicole
        > --
        > ########################
        > Nicole Lallande
        > nicole@...
        > 760.753.6766
        > ########################

        --
        David Huttleston Jr
        7941 Tree Lane Suite 200
        Madison WI 53717
      • Benji Fisher
        ... According to http://www.vim.org/mail.html#archives the archive for this list is http://www.yahoogroups.com/list/vim . I think that ...
        Message 3 of 3 , May 2, 2001
        • 0 Attachment
          Nicole Lallande wrote:
          >
          > Greetings,
          >
          > How do I change the case of all html tags in a file from uppercase to
          > lowercase? BTW, is there an archive for this list - I hate to think I
          > am asking a question that has been asked a zillion times before. (My
          > apologies if this is one of those questions.)

          According to http://www.vim.org/mail.html#archives the archive for
          this list is http://www.yahoogroups.com/list/vim .

          I think that

          :%s/<[^>]*>/\L&/g

          will do what you want. Explanation:

          :% Apply what follows to each line in the file
          s/pattern/replace/flags Substitute pattern with replace; the "g" flag
          means everywhere in the line, not just the
          first occurrence.
          /<[^>]*>/ matches a "<" followed by any number of non-">" character,
          followed by a ">"
          /\L&/ & refers to the whole match and \L means convert it to lower case

          This will not handle all cases. For example, it will miss HTML tags that
          span more than one line. When it does work, it will make everything
          between "<" and ">" lower case, including 'href="CaseSensitiveFileName"'.
          It might be safer to use /<[^ \t>]*/ for the pattern: a "<" character,
          followed by as many non-space, non-tab, non-">" characters as possible.

          HTH --Benji Fisher
        Your message has been successfully submitted and would be delivered to recipients shortly.