Reply to topic  [ 5 posts ] 
Cleaning up punctuation triggers but? 
Author Message

Joined: 2007-03-03 09:55:06
Posts: 494
Location: Europe
For years I have used a modified version of the Cleaning up Punctuation macro that comes with NWP. From v. 2.0.4 on I noticed a strange behavior caused by an apparent bug in line 11 (of the original version.) The line runs thus:
Code:
Find and Replace ‘\s*([,.;:\!\?])‘, ‘\1’, ‘aE’

I think that \s* should rather be \s+, but this is not the point. The point is that, given a condition, this macro triggers a (supposed) bug. Take this excerpt, for example:

Quote:
It is possible to distinguish two main types of reaction among those who conceded his central argument. In the first place, there were those who thought that the loss of efficiency, the decline in general wealth that will be the effect of the absence of a means of rational calculation, would not be too high a price for the realization of a more just distribution of this wealth. Of course, if this attitude is based on a clear realization of what this choice implies, there is no more to be said about it, except that it seems doubtful whether those who maintain it would find many who would agree with their idea.
The real difficulty here is, of course, that for most people the decision on this point will depend on the extent to which the impossibility of rational calculation would lead to a reduction of output in a centrally directed economy compared with that of a competitive system. Although in the opinion of the present writer it seems that careful study can leave no doubt about the enormous magnitude of that difference, it must be admitted that there is no simple way to prove how great that difference would be. The answer here cannot be derived from general considerations but will have to be based on a careful comparative study of the working of the two alternative systems and presupposes a much greater knowledge of the problems involved than can possibly be acquired in any other way but by a systematic study of economics.


Two parts of the text have been italicized. Each ends with a punctuation mark.
This is the outcome upon running the macro:

Quote:
It is possible to distinguish two main types of reaction among those who conceded his central argument. In the first place, there were those who thought that the loss of efficiency, the decline in general wealth that will be the effect of the absence of a means of rational calculation, would not be too high a price for the realization of a more just distribution of this wealth. Of course, if this attitude is based on a clear realization of what this choice implies, there is no more to be said about it, except that it seems doubtful whether those who maintain it would find many who would agree with their idea.
The real difficulty here is, of course, that for most people the decision on this point will depend on the extent to which the impossibility of rational calculation would lead to a reduction of output in a centrally directed economy compared with that of a competitive system. Although in the opinion of the present writer it seems that careful study can leave no doubt about the enormous magnitude of that difference, it must be admitted that there is no simple way to prove how great that difference would be. The answer here cannot be derived from general considerations but will have to be based on a careful comparative study of the working of the two alternative systems and presupposes a much greater knowledge of the problems involved than can possibly be acquired in any other way but by a systematic study of economics.


As you can see, the italicized text has been expanded. There are italicized parts that were previously plain. This is true with bold too, whether superimposed or enforced through a style.
In its unmodified form, the macro selects any punctuation mark, preceded or not preceded by white space, and changes the selection into the punctuation mark alone. Changing line 11 into this:
Code:
Find and Replace ‘\s+([,.;:\!\?])‘, ‘\1’, ‘aE’

the macro works OK. So \s* seems to be the culprit.

Best regards, Henry.


2012-09-04 02:45:57
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Hi Henry- from what you describe that sounds like a bug, but I haven't been able to reproduce it. I'm thinking that could have something to do with the formatting in your actual document, as compared to the formatting I get when I copy-paste content from Safari. Would you be able to post your sample text snippet as a NWP document? Or you could send it to me via the menu Help > Send Feedback if you prefer.

Thanks for your help!


2012-09-04 23:15:29
Profile WWW

Joined: 2007-03-03 09:55:06
Posts: 494
Location: Europe
Here it is, along with the original NWP macro. I ran the macro on it minutes ago and the result is always the same.

Note that, though I use a modified version of the macro, I left line 11 quite intact. I only substituted \s+ for \s* when I realized it was causing the glitch. Also, \s* uselessly forces the macro to search for a punctuation mark preceded or not preceded by white space. \s+ works OK.

Greetings, Henry.

Attachment:
Archive.zip [6.75 KiB]
Downloaded 303 times


2012-09-05 00:02:52
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Thank you for the sample file Henry- with it I've been able to reproduce the unwanted spreading of formatting. This is definitely some kind of bug in the find/replace command, and we'll take a look at getting it fixed. Thanks again.


2012-09-05 12:54:59
Profile WWW

Joined: 2007-03-03 09:55:06
Posts: 494
Location: Europe
Thank you

Henry.


2012-09-05 23:03:38
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software