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

book mark indexing for HTML pages

Expand Messages
  • Jeff Scism
    OK I have been going nuts trying to understand the help for Clip writing and other resources I have cobbled together a whole non-elegant clip that does
    Message 1 of 5 , Dec 23, 2006
    • 0 Attachment
      OK I have been going nuts trying to understand the "help for Clip
      writing" and other resources

      I have cobbled together a whole non-elegant clip that does most of what
      i need, and I know that there are better ways of doing it ( automating
      some of it) but I am stalled.

      I can't seem to get AppendtoFile to work (notetab 4.95)
      I can't find a clue about copying the file name of the source file to
      the wizard (so I am doing it by prompt)
      If I can get "John Smith" changed to "smith-john" for the bookmark
      name, it would be a lot quicker, than manual input)(I have seen
      something similar using regex, but I don't have that clip in my computer)



      ^!SetFocus
      ^$GetDocName(Index)$
      ^!KEYBOARD CTRL+C
      ^!InsertHtml <A Name="^?[surname-forename]">^&</A>

      ;!AppendToFile "content.html" doesn't work, (it is in the same directory
      as the source doc)
      ;I am missing the concept apparently.
      ;(notetab 4.95 std)(so I have to assure content.html already exists, no
      biggy.)


      ^!Open "content.html"
      ^!Jump Doc_End
      ^!InsertHtml <br>^P^P<A href="^?[source
      doc]#^?[surname-forename]">^&</A><br>

      ;It works fine up to this point EXCEPT I haven't figured out
      ;how to get the file name of the source file and paste it into
      ;the new link path (automatically) for Content.html
      ;Help file really doesn't cover this.

      ^!Save
    • Sheri
      Jeff, I tried to figure out what you were trying to do (bear in mind I don t do much html) and this is what I came up with. If you have the content.html
      Message 2 of 5 , Dec 24, 2006
      • 0 Attachment
        Jeff, I tried to figure out what you were trying to do (bear in mind I
        don't do much html) and this is what I came up with. If you have the
        content.html document open in NoteTab when you run this, you will have
        to reload it to see the addition. Hope it helps.

        Regards,
        Sheri

        ^!Set %sourcedoc%="^$GetDocName$"
        ^!Set %sourcepath%="^$GetPath(^$GetDocName$)$"
        ^!Set %nameref%="^?{surname-forename=^%nameref%}"
        ^!Set %linktext%="^$GetSelection$"
        ^!InsertHtml <A Name="^%nameref%">^%linktext%</A>
        ;start long line
        ^!AppendToFile "^%sourcepath%content.html" <br>^%NL%^%NL%<A
        href="^%sourcedoc%#^%nameref%">^%linktext%/A<br>
        ;end long line
      • Jeff Scism
        Thanks Sherri, I have been playoing with it more, (The goal is to create a linked name index for a website) Here is where I am at, which WORKS, the ONLY thing
        Message 3 of 5 , Dec 24, 2006
        • 0 Attachment
          Thanks Sherri, I have been playoing with it more, (The goal is to
          create a linked name index for a website)


          Here is where I am at, which WORKS, the ONLY thing left to figure out
          is to get it to take the name from the highlighted section, which is
          normally formatted as "John D. Smith" and convert it to
          'smith-john-d' for the 'a name' referenced link.

          (I am adding this in several; places, including as a comment at the
          beginning of the line to make sure the list can be properly sorted.

          The ^?[surname-forename] is the only part I have to manually enter at
          this time. (probably have to copy the selection to a new doc, process
          it there then paste it back.)

          Replace "John D. Smith" as lower case >> 'smith-john-d' and that would
          become the text I am currently manually entering as
          the^?[surname-forename] part of the wizard.

          If I can automate that I would just have to highlight a name and execute.

          I tested your version, and it makes the bookmark fine, but the
          appendtofile still is inoperative on my machine. so the version I
          already have is working better (your results may vary...)

          Jeff

          Code follows:

          ^!KEYBOARD CTRL+C
          ;long line follows
          ^!InsertHtml <A Name="^?[surname-forename] id:^?[surname-forename]">^&</A>
          ^!Save
          ^!Set %FileName%=^$GetName("^##")$^$GetExt("^##")$
          ^!Open "content.html"
          ^!SetWordWrap Off
          ^!Jump Doc_End
          ;long line follows
          ^!InsertHtml ^P<!--^?[surname-forename]--><A
          href="^%FileName%#^?[surname-forename]">^&</A><br>
          ^!Save
          ^!Document Prev

          end code
          --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
          >
          > Jeff, I tried to figure out what you were trying to do (bear in mind I
          > don't do much html) and this is what I came up with. If you have the
          > content.html document open in NoteTab when you run this, you will have
          > to reload it to see the addition. Hope it helps.
          >
          > Regards,
          > Sheri
          >
          > ^!Set %sourcedoc%="^$GetDocName$"
          > ^!Set %sourcepath%="^$GetPath(^$GetDocName$)$"
          > ^!Set %nameref%="^?{surname-forename=^%nameref%}"
          > ^!Set %linktext%="^$GetSelection$"
          > ^!InsertHtml <A Name="^%nameref%">^%linktext%</A>
          > ;start long line
          > ^!AppendToFile "^%sourcepath%content.html" <br>^%NL%^%NL%<A
          > href="^%sourcedoc%#^%nameref%">^%linktext%/A<br>
          > ;end long line
          >
        • Jeff Scism
          Ok this is the current state, it now sorts alphabetically the generated index. This code may be used to generate an index (called content.html ) for any
          Message 4 of 5 , Dec 24, 2006
          • 0 Attachment
            Ok this is the current state, it now sorts alphabetically the generated
            index.

            This code may be used to generate an index (called 'content.html') for
            any website you are creating ( you have to assure that 'content.html' is
            already created to start.

            I am using this in 4.95 standard.


            Begin Clipcode

            ;Highlight the entry on your HTML document, The first step creates the
            bookmark in the Source page.

            ^!Toolbar Copy
            ^!InsertHtml <A Name="^?[bookmark] id:^?[bookmark]">^&</A>
            ^!Save
            ^!Set %FileName%=^$GetName("^##")$^$GetExt("^##")$
            ;Create index link to bookmark
            ^!Open "content.html"
            ^!SetWordWrap Off
            ^!Jump Doc_End
            ^!InsertHtml ^P<!--^?[bookmark]--><A
            href="^%FileName%#^?[bookmark]">^&</A><br>
            :Sort
            ^!Select All
            ^$StrSort("^$GetSelection$";0;1;0)$
            ^!Jump 1
            ^!Save
            ^!Document Prev
          • Don - HtmlFixIt.com
            ... ;code fragment by don at htmlfixit dot com ;for Jeff Schism ;Goal is to take Thomas D. Smith ;and yield output smith-thomas-d ;split name at each space
            Message 5 of 5 , Dec 24, 2006
            • 0 Attachment
              Jeff Scism wrote:
              > Thanks Sherri, I have been playoing with it more, (The goal is to
              > create a linked name index for a website)
              >
              >
              > Here is where I am at, which WORKS, the ONLY thing left to figure out
              > is to get it to take the name from the highlighted section, which is
              > normally formatted as "John D. Smith" and convert it to
              > 'smith-john-d' for the 'a name' referenced link.
              >
              ;code fragment by don at htmlfixit dot com
              ;for Jeff Schism

              ;Goal is to take Thomas D. Smith
              ;and yield output smith-thomas-d

              ;split name at each space
              ^!SetListDelimiter " "
              ;set array = selection
              ^!SetArray %full_name%=^$GetSelection$

              ;assemble name in reverse order
              ;step one pull last name to front of list
              ^!Set %indexed_name%="^%full_name^%full_name0%%"


              ;variable number of name parts so create a loop for them
              ;set counter for loop
              ^!Set %name_counter%=1

              :CreateName
              ;decide if we have fully processed or process next piece
              ^!If ^%name_counter% = ^%full_name0% NameDone
              ;add next piece to end
              ^!Set %indexed_name%="^%indexed_name%-^%full_name^%name_counter%%"
              ;increment the counter
              ^!Inc %name_counter%
              ;repeat loop
              ^!Goto CreateName

              ;here is where you would use indexed name
              :NameDone
              ;strip periods
              ^!Set %indexed_name%=^$StrReplace(".";"";"^%indexed_name%";0;0)$
              ;convert to lower case
              ^!Set %indexed_name%=^$StrLower("^%indexed_name%")$
              ^!Info [C]Here is Where You Would Return to Processing: ^%indexed_name%
            Your message has been successfully submitted and would be delivered to recipients shortly.