Compare Documents macro: Perl syntax error

Get help using and writing Nisus Writer Pro macros.
Post Reply
Bob Stern
Posts: 170
Joined: 2006-03-12 12:32:47

Compare Documents macro: Perl syntax error

Post by Bob Stern »

The Compare Documents macro at:
https://nisus.com/pro/macros/browse.php ... y=Document

no longer runs because of a syntax error arising from changes in Perl.

The fix is to insert a backslash before the left brace { in this line of the macro:
$diffRTF =~ s/(?x)({\\colortbl;\\red255\\green255\\blue255;)

Details of possible interest to Martin:
The error message when running the macro is:
"Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.32), passed through in regex"
My version of Perl is v5.30.3, so it should not be a fatal error, but perhaps NWP's macro engine cannot tolerate Perl messages to stderr.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Compare Documents macro: Perl syntax error

Post by martin »

Thanks for the heads up Bob! This error/change should already be fixed in the macros distributed inside the app itself, but I need to fix the file in the online repository. I hope this snag didn't give you too much trouble.
Bob Stern
Posts: 170
Joined: 2006-03-12 12:32:47

Re: Compare Documents macro: Perl syntax error

Post by Bob Stern »

Thanks, Martin. It was my fault. A long time ago I renamed the original macro and moved it into the top level Macros folder, so I never discovered that you had updated and improved the original macro.

It seems that when the Macros menu is populated, aliases and symlinks are ignored. Would that be an easy feature to add? (Famous last words, right?)
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Compare Documents macro: Perl syntax error

Post by martin »

Bob Stern wrote: 2022-07-20 11:48:40 It seems that when the Macros menu is populated, aliases and symlinks are ignored. Would that be an easy feature to add? (Famous last words, right?)
This used to be possible, but the problem now is sandboxing. There's no way for Nisus Writer to automatically gain access when following such redirections to other folders. The macOS system won't allow it.

However, Nisus Writer does have a feature intended to help remedy this situation: the menu Macro > Add Subfolder to Menu as Alias which does the necessary rigamarole to capture sandboxing permissions. I hope that helps!
Bob Stern
Posts: 170
Joined: 2006-03-12 12:32:47

Re: Compare Documents macro: Perl syntax error

Post by Bob Stern »

Thanks, Martin, but that does the opposite of what I wanted, which was to make my favorite macros appear in the top level of the Macros menu instead of a sub-menu.
Abdassamad
Posts: 8
Joined: 2007-10-17 07:53:40

Re: Compare Documents macro: Perl syntax error

Post by Abdassamad »

Hello,

For some reason the Compare Documents has been working fine for several days work on chapters of a book I'm typesetting, but today it stopped and I get this message repeatedly, which I am unable to decipher. Any clues?

Perl reported an error:
diff: unrecognized option `--old-group-format=<<-%<->>'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-I pattern] [-F pattern] [-L label] file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-F pattern] -C number file1 file2
diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
[--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
[-F pattern] -U number file1 file2
diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
[-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
[--ignore-blank-lines] [--ignore-case] [--minimal]
[--no-ignore-file-name-case] [--strip-trailing-cr]
[--suppress-common-lines] [--tabsize] [--text] [--width]
-y | --side-by-side file1 file2
diff [--help] [--version]

Thank you in advance.

Regards,

Abdassamad Clarke
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Compare Documents macro: Perl syntax error

Post by martin »

Abdassamad wrote: 2022-12-20 08:22:32 For some reason the Compare Documents has been working fine for several days work on chapters of a book I'm typesetting, but today it stopped and I get this message repeatedly, which I am unable to decipher. Any clues?

Perl reported an error:
diff: unrecognized option `--old-group-format=<<-%<->>'
This is a problem on certain newer versions of macOS. Apple removed that option from the system "diff" tool. Luckily it's not necessary for the macro to operate correctly. Please use the attached macro instead, which has been updated to remove the missing option.
Attachments
Compare Documents.nwm.zip
(7.85 KiB) Downloaded 145 times
Post Reply