Page 1 of 1

Provide Paragraph Markers & not double Line Breaks <b

Posted: Tue Aug 23, 2005 2:16 pm
by MoBuc
When writing long textual content to be copy/pasted into FrontPage, Dynamic Content File or to a Database for Dynamic Content, the new paragraphs show up as double line breaks. This is especially a problem when one copy/paste from another source into TextPad. This creates a 'time-expensive' problem using Embedded or External CSS elements targeted for paragraph tags that dynamically are created by reading paragraph markers (e.g. MS Word, WordPad, etc).

Adding a menu choice (similar to 'tabs to spaces' in Preferences) to use a paragraph marker in place of double line breaks or Paragraph marker when Line Break w/o addtional content would be a time saving helper.

Otherwise, I must create or copy/paste my content & monitor the word counter in TextPad. Then, go back through the document and manually place HTML paragraph tags to open and close paragraphs. Then, re-edit my Style sheet, ASP reader method, and HTML to expect pre-existing <p> tags and not the paragraph marker in my Database or content text file.

Let's have the paragraph marker preference choice.

Posted: Tue Aug 23, 2005 2:53 pm
by ben_josephs
I don't fully understand what you need, but can you solve part of your problem with Search | Replace using regular expressions?
Find what: \n\n
Replace with: </p>\n<p>

[X] Regular expression
It replaces each pair of new line characters with a closing paragraph tag, a new line, and an opening paragraph tag. You'll need to add the first <p> and the last </p> separately.

Provide Paragraph Markers & not double Line Breaks

Posted: Tue Aug 23, 2005 5:05 pm
by MoBuc
Ben_Josephs, Thanks for the rapid reply & suggestion for Regular Expressions. I confess 2B very novice using Reg Ex.

Where I copy/paste existing text, with 'Hard Line Breaks' this may not help. As, every Hard Break would become a paragraph. (Unless I monitor each line 'Replace')

However, most of my text is 'Soft Break' or written by me as a continuous string until End of Paragraph. For these cases, I think you've solved my problem! :D

My only concern here, is...Does this work-around actually replace TextPad 'new line' with a 'new paragraph' or are we substituting the 'new line' with an HTML paragraph tag (which is not what I need). I'll play with this a little later.

Once again, I thank you very much for your help!

Re: Provide Paragraph Markers & not double Line Breaks

Posted: Tue Aug 23, 2005 8:23 pm
by ben_josephs
MoBuc wrote:Where I copy/paste existing text with 'Hard Line Breaks' this may not help. As every Hard Break would become a paragraph (unless I monitor each line 'Replace')
Are your "hard breaks" just new-line characters (or sequences), whatever they are in the type of file you are handling (LF, CR or CR,LF)?

My suggestion will only convert pairs of new-line characters (which appear as a blank line in a text editor such as TextPad), not single ones.
MoBuc wrote:However, most of my text is 'Soft Break' or written by me as a continuous string until End of Paragraph.
Are your "soft breaks" in fact not characters in the text at all, just changes to a new line made dynamically at appropriate places by whatever is displaying the text?
MoBuc wrote:For these cases, I think you've solved my problem! :D
Good!
MoBuc wrote:My only concern here, is...Does this work-around actually replace TextPad 'new line' with a 'new paragraph' or are we substituting the 'new line' with an HTML paragraph tag (which is not what I need).
A "TextPad new line" is just a standard new-line character. See above. I do not know what you mean by a "new paragraph". It is not a character defined in ASCII or ISO-8859-1 (Latin1) or Microsoft CP1252 (WinLatin1) (although Unicode has a paragraph separator: U+2029, which TextPad cannot handle).

My suggestion does indeed insert paragraph tags.

Posted: Wed Aug 24, 2005 12:01 am
by MoBuc
MoBuc wrote:
Where I copy/paste existing text with 'Hard Line Breaks' this may not help. As every Hard Break would become a paragraph (unless I monitor each line 'Replace')

Are your "hard breaks" just new-line characters (or sequences), whatever they are in the type of file you are handling (LF, CR or CR,LF)?
Honestly, I dunno. I only see the 'line-break' character visible in TP after I paste. I usually, highlight-then, reformat to make each paragraph (original text) into single lines of string text. This simplifies my reading the text strings into ASP variables.

My suggestion will only convert pairs of new-line characters (which appear as a blank line in a text editor such as TextPad), not single ones.

My wife's DOB day so, I can't test this tonight but- I will later this week & let U know my results.

MoBuc wrote:
However, most of my text is 'Soft Break' or written by me as a continuous string until End of Paragraph.

Are your "soft breaks" in fact not characters in the text at all, just changes to a new line made dynamically at appropriate places by whatever is displaying the text?

Yes, not true characters. I'm merely using the language of TP preferences.

MoBuc wrote:
For these cases, I think you've solved my problem! :D

Good!

MoBuc wrote:
My only concern here, is...Does this work-around actually replace TextPad 'new line' with a 'new paragraph' or are we substituting the 'new line' with an HTML paragraph tag (which is not what I need).

A "TextPad new line" is just a standard new-line character. See above. I do not know what you mean by a "new paragraph". It is not a character defined in ASCII or ISO-8859-1 (Latin1) or Microsoft CP1252 (WinLatin1) (although Unicode has a paragraph separator: U+2029, which TextPad cannot handle).
My suggestion does indeed insert paragraph tags.


I apologize for my ignorance. I assumed that the paragraph marks of Word Processors were indeed printer characters. I will code my file input to handle the HTML <p> character. By all appearance I believe U have offered a good work-around. :)

Your Solution Works Nicely

Posted: Wed Aug 24, 2005 9:14 pm
by MoBuc
Ben_Josephs,

