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

How do I capitalize text bewteen HTML tags?

Expand Messages
  • tplarkin7
    I would like to capitalize the words, Narrator (v.o.) between the paragraph tags below: I need to keep the entire tag as shown. For example, other tags have
    Message 1 of 6 , Sep 1, 2011
      I would like to capitalize the words, "Narrator (v.o.)" between the paragraph
      tags below:



      I need to keep the entire tag as shown. For example, other tags have a
      margin of 1in, and I don't want to capitalize between them.

      Another issue is the hard return after "Narrator". Some of the lines in my
      HTML file have no return such as the line below:



      Thanks for your help!

      --
      View this message in context: http://vim.1045645.n5.nabble.com/How-do-I-capitalize-text-bewteen-HTML-tags-tp4760759p4760759.html
      Sent from the Vim - General mailing list archive at Nabble.com.

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Tim Chase
      ... You seem to be referencing example HTML code blocks that didn t appear in your message. Without any actual code, the best I can do is suggest you use gUit
      Message 2 of 6 , Sep 2, 2011
        On 09/01/11 21:22, tplarkin7 wrote:
        > I would like to capitalize the words, "Narrator (v.o.)" between the paragraph
        > tags below:
        >
        >
        >
        > I need to keep the entire tag as shown. For example, other tags have a
        > margin of 1in, and I don't want to capitalize between them.
        >
        > Another issue is the hard return after "Narrator". Some of the lines in my
        > HTML file have no return such as the line below:

        You seem to be referencing example HTML code blocks that didn't
        appear in your message. Without any actual code, the best I can
        do is suggest you use

        gUit

        to upper-case (gU) the "inner (contents of the) tag".

        :help gU
        :help it

        If it's more complex than that, or you have batches of them to
        do, it may be feasible to hack together some sort of :g command
        to do them all in one pass, but would need example HTML for that.

        -tim

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • tplarkin7
        I ve worked it out. I solved the hard return problem by using Notepad++ TextFx Tidy command. It aligns all tags to nowrap and noindent. I then used VIM to
        Message 3 of 6 , Sep 2, 2011
          I've worked it out.

          I solved the hard return problem by using Notepad++ TextFx Tidy command. It
          aligns all tags to nowrap and noindent.

          I then used VIM to capitalize the text since ordinary regex does not have
          that ability.

          For those that can't see the code I posted, it is visible in VIM's forum.

          Thanks for your help!

          --
          View this message in context: http://vim.1045645.n5.nabble.com/How-do-I-capitalize-text-bewteen-HTML-tags-tp4760759p4762995.html
          Sent from the Vim - General mailing list archive at Nabble.com.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Tim Chase
          ... Ah, you re posting through Nabble which doesn t seem to pass along the HTML to the official Vim list (vim@vim.org, mirrored at vim_use@googlegroups.com).
          Message 4 of 6 , Sep 2, 2011
            On 09/02/11 11:29, tplarkin7 wrote:
            > I then used VIM to capitalize the text since ordinary regex does not have
            > that ability.
            >
            > For those that can't see the code I posted, it is visible in VIM's forum.

            Ah, you're posting through Nabble which doesn't seem to pass
            along the HTML to the official Vim list (vim@..., mirrored at
            vim_use@...).

            Pulling in the source from the URL in your Nabble email I get the
            following:

            >
            > This post was updated on .
            > I would like to capitalize the words, "Narrator (v.o.)" between the paragraph tags below:
            >
            > <P STYLE="margin-left: 2in; margin-bottom: 0in">Narrator
            > (v.o.)</P>
            >
            >
            > I need to keep the entire tag as shown. For example, other tags have a margin of 1in, and I don't want to capitalize between them.
            >
            > Another issue is the hard return after "Narrator". Some of the lines in my HTML file have no return such as the line below:
            >
            > <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>
            >
            >
            > Thanks for your help!
            >
            > EDIT:
            > I'm slowly figuring this out:
            >
            > I've successfully capitalized the following example:
            >
            > Before code:
            >
            > <P ALIGN=CENTER>Narrator (v.o.)</P>
            >
            >
            > After code:
            >
            > <P ALIGN=CENTER>NARRATOR (V.O.)</P>
            >
            >
            > Code used:
            >
            > :%s:\(<P ALIGN=CENTER>\)\(.*\)\(<\):\1\U\2\3:g
            >
            >
            > I attempted the same for
            >
            > <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>
            >
            >
            > But, it gave me an error.

            You don't give the error or the command you gave, so it's hard to
            track down what went wrong. I'd try something like

            :%s/\c<P style="[^"]*2in[^"]*"[^>]*>\zs\_[^<]*\ze</\U&/g

            It has odd edge-cases where you might have nested tags, but it
            should handle most of the cases.

            -tim


            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • George V. Reilly
            ... A totally different approach would be to use semantic markup with CSS and get rid of all the inline styles leaving you with much cleaner HTML, as God and
            Message 5 of 6 , Sep 2, 2011

              On Fri, Sep 2, 2011 at 1:31 PM, Tim Chase <vim@...> wrote:
              On 09/02/11 11:29, tplarkin7 wrote:
              I then used VIM to capitalize the text since ordinary regex does not have
              that ability.

              For those that can't see the code I posted, it is visible in VIM's forum.

              Ah, you're posting through Nabble which doesn't seem to pass along the HTML to the official Vim list (vim@..., mirrored at vim_use@...).

              Pulling in the source from the URL in your Nabble email I get the following:

                     
              This post was updated on .

              I would like to capitalize the words, "Narrator (v.o.)" between the paragraph tags below:

              <P STYLE="margin-left: 2in; margin-bottom: 0in">Narrator
              (v.o.)</P>



              I need to keep the entire tag as shown. For example, other tags have a margin of 1in, and I don't want to capitalize between them.

              Another issue is the hard return after "Narrator". Some of the lines in my HTML file have no return such as the line below:

              <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>


              Thanks for your help!

              EDIT:
              I'm slowly figuring this out:

              I've successfully capitalized the following example:

              Before code:

              <P ALIGN=CENTER>Narrator (v.o.)</P>


              After code:

              <P ALIGN=CENTER>NARRATOR (V.O.)</P>


              Code used:

              :%s:\(<P ALIGN=CENTER>\)\(.*\)\(<\):\1\U\2\3:g


              I attempted the same for

              <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>


              But, it gave me an error.

              You don't give the error or the command you gave, so it's hard to track down what went wrong.  I'd try something like

               :%s/\c<P style="[^"]*2in[^"]*"[^>]*>\zs\_[^<]*\ze</\U&/g

              It has odd edge-cases where you might have nested tags, but it should handle most of the cases.

              A totally different approach would be to use semantic markup with CSS and get rid of all the inline styles leaving you with much cleaner HTML, as God and the W3C intended.

              <style>
              .narrator {text-transform: uppercase}
              </style>

              <p class="narrator">Narrator (v.o.)</p>
              -- 
              /George V. Reilly  george@...  Twitter: @georgevreilly
              http://www.georgevreilly.com/blog  http://blogs.cozi.com/tech


               

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • tplarkin7
              Thanks, Tim! On Fri, Sep 2, 2011 at 3:32 PM, Tim Chase-9 [via VIM]
              Message 6 of 6 , Sep 2, 2011
                Thanks, Tim!

                On Fri, Sep 2, 2011 at 3:32 PM, Tim Chase-9 [via VIM] <[hidden email]> wrote:
                On 09/02/11 11:29, tplarkin7 wrote:
                > I then used VIM to capitalize the text since ordinary regex does not have
                > that ability.
                >
                > For those that can't see the code I posted, it is visible in VIM's forum.

                Ah, you're posting through Nabble which doesn't seem to pass
                along the HTML to the official Vim list ([hidden email], mirrored at
                [hidden email]).

                Pulling in the source from the URL in your Nabble email I get the
                following:

                >
                > This post was updated on .
                > I would like to capitalize the words, "Narrator (v.o.)" between the paragraph tags below:
                >
                > <P STYLE="margin-left: 2in; margin-bottom: 0in">Narrator
                > (v.o.)</P>
                >
                >
                > I need to keep the entire tag as shown. For example, other tags have a margin of 1in, and I don't want to capitalize between them.
                >
                > Another issue is the hard return after "Narrator". Some of the lines in my HTML file have no return such as the line below:
                >
                > <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>
                >
                >
                > Thanks for your help!
                >
                > EDIT:
                > I'm slowly figuring this out:
                >
                > I've successfully capitalized the following example:
                >
                > Before code:
                >
                > <P ALIGN=CENTER>Narrator (v.o.)</P>
                >
                >
                > After code:
                >
                > <P ALIGN=CENTER>NARRATOR (V.O.)</P>
                >
                >
                > Code used:
                >
                > :%s:\(<P ALIGN=CENTER>\)\(.*\)\(<\):\1\U\2\3:g
                >
                >
                > I attempted the same for
                >
                > <P STYLE="margin-left: 2in; margin-bottom: 0in">Aristobulus</P>
                >
                >
                > But, it gave me an error.
                You don't give the error or the command you gave, so it's hard to
                track down what went wrong.  I'd try something like

                   :%s/\c<P style="[^"]*2in[^"]*"[^>]*>\zs\_[^<]*\ze</\U&/g

                It has odd edge-cases where you might have nested tags, but it
                should handle most of the cases.

                -tim


                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php



                If you reply to this email, your message will be added to the discussion below:
                http://vim.1045645.n5.nabble.com/How-do-I-capitalize-text-bewteen-HTML-tags-tp4760759p4763768.html
                To unsubscribe from How do I capitalize text bewteen HTML tags?, click here.



                View this message in context: Re: How do I capitalize text bewteen HTML tags?
                Sent from the Vim - General mailing list archive at Nabble.com.

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              Your message has been successfully submitted and would be delivered to recipients shortly.