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

Re: [Clip] Changing numbers to hyperlinks in 1647 HTML pages

Expand Messages
  • Jeff Scism
    Sometimes the people on the servers do not want to do SSI, and you are stuck doing it the hard way . I also find that on my server space Virtual includes do
    Message 1 of 12 , Aug 1, 2004
    • 0 Attachment
      Sometimes the people on the servers do not want to do SSI, and you are
      stuck doing it the "hard way". I also find that on my server space
      Virtual includes do not work either.

      So I had to UN-format the changes I had made on 5400 HTML pages that
      would have reduced the coding by 25%.

      Cie L'guerre
      --
      ~~

      Jeffery G. Scism. IBSSG

      "Just the facts, maam."
      Sgt. Joe Friday,
      LAPD Badge #714
    • melchior prisi
      Hi, ... In a similar situation I solved the problem so that the clip calculates the right number. Something like ^!set
      Message 2 of 12 , Aug 1, 2004
      • 0 Attachment
        Hi,

        ----- on 01.08.2004 19:13 Jeff Scism wrote:
        > Each of 1647 HTML pages needs to link to the proper "parent" document.

        In a similar situation I solved the problem so
        that the clip calculates the right number.

        Something like

        ^!set %prev%=^$strcopyright("000^$calc(^$getname(^##)$-1)$";3)$.htm
        ^!insert <a href="^%prev%">nnn</a>

        This would insert the following to file 007.htm
        <a href="006.htm">nnn</a>

        Hope, this helps..


        Regards,
        Melchior



        --
        http://loc.alphazwirbel.net
        http://orp.alphazwirbel.net
      • Alan
        Jeff Scism wrote: [ . . ] ... regex tagged match comes to mind. but then to do so may requisite to use the replace command instead of insert command
        Message 3 of 12 , Aug 1, 2004
        • 0 Attachment
          Jeff Scism wrote:
          [ . . ]
          > The line I need to change is formatted as follows:
          >
          > (Son of No. 1) through (Son of No. 1646)
          >
          > The goal is to via directory replacement clip, to change each NUMBER
          > that follows "No. " into a hyperlink
          > This clip works for that:
          > ^!INSERT <A HREF="^&.htm">^&</A>
          >
          >
          > How do I get the program to find the "No. " in each document and select
          > the word AFTER it for the Insert conversion to a link?

          regex tagged match comes to mind. but then to do so may requisite to
          use the replace command instead of insert command

          (find-tagged-match-regex then the next code line is replace and/or may
          just only need the right replace-tagged-match-regex as a one liner
          instead of two lines) a.k.a. U may need two lines of code *OR* you may
          need one line of code.
          --

          idea of tagged match is to change something that is next or adjacent to
          something else

          potentially a solution. as to the best or whether overcomplicated or
          not, well I'll leave that for further discussion if seen and needed by
          other list memebers.

          might search the yah archives for regex and/or tagged match

          two help files in Notetab. regex is NOT in the clip help of those two

          --
          Alan.
        • Jeff Scism
          ^!set %prev%=^$strcopyright( 000^$calc(^$getname(^##)$-1)$ ;3)$.htm ^!insert nnn This would insert the following to file 007.htm
          Message 4 of 12 , Aug 1, 2004
          • 0 Attachment
            ^!set %prev%=^$strcopyright("000^$calc(^$getname(^##)$-1)$";3)$.htm
            ^!insert <a href="^%prev%">nnn</a>

            This would insert the following to file 007.htm
            <a href="006.htm">nnn</a>

            Nice clip, but in this case the "Parent" is REALLY the Parent, of the
            individual, and the page referenced may not be the previous page in order.

            Thanks, THIS one does look useful.
            --
            ~~

            Jeffery G. Scism. IBSSG

            "Just the facts, maam."
            Sgt. Joe Friday,
            LAPD Badge #714
          • John Zeman
            ... document. ... with a ... NUMBER ... select ... on ... of ... reference), ... Well if you really want to be gutsy and you are using NoteTab Pro or Std, you
            Message 5 of 12 , Aug 1, 2004
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Jeff Scism <scismgenie@a...> wrote:
              > Each of 1647 HTML pages needs to link to the proper "parent"
              document.
              >
              > The pages are in the SAME directory, and are numbered 01-1647.htm
              with a
              > few of them suffixed with the lower case a,b,c, etc.
              >
              > The line I need to change is formatted as follows:
              >
              > (Son of No. 1) through (Son of No. 1646)
              >
              > The goal is to via directory replacement clip, to change each
              NUMBER
              > that follows "No. " into a hyperlink
              > This clip works for that:
              > ^!INSERT <A HREF="^&.htm">^&</A>
              >
              >
              > How do I get the program to find the "No. " in each document and
              select
              > the word AFTER it for the Insert conversion to a link?
              >
              > I am already using the DIRSTUFF clips to do the sequential changes
              on
              > some other portions of webpages, but I am looking for the process
              of
              > selecting the next word (which is a sequentially numbered
              reference),
              > for the Looped Clip running.
              >
              > FLOW CHART:
              >
              > Select directory (this I can do)
              > Find in all Documents "No. " (this I can do)
              > SELECT the word AFTER "No. " to the clipboard
              > ^!INSERT <A HREF="^&.htm">^&</A> (this I can do)
              > Close and save silently
              > loop to Next document in the directory (this I can do)
              >
              >
              > Jeff Scism
              >
              > --
              > ~~



              Well if you really want to be gutsy and you are using NoteTab Pro or
              Std, you might be able to do this without a clip. By using the built
              in Search/Search Disk tool. I use Search Disk a lot, it saves me
              countless hours in situations like this.

              Before trying this however, you'd better do a LOT of testing of this
              on dummy files. This also assumes you will want to wrap ALL
              occurrences of numbers contained within the following text:

              Son of No. ###

              where ### represents any number of or sequences of digits.

              with HTML anchor tags. And to do this in all the HTML documents
              within a folder.

              Now if that doesn't scare you away, here's how you can do it with
              Search Disk. First press CTRL+D to bring up the Search Disk Dialog
              box. Click on the REPLACE tab and make sure the "Reg Expr." box is
              NOT checked. Then click the CANCEL button to close Search Disk.
              Next in a new unsaved document, type the following two lines exactly
              as they are below:

              Son of No\. {[0-9]+}

              <a href="\1.htm">\1</a>

              Then select the bottom line (<a href="\1.htm">\1</a>) and copy it to
              the Windows clipboard. Next select the top line (Son of No\. {[0-9]
              +}) and press CTRL+D to bring up the Search Disk dialog box again.
              With that open click the replace tab and you should see your selected
              text in the "Find What" box. Click in the "Replace With" box and
              paste in <a href="\1.htm">\1</a> that you had previously copied to
              the Windows clipboard by pressing CTRL+V.

              Next (still in Search Disk) in the "Search Directory Options"
              section, browse to the folder that contains the files you want to
              process. After you have selected that folder and pressed OK, make
              sure the "Search Directory Options" path looks something like this:

              C:\my tests\temp\*.htm*

              where the path ends with *.htm*

              Ok, you're just about ready to do this. The last steps are to
              optionally check the "Backup" box to make backups of all the files
              that will be changed, and to uncheck the "Subdirectories" box, and
              then finally, to check the "Reg Expr." box.

              Take a deep breath then press the START button and sit back and watch
              what happens. If you did everything correctly after a minute or two
              (depending upon the speed of your computer) you should see a NoteTab
              box pop up telling you how many changes were made to how many files.

              As I said though, I'd do a LOT of testing with this on dummy files
              before trying it on the real ones.

              Good luck,

              John

              PS Alternatly, you can use a clip to find the number to be replaced
              by searching for "
              Son of No\. {[0-9]+}" as long as you have the RegExp option checked.
            • Ben B
              On Sunday, Aug 01, 2004 Jeff Scism wrote regarding Changing numbers to hyperlinks in 1647 HTML pages ; ... Hi Jeff, The following regexp works on your example
              Message 6 of 12 , Aug 1, 2004
              • 0 Attachment
                On Sunday, Aug 01, 2004
                Jeff Scism wrote regarding "Changing numbers to hyperlinks in 1647 HTML pages";

                > The line I need to change is formatted as follows:
                >
                > (Son of No. 1) through (Son of No. 1646)
                >
                > [...]
                >
                > How do I get the program to find the "No. " in each document and select
                > the word AFTER it for the Insert conversion to a link?
                >
                > [...]
                >
                > Select directory (this I can do)
                > Find in all Documents "No. " (this I can do)
                > SELECT the word AFTER "No. " to the clipboard
                > ^!INSERT <A HREF="^&.htm">^&</A> (this I can do)
                > Close and save silently
                > loop to Next document in the directory (this I can do)

                Hi Jeff,

                The following regexp works on your example text. It assumes a single
                space between "No." and "<one or more digits>". The "^!Jump SELECT_END"
                may not be necessary if there is only a single instance to be changed in
                each document.

                ^!Find "No\.\s\d+" R
                ^!Find "\d+" RH
                ^!INSERT <A HREF="^&.htm">^&</A>
                ^!Jump SELECT_END

                HTH
                Ben
              • Jeff Scism
                John, Thank You. I will give it a shot. I will copy about ten to a back up directory and run it there, leaving my current source docs untouched. I appreciate
                Message 7 of 12 , Aug 1, 2004
                • 0 Attachment
                  John,

                  Thank You.

                  I will give it a shot.

                  I will copy about ten to a back up directory and run it there, leaving
                  my current source docs untouched.

                  I appreciate it greatly.
                  --
                  ~~

                  Jeffery G. Scism. IBSSG

                  "Just the facts, maam."
                  Sgt. Joe Friday,
                  LAPD Badge #714
                • Jody
                  Hi Jeff, I think I made what you want. Look in the latest (uploaded) DirStuff for: Update History ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 08-01-2004 Added No. word to
                  Message 8 of 12 , Aug 1, 2004
                  • 0 Attachment
                    Hi Jeff,

                    I think I made what you want. Look in the latest (uploaded) DirStuff for:

                    Update History
                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
                    08-01-2004 Added "No. word" to link..." Special HTML link formatter

                    It's under the --- Format Links --- section. If you get "Out of Memory"
                    errors, you'll need to do it on smaller amounts of files at a time and
                    possibly restart NoteTab each set. Definitely make backups!

                    >Each of 1647 HTML pages needs to link to the proper "parent" document.
                    >
                    >The pages are in the SAME directory, and are numbered 01-1647.htm with a
                    >few of them suffixed with the lower case a,b,c, etc.
                    >
                    >The line I need to change is formatted as follows:
                    >
                    >(Son of No. 1) through (Son of No. 1646)
                    >
                    >The goal is to via directory replacement clip, to change each NUMBER
                    >that follows "No. " into a hyperlink
                    >This clip works for that:
                    >^!INSERT <A HREF="^&.htm">^&</A>
                    >
                    >
                    >How do I get the program to find the "No. " in each document and select
                    >the word AFTER it for the Insert conversion to a link?
                    >
                    >I am already using the DIRSTUFF clips to do the sequential changes on
                    >some other portions of webpages, but I am looking for the process of
                    >selecting the next word (which is a sequentially numbered reference),
                    >for the Looped Clip running.
                    >
                    >FLOW CHART:
                    >
                    >Select directory (this I can do)
                    >Find in all Documents "No. " (this I can do)
                    >SELECT the word AFTER "No. " to the clipboard
                    >^!INSERT <A HREF="^&.htm">^&</A> (this I can do)
                    >Close and save silently
                    >loop to Next document in the directory (this I can do)


                    Happy Clip'n!
                    Jody

                    www.clean-funnies.com, http://www.fookes.us/maillist.htm

                    Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
                    UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
                    Options: http://groups.yahoo.com/group/ntb-clips
                  • Jody
                    Hi Jeff, Sorry, forgot the link, although you already have it in the Library. ;) There s some options as well in the Clip... NoteTabbers Assistant Library Page
                    Message 9 of 12 , Aug 1, 2004
                    • 0 Attachment
                      Hi Jeff,

                      Sorry, forgot the link, although you already have it in the Library. ;)
                      There's some options as well in the Clip...

                      NoteTabbers Assistant Library Page
                      http://www.notetab.net/html/library.htm
                      Direct download for DirStuff
                      http://www.notetab.net/zip/dirstuff.zip

                      I think I made what you want. Look in the latest (uploaded) DirStuff for:

                      Update History
                      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
                      08-01-2004 Added "No. word" to link..." Special HTML link formatter

                      It's under the --- Format Links --- section. If you get "Out of Memory"
                      errors, you'll need to do it on smaller amounts of files at a time and
                      possibly restart NoteTab each set. Definitely make backups!



                      >Each of 1647 HTML pages needs to link to the proper "parent" document.
                      >
                      >The pages are in the SAME directory, and are numbered 01-1647.htm with a
                      >few of them suffixed with the lower case a,b,c, etc.
                      >
                      >The line I need to change is formatted as follows:
                      >
                      >(Son of No. 1) through (Son of No. 1646)
                      >
                      >The goal is to via directory replacement clip, to change each NUMBER
                      >that follows "No. " into a hyperlink
                      >This clip works for that:
                      >^!INSERT <A HREF="^&.htm">^&</A>
                      >
                      >
                      >How do I get the program to find the "No. " in each document and select
                      >the word AFTER it for the Insert conversion to a link?
                      >
                      >I am already using the DIRSTUFF clips to do the sequential changes on
                      >some other portions of webpages, but I am looking for the process of
                      >selecting the next word (which is a sequentially numbered reference),
                      >for the Looped Clip running.
                      >
                      >FLOW CHART:
                      >
                      >Select directory (this I can do)
                      >Find in all Documents "No. " (this I can do)
                      >SELECT the word AFTER "No. " to the clipboard
                      >^!INSERT <A HREF="^&.htm">^&</A> (this I can do)
                      >Close and save silently
                      >loop to Next document in the directory (this I can do)


                      Happy Clip'n!
                      Jody

                      www.clean-funnies.com, http://www.fookes.us/maillist.htm

                      Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
                      UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
                      Options: http://groups.yahoo.com/group/ntb-clips
                    • Jeff Scism
                      OK Ben s solution worked within the DIRSTUFF code pakage, except on single digit page Numbers (1-9) which I did manually in the TEST files. (Now I have to
                      Message 10 of 12 , Aug 1, 2004
                      • 0 Attachment
                        OK Ben's solution worked within the DIRSTUFF code pakage, except on
                        single digit page Numbers (1-9) which I did manually in the TEST files.

                        (Now I have to chamge the extensions from *.bak back to *.htm...
                        --
                        ~~

                        Jeffery G. Scism. IBSSG

                        "Just the facts, maam."
                        Sgt. Joe Friday,
                        LAPD Badge #714
                      Your message has been successfully submitted and would be delivered to recipients shortly.