Re: Importing a text file with hard-coded line breaks

From: peter@ranui.org.nz
Date: Sat Mar 30 2002 - 21:00:05 EST

  • Next message: peter@ranui.org.nz: "Re: Importing a text file with hard-coded line breaks"

    This can be quite tricky to do well. Over the years ive crafted a macro in the text
    editer i use (TextPAD), and also created the odd perl script. One such script was
    used in an email list archive(http://nzpp.virtualave.net/coho/ --its a subroutine in the
    'retrieve function' ) to try and clean up the horendous mess you get with a
    combination of peoples different email clients line break settings.

    With the macro i just paste an email body into the editor, run the macro, then paste in
    into word processor or whatever. However i suggest there are traps to this, because
    how can you be completely sure that a hard break was original or not?

    It works best when the original writer knows how to write and format a paragraph!, ie
    a double line break between paras. In this case you just delete all instances of single
    newlines (and replace with a space!), but the conflict emerges where there are lists or
    bullet items INTENDED to have a newline on each line. In that case you get into
    smart-ass guessing games, like is there a fullstop or other punctuation on the beg or
    end of the line; does the next line start with a capital letter etc etc.

    If anyones interested ill gladly send the perl subroutine, such as it is.

    Peter
    NZ

    > What's the proper way to open or import a text file with hard-coded line
    > breaks (contents reproduced below). I want each group of lines that end
    > with a blank line to be grouped into a single paragraph. Opening the
    > file as "Text" produces an Abi document with poem-like breaks (stanzas,
    > rather than paragraphs, of text).
    >
    > ===BEGIN TEXT BLOCK===
    > The quick brown fox jumps over the lazy dog. The quick
    > brown fox jumps over the lazy dog. The quick brown fox
    > jumps over the lazy dog and ends Paragraph 1.
    >
    > The quick brown fox jumps over the lazy dog. The quick
    > brown fox jumps over the lazy dog and ends Paragraph 2.
    >
    > The story ends with this sentence and so does Paragraph 3.
    > ===END TEXT BLOCK===

    -----------------------------------------------
    To unsubscribe from this list, send a message to
    abiword-user-request@abisource.com with the word
    unsubscribe in the message body.



    This archive was generated by hypermail 2.1.4 : Sat Mar 30 2002 - 20:57:24 EST