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

RE: [Clip] Convert static endnotes to inline notes

Expand Messages
  • John Shotsky
    Is that a challenge? Regards, John RecipeTools Web Site: http://recipetools.gotdns.com/ From: ntb-clips@yahoogroups.com
    Message 1 of 16 , Aug 4, 2012
    • 0 Attachment
      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]
    • John Shotsky
      Here is my test file: 123 This is the intervening text between the two notes. 124
      Message 2 of 16 , Aug 4, 2012
      • 0 Attachment
        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
      • Don
        We did a bible verses thing much like this not too long ago (as in the last five years ...)
        Message 3 of 16 , Aug 4, 2012
        • 0 Attachment
          We did a bible verses thing much like this not too long ago (as in the
          last five years ...)

          On 8/4/2012 4:45 PM, Axel Berger wrote:
          > 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>
          >
        • Axel Berger
          ... Absolutely not, just an opinion. I tend to write more lines than necessary to make the code as simple, legigble and maintainable as possible. Since I ve
          Message 4 of 16 , Aug 4, 2012
          • 0 Attachment
            John Shotsky wrote:
            > Is that a challenge?

            Absolutely not, just an opinion. I tend to write more lines than
            necessary to make the code as simple, legigble and maintainable as
            possible.

            Since I've done similar tasks before my rough sketch may hopefully be of
            a little help to someone not quite sure yet where to begin.

            Axel
          • Don
            Or maybe it was footnotes? http://tech.groups.yahoo.com/group/ntb-clips/message/19913
            Message 5 of 16 , Aug 4, 2012
            • 0 Attachment
              Or maybe it was footnotes?

              http://tech.groups.yahoo.com/group/ntb-clips/message/19913

              On 8/4/2012 5:36 PM, Don wrote:
              > We did a bible verses thing much like this not too long ago (as in the
              > last five years ...)
              >
              > On 8/4/2012 4:45 PM, Axel Berger wrote:
              >> 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>
              >
            • Axel Berger
              ... Three lines! Well done, this is really short compared to my clumsy effort. Axel
              Message 6 of 16 , Aug 4, 2012
              • 0 Attachment
                John Shotsky wrote:
                > Here is the code:

                Three lines! Well done, this is really short compared to my clumsy
                effort.

                Axel
              • Axel Berger
                ... Yes, I remember. I never used that solution becaus as far as I could see it could only run once and was not amenable to later additions or deletions. What
                Message 7 of 16 , Aug 4, 2012
                • 0 Attachment
                  Don wrote:
                  > Or maybe it was footnotes?

                  Yes, I remember. I never used that solution becaus as far as I could see
                  it could only run once and was not amenable to later additions or
                  deletions. What I now use is a simple renumber that requires the
                  footnotes to be in the right order, something not hard to ensure.

                  Going back to the matter at hand:
                  querulus mentioned the notes being in separate files. If those noteref
                  contain not arbitrary numbers but the file names (or if the files are
                  named by those numbers like "123.txt") the task becomes even easier.

                  Axel
                • Dave
                  Hi ever thought of trying the otl format with you markers down the left side [whatever] with an equivalent marker in text [whatever] ,double or single click
                  Message 8 of 16 , Aug 5, 2012
                  • 0 Attachment
                    Hi
                    ever thought of trying the otl format with you markers down the left side
                    [whatever] with an equivalent marker in text [whatever] ,double or single
                    click and your where your maker is making sure no two are the same.
                    THANKYOU DAVE M

                    ----- Original Message -----
                    From: "querulus" <kwolter@...>
                    To: <ntb-clips@yahoogroups.com>
                    Sent: Sunday, August 05, 2012 4:18 AM
                    Subject: [Clip] Convert static endnotes to inline notes


                    > I've got a large number of text files coded for typesetting with inline
                    > references for notes and the notes themselves gathered at the end of the
                    > file. (Actually, the notes are currently in separate files, but for the
                    > purposes of this exercise I'll import them at the end of the corresponding
                    > text.) Each note reference is marked something like
                    > <noteref>123</noteref>. Each corresponding note, which may be multiple
                    > paragraphs, is similary coded -- say, <notetext>123. . . . </notetext>.
                    > Subsequent paragraphs within the same note are coded the same way, but
                    > they don't begin with a note number.
                    >
                    > What I'd like to do is this: cut the note from the bottom of the file and
                    > insert it inline following the note reference. Ultimately I don't need to
                    > retain the note numbers themselves, either as references or at the
                    > beginning of the notes, so if that makes the task easier, all the better.
                    >
                    > 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.
                    >
                    > Some other thoughts: The inline notes will eventually need some other
                    > wrapper than <notetext>, but that's easy enough to do. It's fair to assume
                    > that no note paragraph begins with any digit apart from a note number
                    > itself (or our editors haven't done their jobs well). Because the notes
                    > are currently in separate files, it would be nice to be able to retrieve
                    > them directly from there, even if it meant having just two files open at
                    > once (or it would be nice to automate appending the second file to the
                    > first -- the names of the files will always match consistently like
                    > AB01.TXT and AB01NTS.TXT). It might also be nice to have a test to confirm
                    > that the number of references matches the number of numbered notes -- and
                    > that both sequences are in numerical order with no gaps. But all of that
                    > is secondary to the task of pulling the notes inline at the point of the
                    > reference.
                    >
                    > I think I know the outlines of a general procedure, but even after reading
                    > through all the NT Clip help and reviewing the group postings back to
                    > 2009, I'm not sure exactly how to start. And I'm not even sure it's
                    > doable. So thanks in advance for any help you can provide in steering me
                    > in the right direction.
                    >
                    > Klaas
                    >
                    >
                    >
                    > ------------------------------------
                    >
                    > Fookes Software: http://www.fookes.com/
                    > NoteTab website: http://www.notetab.com/
                    > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >
                    > ***
                    > Yahoo! Groups Links
                    >
                    >
                    >
                  • querulus
                    The idea of multiparagraph inline notes jarred me as well. As it happens, the target application is InDesign, and to determine the proper import format, I
                    Message 9 of 16 , Aug 5, 2012
                    • 0 Attachment
                      The idea of multiparagraph inline notes jarred me as well. As it happens, the target application is InDesign, and to determine the proper import format, I created a multiparagraph note within InDesign and exported the text as Tagged Text. I didn't expect to see a full CRLF in between note paragraphs within the parent text paragraph, but that's what Adobe does. I take your point that it may be valuable to enclose each note, no matter how many paragraphs, in a wrapper to designate note start and end.

                      Thanks for your help. I'll try to review all the suggestions in the next few days.

                      Klaas

                      --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                      >
                      > 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
                      >
                    • querulus
                      I did come across the thread started by Adrien Verlee when I was reviewing the archives, but for some reason (at about 1:00 in the morning), it seemed not
                      Message 10 of 16 , Aug 5, 2012
                      • 0 Attachment
                        I did come across the thread started by Adrien Verlee when I was reviewing the archives, but for some reason (at about 1:00 in the morning), it seemed not directly applicable. I should review it once more.

                        Klaas

                        --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
                        >
                        > Or maybe it was footnotes?
                        >
                        > http://tech.groups.yahoo.com/group/ntb-clips/message/19913
                        >
                        > On 8/4/2012 5:36 PM, Don wrote:
                        > > We did a bible verses thing much like this not too long ago (as in the
                        > > last five years ...)
                        > >
                        > > On 8/4/2012 4:45 PM, Axel Berger wrote:
                        > >> 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>
                        > >
                        >
                      • querulus
                        The notes are not each in a separate file, but all the notes for a chapter are gathered together in a single file. I could certainly add the filename of the
                        Message 11 of 16 , Aug 5, 2012
                        • 0 Attachment
                          The notes are not each in a separate file, but all the notes for a chapter are gathered together in a single file. I could certainly add the filename of the notes file to the noteref itself, though.

                          Klaas

                          --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                          >
                          > Don wrote:
                          > > Or maybe it was footnotes?
                          >
                          > Yes, I remember. I never used that solution becaus as far as I could see
                          > it could only run once and was not amenable to later additions or
                          > deletions. What I now use is a simple renumber that requires the
                          > footnotes to be in the right order, something not hard to ensure.
                          >
                          > Going back to the matter at hand:
                          > querulus mentioned the notes being in separate files. If those noteref
                          > contain not arbitrary numbers but the file names (or if the files are
                          > named by those numbers like "123.txt") the task becomes even easier.
                          >
                          > Axel
                          >
                        • querulus
                          I will enjoy! Thanks to all for all your help. This will give me much to work on. Klaas
                          Message 12 of 16 , 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
                            >
                          • querulus
                            After messing up the code several times while adding the InDesign specifics, I ve now got it working perfectly. I still don t comprehend exactly _how_ it
                            Message 13 of 16 , Aug 7, 2012
                            • 0 Attachment
                              After messing up the code several times while adding the InDesign specifics, I've now got it working perfectly. I still don't comprehend exactly _how_ it works, but I'll spend some time on that.

                              Thanks again.

                              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
                              >
                            Your message has been successfully submitted and would be delivered to recipients shortly.