Geek Speak — HabitableZone

Geek Speak » in reply to If you would replace insertion of

Possible, but not advised

A paragraph is defined by more than a double linebreak before and after--i.e., it's not just an interruption of the flow of text--it's both a lexical unit and logical element of the document structure. The practical effect of what may sound like just a theoretical concern is that a paragraph (represented by the P tag pair) can be styled with the features appropriate to a paragraph: Space before and after, line spacing, internal padding, and left- and right-indents (and about a hundred more; but those are the common ones). Double-BR sequences don't form a paragraph and the islands of text that they delimit can't be styled like paragraphs.

A second reason for doing it this way is to distinguish between the writer's intent to create a new paragraph versus the intent to just break the line but not end the paragraph. For example
this line fragment
is still part of the paragraph, but it's delimited by a single carriage-return before and after. Any styling applied to the paragraph of which it's a part applies to the line fragment as well. BR is a format-modification tag, but it doesn't have the shoulders to carry any formatting itself.

I've been generally negative to your suggestions, but don't take it personally, David. Over the years I've found that writing software to operate on text created by humans is one of gnarliest challenges around. Computers are logical and deal well with data in a uniform and repeatable format, and computers process text generated by other computers quite well. If there's one thing a computer does well, it's following the rules, and if you give a computer the rules of grammar and syntax, by God it'll produce grammatical and syntactically perfect text, and another computer knowing the same rules will interpret it perfectly. But human writing is rarely that disciplined and more often than not the idiosyncracies cause computer filtering algorithms to crash and burn. I've learned the hard way that I can get away with a few things like detecting sequences of line endings and making generally good guesses about paragraphs and line breaks, but beyond that it gets exponentially hairy. I wouldn't rush in where I fear to tread.

In other words, I'm just happy the filter works as well as it does. Gives me the shivers contemplating trying to tinker with it.

Log in or register to post.

The whole thread (13 posts)