Linking documents to a “style collection” — Is it possible?

Everything related to our flagship word processor.
Post Reply
Xuanying
Posts: 6
Joined: 2018-11-15 13:37:36

Linking documents to a “style collection” — Is it possible?

Post by Xuanying »

The Style Library is one of the many genial features of Nisus Writer. I’m writing a book made of several chapters, and each chapter is at present a separate file. Even though I’m still writing drafts, I like to see some degree of consistency, therefore I use styles. I save the styles of one chapter into a “style collection” specifically for this book in the Style Library, and then I import those styles into another chapter.

Sooner or later, I edit one of the styles in one of the chapters. Problem is, after I save it to that “style collection”, I should remember to open all other chapters of my book and import the changed style in each of them, one by one, in order to maintain the consistency.

My question: Is there way to link files to a particular “style collection”, so that if a style is edited in any of those files, it is automatically imported into another file next time I open it?

Xuanying
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Linking documents to a “style collection” — Is it possible?

Post by phspaelti »

If you insist on "automatic", this is not possible. A style library is simply a repository of styles that you can reuse. If you edit the styles later, the documents that have been created using earlier versions of the library are not changed in any way.
What you can do is, once the library has been changed, re-import the library into the document and then resolve the style conflicts by choosing "replace existing styles". I would think this is less error-prone than importing/copying only the changed style.

Now you could make this "semi-automatic" in a number of ways: Method 1 Create a macro that imports the style library to every file in a selected group (for example using the Document Manager). With this method you would have to remember to run it when you have made changes to the style library. Method 2 Create a macro "Open File Using Style Library", which imports the style library each time you open the file. But with this later method, you would have to remember to use this macro to open the file.
philip
Amontillado
Posts: 41
Joined: 2019-06-20 11:13:06

Re: Linking documents to a “style collection” — Is it possible?

Post by Amontillado »

This is very lightly tested. If I load a Nisus document and run this macro, it replaces existing styles with my Novel style library.

If your style sets all have the same style names, then you could create one "golden" copy of your styles. Open each of your documents in turn and this will save a few keystrokes.

Code: Select all

$doc = Document.active
File.requireAccessAtPath “~/Documents/Nisus Documents/Style Library/Novel.rtf"
$styleDoc = Document.open "~/Documents/Nisus Documents/Style Library/Novel.rtf"
$doc.addStyles $styleDoc.allStyles, "replace"
$styleDoc.close
Obviously, that's pretty primitive. The name of the style library, "Novel.rtf", is hardcoded at two locations. Icky, but it seems to work.

Corrections and suggestions welcome!
Post Reply