nisus.com
https://www.nisus.com/forum/

Improving the Form Paragraph macro
https://www.nisus.com/forum/viewtopic.php?f=17&t=3777
Page 1 of 1

Author:  vitaka [ 2010-06-05 10:53:11 ]
Post subject:  Improving the Form Paragraph macro

How could I modify the Form Paragraph macro (Find and Replace '(\S)[\t\x20]*\n(?![\n>])', '\1\x20', 'EasS') so that it first removes blank lines, as in the Add Remove Blank Lines macro, so that I can form a paragraph even across paragraphs that contain blank lines?

Author:  martin [ 2010-06-06 13:39:48 ]
Post subject:  Re: Improving the Form Paragraph macro

You could go about this two ways. The first would be to just combine the relevant lines of code from both macros and run them in succession:
Code:
# First delete all blank paragraphs
Find and Replace ‘\n\n+’, ‘\n’, ‘EasS’

# Combines selected lines into one paragraph
Find and Replace '(\S)[\t\x20]*\n(?![\n>])\x20*', '\1\x20', 'EasS'

Or you could modify the "Form Paragraph" search expression so that it matches empty paragraphs as well:
Code:
Find and Replace '(\S)[\t\x20\n]+(?!>)\x20*', '\1\x20', 'EasS'

Author:  vitaka [ 2010-06-07 20:27:30 ]
Post subject:  Re: Improving the Form Paragraph macro

Awesome! I like the second solution more elegant. Thanks!

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/