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

23108Re: [Clip] Convert static endnotes to inline notes

Expand Messages
  • querulus
    Aug 5, 2012
    • 0 Attachment
      I will enjoy!

      Thanks to all for all your help. This will give me much to work on.

      Klaas

      --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
      >
      > Here is my test file:
      > <start>
      > <noteref>123</noteref>
      > <middle>
      > This is the intervening text between the two notes.
      > <noteref>124</noteref>
      > <end>
      >
      > <notetext>123This is the first note.
      > My thought was this: search for each note reference in text. When I find one, set a marker there, set the number as a
      > variable, Then jump to the corresponding note, select the entire note (again, because a note can be multiple paragraphs
      > I'd have to search to the beginning of the next numbered paragraph).
      >
      > Cut the note paragraphs from their location (retaining any internal paragraph breaks), jump back to the note reference,
      > and paste the note. Then jump to the next reference and repeat the process. As I say, because I don't need to retain the
      > numbers, if it would help to strip out each note reference as I insert the corresponding note, that would be
      > fine.</notetext>
      > <notetext>124This is the second note.
      > My thought was this: search for each note reference in text. When I find one, set a marker there? set the number as a
      > variable? Then jump to the corresponding note, select the entire note (again, because a note can be multiple paragraphs
      > I'd have to search to the beginning of the next numbered paragraph).
      >
      > Cut the note paragraphs from their location (retaining any internal paragraph breaks), jump back to the note reference,
      > and paste the note. Then jump to the next reference and repeat the process. As I say, because I don't need to retain the
      > numbers, if it would help to strip out each note reference as I insert the corresponding note, that would be
      > fine.</notetext>
      >
      > Here is the code:
      > ;===
      > ^!Replace "<notetext>(?=\d+)" >> "«" ARSW
      > ^!Replace "(?s)<noteref>(\d+)</noteref>([^«]+)«\1([^«]+)<\/notetext>" >> "\r\n$3\r\n\r\n$2" ARSW
      > ^!IfError Next Else Skip_-1
      > ;===
      > Enjoy!
      > John
      > RecipeTools Web Site: http://recipetools.gotdns.com/
      >
      > -----Original Message-----
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of John Shotsky
      > Sent: Saturday, August 04, 2012 13:54
      > To: ntb-clips@yahoogroups.com
      > Subject: RE: [Clip] Convert static endnotes to inline notes
      >
      > Is that a challenge?
      >
      > Regards,
      > John
      > RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      >
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
      > Sent: Saturday, August 04, 2012 13:45
      > To: ntb-clips@yahoogroups.com
      > Subject: Re: [Clip] Convert static endnotes to inline notes
      >
      >
      > John Shotsky wrote:
      > > I would start
      >
      > Another take. First I dislike your Format. If notes can contain
      > paragraphs, then make it explicit:
      >
      > <notetext>123<P>some text</P><P>more text</P></notetext>
      >
      > Also you say "insert it inline" which jars with "several paragraphs". So
      > perhaps you need to differentiate between inline and paragraph notes.
      >
      > Given that I'd do it this way:
      >
      > Search from the top for the first notetext.
      > Exit if none is found
      > Save it to a variable and delete in the text.
      > Delete the start and end tags in the variable
      > Search from the top for the corresponding noteref.
      > Throw an error if not found.
      > Delete tags as necessary and Insert variable, inline or as paragraphs as
      > needed.
      > Loop to the top
      >
      > That's atr least twelve lines against John's three, but I see that
      > number as wildly optimistic.
      >
      > Axel
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Fookes Software: http://www.fookes.com/
      > NoteTab website: http://www.notetab.com/
      > NoteTab Discussion Lists: http://www.notetab.com/groups.php
      >
      > ***
      > Yahoo! Groups Links
      >
    • Show all 16 messages in this topic