Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

wrap

 [1/2] from: hijim::pronet::net at: 29-Jul-2001 20:40


I've been fiddling with this for a couple of hours, and I've made some [minor] discoveries. 1. A text file written with word wrap will have each paragraph in one line with some kind of newline indicator on the end, so I don't need to join short lines. 2. I don't want to use TRIM since it removes extra spaces and linefeeds. I've taken this action out. 3. The script I was trying to adapt won't wrap properly because it looks for the first space AT or AFTER the required length. A proper wrap should look for the space AT or just BEFORE the required length. 4. I don't know why the first line of each paragraph is not indented ant not usually even wrapped at the right length. I need to insert 5 spaces at the beginning of each paragraph before trying to wrap. The attached script shows several problems with the first line of each paragraph -- no indent, wrapping too soon. Any ideas on this? Jim -- Attached file included as plaintext by Listar -- -- File: wordwrap.r REBOL [Title: "Test of Wrap"] wrap-text: func [para /margin size /local count][ count: 1 if not margin [size: 50] ; default size forall para [ if all [count >= size find/match para " "] [insert para " " ; I added this to indent printing change para newline count: 0] count: count + 1 ] head para ] ;my-file: read %aristotl.txt view layout [ backdrop silver * 1.2 button red "Quit" [quit] ;button "Print File" [print wrap-text my-file] button "Print" [ print wrap-text { What was it, then, that the supreme artificer produced before all things external to itself? What was either necessary or expedient to be produced before that which all other things needed in order to be, and without which they were not able to be, while it was able to be without the others, and it needed none of the others in order to be. For that is necessary that it be before all other things, which, once established,all other things are removed. For Aristotle also said that without it none of the others can be, while it can be without the others, is necessarily first. But that is space itself. For all things, both corporeal and incorporeal, if they are not somewhere are nowhere, if they are nowhere, then neither are they. If they are not, they are nothing.If they are nothing, they will be neither souls, nor natures, nor qualities, nor forms, nor bodies. But it has already been said earlier that these are the grades of things outside the abyss. If these are not,then there will be no entirety of things extrinsic to the abyss. But this is contrary to sense,contrary to all reason. Therefore these are the grades of things; if they are, they are not nowhere. Therefore they are somewhere, therefore they are in a place, therefore they are in space that is either long, wide, or deep, either in two of these, or in three. Therefore space is before all these. } ] ]

 [2/2] from: hijim:pronet at: 29-Jul-2001 21:46


Sorry that won't work. Listar put the file in the email. Now it has linebreaks at the end of each line. I'll post the file at http://www.geocities.com/~jimclatfelter/wordwrap.txt Jim