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

Re: [NTB] Need help reformatting split text

Expand Messages
  • buralex@gmail.com
    brother.gabriel said on Apr 05, 2008 11:03 ... Try this clip - note: watch out for wrapped lines. All clip lines begin with either ;
    Message 1 of 1 , Apr 5, 2008
    • 0 Attachment
      "brother.gabriel" <brgabriel@...> said on Apr 05, 2008 11:03
      -0400 (in part):
      >
      > Hello all! I am new to noteTab, (I have been using it for about a
      > month, and I have the paid-for NoteTab full version) and relatively
      > new to programming. I would be grateful if someone would help me
      > with a code.
      >
      > Here is what I want to do. I need a clip that will reformat the
      > whole document (which I have uploaded to my "Brother Gabriel's
      > Folder" in the Files section - it's called "Josue") so that all the
      > chapters are formatted just like Chapter 1 and Chapter 2 (which I
      > have manually formatted to show what I need to do). Notice that for
      > all the numbering, I have added an extra space after the single
      > digits so that the lines align with the numbers that have two digits
      > (i.e., 1_ lines up with 15 etc.). After the Chapter Title is a verse
      > that describes the chapter. If you turn WordWrap off, you will see
      > that each numbered verse rests on one line with carriage returns in
      > between verses. I have many documents to process this way (a whole
      > Old Testament!), and I dread manually doing this for the Psalms!
      >
      > I have tried a few Find and Insert tricks, but I can't figure it out
      > without many hours of study and expirimentation. Thanks for reading
      > my note!
      >
      Try this clip - note: watch out for wrapped lines. All clip lines begin
      with either ";" or "^!" any that don't have been wrapped by Yahoo and
      must be manually reformatted.

      Bible reformat
      ; Alec Burgess 2008-04-05 (v1.0.0) (for Brother Gabriel)

      ; change leading numbers plus spaces to text to constant 3 characters.
      ; ie. \d+2spaces or \d\d+1 space - no allowance made for chapters
      containing more than 99 verses
      ^!replace "^(\d)\s+" >> "$1\x20\x20" rwsai
      ^!replace "^(\d\d)\s+" >> "$1\x20" rwsai

      ; Join all verses to on line - a verse defined as verse number+spaces +
      text (possible multiple lines) followed by next verse or blank line.

      ;put spaces before Book and Chapter lines (as per example but not specified)
      ^!set %theSpaces%=^$StrFill( ;51)$
      ^!Replace "^(?=The Book of|Chapter \d+)" >> "^%theSpaces" rswai

      ; put a blank line at end-of-document
      ^!jump TEXT_END
      ^!inserttext ^P

      ;put blank line + sentinel line containing "==" + blank line before
      every verse to
      ; allow joining entire document instead of requiring looping to find them
      ^!replace "\r\n(?=\d)" >> "\r\n\r\n==\r\n\r\n" rwsai

      ;put sentinel lines after "The Book of" and "Chapter \d+" lines too
      ^!replace "^(\x20{20,}(The Book of.*|Chapter \d+))" >>
      "$1\r\n\r\n==\r\n\r\n" rwsai

      ^!select ALL
      ^!Menu Modify/Lines/"Join Lines"
      ^!select 0

      ; remove sentinel lines
      ^!replace "\r\n\r\n==\r\n\r\n" >> "\r\n" rwsai

      ;kludge: fix introduced double spacing
      ^!replace "^P^P^P" >> "^P^P" wsai

      Regards ... Alec -- buralex-gmail
      --



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.