Re: adding blank lines when wrapping quotes? and merging quicktemplates?
Hello Domagoj, On Monday, June 16, 2003 at 14:37 GMT +0200, electricians were shocked that Domagoj Klepac [DK] potentially scribbled: DK If (there's a capital letter at the start of a new line) AND (the DK previous line ends before wrapcolumn minus length of first word DK in the new line) DKinsert new line DK else if (there's two or more spaces or tab in the start of a new DK line) A quibble with this condition: what if all the text is indented, like: This is some test text. It really doesn't matter what I type here, just so long as I have a few lines. After all, this is just a demo of an indented paragraph. DKinsert new line DK else DKdo nothing DK end if snip DK But I don't think this can be done in TB!. :( :) Well, it can be done, but it would be a *lot* of work, especially in the release version. Even with some of the new features in the beta version, this would involve multiple recursive templates and non-trivial ones at that. But it could be done if someone was enterprising enough...* -- Thanks for writing, Januk Aggarwal * I no longer have time to be that enterprising, at least not on a volunteer basis. http://www.silverstones.com/thebat/TBUDLInfo.html
Re: adding blank lines when wrapping quotes? and merging quicktemplates?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday, June 17, 2003, 8:32:38 AM, Januk wrote: DK If (there's a capital letter at the start of a new line) AND (the DK previous line ends before wrapcolumn minus length of first word DK in the new line)insert new line else if (there's two or DK more spaces or tab in the start of a new line) A quibble with this condition: what if all the text is indented, like: This is some test text. It really doesn't matter what I type here, just so long as I have a few lines. After all, this is just a demo of an indented paragraph. I thought about that - I don't know how likely it is that somebody uses both idents and no paragraph separation in e-mails. I ran into maybe two or three people (of God knows how many thousands) doing idents in last 10 years. But on the other hand, I didn't run into many people not breaking the paragraphs also. :) But I suppose that you could rework my algorithm to include those also. :) Domchi -BEGIN PGP SIGNATURE- Version: 6.5.8ckt Comment: KeyID: 0x33FAB7E4 Comment: Fingerprint: FD16 4946 03AF 4E93 5B0F EE8B B81E AA54 33FA B7E4 iQA/AwUBPu7peLgeqlQz+rfkEQJtwQCffFPMxawNopzjbwsLStEcvkPy3yQAoPHm Ayamm+hTjz+GlezYHxiNuAtB =vmY2 -END PGP SIGNATURE- http://www.silverstones.com/thebat/TBUDLInfo.html
Re: adding blank lines when wrapping quotes? and merging quicktemplates?
On Mon 16-Jun-03 4:58am -0400, Dimka wrote: Hey there, Bill McCarthy! i receive messages that are poorly broken up into paragraphs [...] B That's impossible to do reliably without artificial intelligence. B If you think I'm wrong, try writing a rule in plain English B that's detailed enough to write a PCRE macro from it. What about this: If there's a capital letter in the start of a new-line, then insert a new line. Let's add that the prior line end with a '.' or '?' followed by optional white space. That should work 80% of the time, with silly errors. :) This macro would be helpful for me too. Can any one make it? Here's a starting point (a mod of Januk's work): 8--- start w2 - %Comment=%ClipBoard%- %QInclude=w2sub%- %Comment=%- 8 end w2 -- 8 start w2sub - %if:'%Comment'='':'':'%- %- %Wrapped=_%SetPattRegExp=(?s-m)^(.*?[.?])(\s*\n([A-Z].*)\s*$|.*\z)%- %RegExpBlindMatch=%Comment%- %SubPatt=1_ %Comment=_%SetPattRegExp=(?s-m)^(.*?[.?])(\s*\n([A-Z].*)\s*$|.*\z)%- %RegExpBlindMatch=%Comment%- %SubPatt=3_%- %QInclude=w2sub' 8 start w2sub - -- Best regards, Bill http://www.silverstones.com/thebat/TBUDLInfo.html
Re: adding blank lines when wrapping quotes? and merging quicktemplates?
Hello Charlie, An archeological dig discovered that on Saturday, June 14, 2003 at 21:43 GMT +1000, Charlie Laidlaw [CL] chiseled the following: CL 1. If anyone could modify ReWrap to do this for me, i'd be very grateful. CL I would guess that that detecting a long string of blanks would be the CL best trigger to somehow make it skip a line? You can try something like: =[Begin replacement wrap2]= %REM=This is a specialized version of the wrap2 template. It is modified to require 5 or more spaces and a new-line as the delimiter for paragraphs. Modified June 14, 2003 by Januk Aggarwal %- %IF:'%- %SETPATTREGEXP=(?is-m)[^\n]+%- %REGEXPMATCH=%COMMENT''':'%- %- %WRAPPED=_%SETPATTREGEXP=(?is-m)^(.*?)(\s{5,}\n(.*)\s*$|\z)%- %-%-%-%-%-%REGEXPBLINDMATCH=%COMMENT%- %-%-%-%-%-%SUBPATT=1_ %COMMENT=_%SETPATTREGEXP=(?is-m)^(.*?)(\s{5,}\n(.*)\s*$|\z)%- %-%-%-%-%-%REGEXPBLINDMATCH=%COMMENT%- %-%-%-%-%-%SUBPATT=3_%- %QINCLUDE=wrap2' =[ End replacement wrap2]= I can't exactly try this template because of changes in the current beta, but that should work. It detects 5 or more spaces followed by a newline character as the delimiter between paragraphs. CL 2. I quite like the look of Marck's 'Quote Extraction' also CL www.silverstones.com/thebat/Library.html#quote+extractionlooks . So CL i'd also like my replies to first execute Marck's Quote Extraction on CL the original letter, and then Januk's ReWrap on the extracted CL cleaned-up material. How can i do this? You need a driver template for wrap2 anyway, so you can specify what you feed it. Try something like: =[Begin driver template]= %Comment=%QInclude='quote extraction QT'%- %QInclude=wrap2%- %Comment=%- =[ End driver template]= -- Thanks for writing, Januk Aggarwal Using The Bat! 1.63 Beta/11 under Windows 98 4.10 Build A http://www.silverstones.com/thebat/TBUDLInfo.html
Re: adding blank lines when wrapping quotes? and merging quicktemplates?
Hello Charlie, On Sunday, June 15, 2003 at 12:28 GMT +1000, a stampede was started when Charlie Laidlaw [CL] hollered: CL you make perfect sense Peter, though Januk seems to think it may be CL possible with a small solution. i have no clue about this, as i'm sure CL you can tell. thanks for replying to my query. Don't get me wrong. What Bill and Peter told you is quite correct. I made a *very* simplistic engine based on your statement that the paragraphs always end with a bunch of white space characters and a new line. Mine was by no means a general solution. I also would not have been able to test the text you pasted in because TB will strip trailing spaces. So even if they did exist in the source, it is very unlikely that I would have seen them in your post. -- Thanks for writing, Januk Aggarwal http://www.silverstones.com/thebat/TBUDLInfo.html