Your work-around does the trick nicely. ( \n\n ... </p>\n<p> ) I'm just glad I discovered this before I started designing my dynamic input. Thanks again for the quick help! :D

BTW- I still haven't grapsed Regular Expressions! :oops:

Posted: Wed Aug 24, 2005 10:10 pm
by ben_josephs
You're welcome. I'm glad to be able to help.

There are many regular expression tutorials on the net.

If you want to get more deeply into them, a standard reference for regular expressions in all their varieties is

Friedl, Jeffrey E F
Mastering Regular Expressions, 2nd ed
O'Reilly, 2002
ISBN: 0596002890
http://regex.info/

Posted: Thu Aug 25, 2005 1:19 am
by Tomas Eklund
This is another great resource for learning regular expressions: http://www.regular-expressions.info/

If you think regular expressions seems intimidating (they can be) you might want to try RegexBuddy which is (kind of) a visual tool for crafting regular expressions. (Disclaimer: I haven't used or even tried it myself.) One thing to remember, though, is that the regexp engine of TextPad 4.x is a bit crippled compared to most other regexp enabled applications. We all expect that to change in TextPad 5 but until then you might want to start by just looking in TextPads help file for what operators are supported. Some of the regular expressions made with RegexBuddy are likely to cause trouble with TextPad for the time being because of the limited subset of regular expressions that TextPad supports.

Posted: Thu Aug 25, 2005 6:52 am
by ben_josephs
Another tip: If you care for your sanity I strongly recommend that you use Posix regular expression syntax:
Configuration | Preferences | Editor

[X] Use POSIX regular expression syntax
This considerably reduces the number of backslashes (\) you need in most non-trivial regular expressions. (It doesn't affect the expresion I suggested earlier.)

RegExp: Resources & Sanity

Posted: Thu Aug 25, 2005 11:35 am
by MoBuc
WOW! This is the most helpful & 'cut-to-the-chase' BB or BLog that I have come across in a long time.

I did a 'quickie' view of the RegExp URLS that you've offered. Tom Eckland is correct about the "intimidation". I will keep Ben_Joseph's sanity 'Saver' in mind as I begin to use these resources.

I'm currently learning ASP (VBScript), ADO, VBA, CSS & SQL (as needed). Now RegExp- Man! I feel like a pre-schooler looking ahead to requirements of a college degree. :shock: My 'nerd-iness' (With a touch of 'cool') shall prevail :!: :lol:

Any ASP resources that U like :?:

Posted: Thu Aug 25, 2005 12:01 pm
by Tomas Eklund
As for ASP resources, the one I really rely (heavily) upon is the Microsoft Windows Script V5.6 Documentation. It's perhaps not an ASP resource per se but rather a VBScript/JScript language reference. The help file also includes a FileSystemObject reference and some other stuff. However, I'm still using classic ASP with JScript (and have been for a while so I'm not really learning - just looking up stuff I've forgotten). If you're in a learning process you might want to go directly to ASP.NET with C# (I would) and then this tip is useless.

ASP/ASP.NET

Posted: Sun Aug 28, 2005 7:35 pm
by MoBuc
Tomas Eklund wrote:As for ASP resources, the one I really rely (heavily) upon is the Microsoft Windows Script V5.6 Documentation. It's perhaps not an ASP resource per se but rather a VBScript/JScript language reference. The help file also includes a FileSystemObject reference and some other stuff. However, I'm still using classic ASP with JScript (and have been for a while so I'm not really learning - just looking up stuff I've forgotten). If you're in a learning process you might want to go directly to ASP.NET with C# (I would) and then this tip is useless.


Hhm...Ok, ASP is older and ASP.NET is newer technologies. I know that my current W2kPro Laptop, and my W2KServer Tower, plus Office 2K Pro, and FrontPage 2K, have all the supporting programs software that I need to fully use ASP. I need not spend more money (right now) until my little Home Based Business (HBB) grows to self-supporting. (I ain't Bill Gates yet! :!: )

Eventually, I will research answers to my questions but since U introduced the idea let me ask ... 1) Are programming gains in ASP.net worth the effort to master over ASP? 2) Does ASP.NET require my buying new software/compilers/translators? 3) With the millions of free support for ASP all around the world, what of the expense to learn to use ASP.net? I own and use 4 books on ASP 2.0 & 3.0, 3 books on ADO/VBA, 2 books on CSS 2.0, 3 books on MS Access DBs, and a bunch of HTML stuff. :oops:

I'm open to opinions on switch or not...maybe I should close this & start a new thread in another forum. :idea:

Re: ASP/ASP.NET

Posted: Sun Aug 28, 2005 10:05 pm
by Tomas Eklund
MoBuc wrote:maybe I should close this & start a new thread in another forum.
Yes, perhaps you should... ;-) I'll just try to answer briefly, as good as I can, since you asked. Note that I have NO experience with ASP.NET and perhaps I really shouldn't answer at all. I do anyway.

1) I believe so. I am under the impression that .NET provides the developer with a multitude of ready to use libaries, much like the Java libraries. This should mean that once you master .NET, development will be faster and your applications more robust because you don't need to reinvent the weel all the time. I also believe there are other benefits with .NET such as better and more developed programming languages, faster execution, better support for multilingual development, better separation of logic and presentation etc.
2) I think that all you really need is the free downloadable .NET framework from Microsoft. (No need to get Visual Studio .NET unless you really want it.)
3) If you are planning on making a career as a developer, perhaps you should learn both classic ASP and ASP.NET. Then you don't need to throw away any of those books. For .NET you can at least keep the CSS, HTML and Access books. There will probably be more free copy/paste resources for classic ASP for quite some time though.

But you really need more than my petty opinion on this. I can see that I'm really not helping. :roll: