Auto formatting tool for pure text documents?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Auto formatting tool for pure text documents?

Post by KimmoA »

Is there a feature/plug-in in TextPad which formats pure text documents in such way that it makes a linebreak every nth char? I want some kind of standard look -- not all file-editors have word-wrapping on by default. :(

Also, if there is such a thing, does it also create spaces between words when there's "too little" text on one line to fill it up completely (like two spaces instead of one between some words)? :roll:
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Have you tried
Edit - Reformat
and
Edit - Align - Left/Right/Center/Justify
?
KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

Sorry, but those options basically just **** everything up.

I simply want an automated linebreak for every line that is longer than n chars.

BUT... it'd also be nice to have justify align, too. Those I tried didn't even remotely do what I wanted :(
User avatar
A bit iffy
Posts: 15
Joined: Thu Sep 16, 2004 1:15 pm
Location: Brighton, England

Post by A bit iffy »

KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

A bit iffy wrote:Is this what you want?
http://www.textpad.info/forum/viewtopic.php?t=6035
No... it does what I want as long as I have TextPad open, but in my browser, it's still not word-wrapped with \ns.
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

This is a question for your browser, not TextPad.

Which browser are you using?

Does your file contain just plain text, or does it have HTML mark-up?

Have you tried giving the file an extension of .html ?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Ah, you didn't mention browsers before.

In html - put the text in question into a pre element.
KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

MudGuard wrote:Ah, you didn't mention browsers before.

In html - put the text in question into a pre element.
WTF? Wasn't my comment added?

Oh, well...

I'm not talking about HTML. This is a pure text document. Web browsers can view those as well.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

what is your setting under

Configure - Preferences - Document Classes - your document class
for
Word wrapped text:
- save with no breaks
or
- save with hard breaks
?
KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

MudGuard wrote:what is your setting under

Configure - Preferences - Document Classes - your document class
for
Word wrapped text:
- save with no breaks
or
- save with hard breaks
?
At the time: hard breaks.

I did exactly as the instructions said :?
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

If your browser thinks that your file contains HTML it will treat newlines the same as spaces.

In what sense is the text not word-wrapped? Does it extend beyond the right margin of the browser?
Are there sufficient spaces in the text at which the lines can be broken?
Which browser are you using?
What is the file name extension?
How are you opening the file?
KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

ben_josephs wrote:If your browser thinks that your file contains HTML it will treat newlines the same as spaces.

In what sense is the text not word-wrapped? Does it extend beyond the right margin of the browser?
Are there sufficient spaces in the text at which the lines can be broken?
Which browser are you using?
What is the file name extension?
How are you opening the file?
It doesn't. I serve text files as text files :)

In the Web browser (Opera), it is not word-wrapped in the sense that it looks just like it used to -- looong lines.
User avatar
Jan Paul
Posts: 21
Joined: Mon Apr 28, 2003 1:24 pm
Location: The Netherlands

Post by Jan Paul »

A long line is indeed shown as a long line in a browser.
I have found no "wrap" function in a browser until this time.

Do you use Unix style line breaks? There could be a problem too.

The fact that a browser can show text files is just a 'bonus'. It is not another way of showing textfiles with formatting. If you are very keen on keeping the formatting just right, use another program to format things (PDF/Word etc).

Are you just letting users see textfiles without changing the textfiles themselves? That way you never get formatting to work.
If they only need to see a formatted textfile, put an HTML envelope around the textfile and use replace to change the EOL into <BR>.

You can also do a change after the nth column into <BR>. Use a regular expression to do this. There are examples of this in this forum.

An automated tool could be PHP. Then you can read in the textfile, and after the nth position, put in the <BR>. Make it into a class and you can use it for every textfile. There are examples of this on the PHP website (www.php.net) and many others.

Regards,
Jan Paul
KimmoA
Posts: 17
Joined: Thu Jan 06, 2005 2:51 am
Location: Sweden
Contact:

Post by KimmoA »

Jan Paul wrote:A long line is indeed shown as a long line in a browser.
I have found no "wrap" function in a browser until this time.

Do you use Unix style line breaks? There could be a problem too.

The fact that a browser can show text files is just a 'bonus'. It is not another way of showing textfiles with formatting. If you are very keen on keeping the formatting just right, use another program to format things (PDF/Word etc).

Are you just letting users see textfiles without changing the textfiles themselves? That way you never get formatting to work.
If they only need to see a formatted textfile, put an HTML envelope around the textfile and use replace to change the EOL into <BR>.

You can also do a change after the nth column into <BR>. Use a regular expression to do this. There are examples of this in this forum.

An automated tool could be PHP. Then you can read in the textfile, and after the nth position, put in the <BR>. Make it into a class and you can use it for every textfile. There are examples of this on the PHP website (www.php.net) and many others.

Regards,
Jan Paul
I don't have a single problem doing this embedded in HTML. The thing is that I provide the alternative for my users to read the text-file being embedded (user agreement) as pure text, and I'd PREFER if they saw it properly formatted.

:?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Do you have a Mozilla browser?

If so, please view one of your problematic files with it, then in its context menu, select "View Page Info".

What does it say there under "Type" on the "General" tab?
Post Reply