Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Programatically reparagraphinating text

by dsheroh (Prior)
on Feb 16, 2007 at 16:01 UTC ( #600464=note: print w/replies, xml ) Need Help??

in reply to Programatically reparagraphinating text

A couple ideas which come to mind based on your examples, although I don't really expect them to catch 100% of the cases which should be left alone:

- If presented with N or more lines of the same length, it's likely a binary dump or a pinout diagram, so leave it alone. (I'd probably go with N=3, at least initially, but most dumps/diagrams tend to be longer than that, so you could probably use a larger value of N safely.)

- Multiple consecutive lines with leading whitespace are likely to be ASCII art or columnar text, so leave them alone. (Just one line with leading whitespace is more likely to be the start of a paragraph. For extra credit, if a block of indented lines includes one non-indented line, leave it alone, too, since it's likely part of the ASCII art.)

(I know this isn't modules, which is what you said you're looking for, but it looked like you may be looking for rules, too.)

  • Comment on Re: Programatically reparagraphinating text

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://600464]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2020-08-15 07:44 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (78 votes). Check out past polls.