From: Mario Becroft (mb@gem.win.co.nz)
Date: Fri Mar 29 2002 - 19:19:46 EST
On Sat, 30 Mar 2002, ephemeron wrote:
> 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).
I hacked together a quick C program to handle this by converting a file in
the format you mention to one where each paragraph is a single line. The
result can then be imported into a word processor and is correctly
formatted. I haven't actually tested it with Abiword, but I am sure it
will work. Source code follows:
#include <stdlib.h>
#include <stdio.h>
int main( int argc, char *argv[] )
{
char c, d;
d = '\0';
while ((c = getchar()) != EOF)
{
if (c != '\n' || d == '\n')
putchar( c );
else if (d != ' ')
putchar( ' ' );
d = c;
}
return 0;
}
-- Mario Becroft <mb@gem.win.co.nz> http://gem.win.co.nz/mb/----------------------------------------------- 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 : Fri Mar 29 2002 - 19:10:12 EST