Invisibly Tagging Text

Everything related to our flagship word processor.
Post Reply
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Invisibly Tagging Text

Post by adryan »

G’day, all

I know no one is likely to pursue this idea, but I have thought of a way of invisibly tagging text in Nisus Writer. [The problem was suggested by David’s use of styles to tag text in a very long document (see thread: Long delays on "Open": display of TOC), but I thought it best to extract this particular topic into a separate thread.]

The idea is to use zero-width non-joiners which encode the desired information. One possibility: the number of contiguous such characters acts as an index for a given tag (which might actually combine several keywords such as “dream” and “holiday”) in a list of tags. Another possibility: a single such character could be colored to represent a given tag, so a succession of several such characters could represent a combination of different tags. Specific tags can then be located easily by attribute-sensitive Find/Replace. (Yes, it really does unmask them!) One would probably wrap the whole thing in macros and a glossary in order to make it as practical as possible. The method I have described should help to keep the filesize of the main document as small as possible.

I am under no illusion that RGB coloring of zero-width non-joiners is going to become the latest craze, but it bugged me that there seemed to be no obvious way to add invisible tags to text in Nisus Writer.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
David Sharp
Posts: 67
Joined: 2008-07-06 23:21:27
Location: Paris, France
Contact:

Re: Invisibly Tagging Text

Post by David Sharp »

Hi,
I'm not sure how desirable this is; I'm aware the example I gave in the recent thread mentioned by adryan is both eccentric and improvised.
However it occurs to me that a simpler approach to what adryan suggests would be to make certain content hideable and/or deleteable within a document.
Instead of tagging text invisibly, the idea would be to make the tags visible by default, but invisible when required. This would eliminate the need for complicated zero-width characters and user-defined codes for tags.

I'm very much a beginner with macros, but I think there are probably already scripts available that would allow something like that.
User avatar
xiamenese
Posts: 543
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Re: Invisibly Tagging Text

Post by xiamenese »

Could I just point out that Keith Blount, of Scrivener fame, spent a long time trying to find a way to make text—in the case of Scrivener, inline annotations and footnotes—invisible in response to multiple requests on the Scrivener forum? Even the leading engineers at Apple working on the text engine, whose help he enlisted couldn't succeed, so it's never happened.

Mind you, maybe the wizards at Nisus have some sort of text-fu that even the Apple engineers don't have.

Mark

P.S. The evidence for my assertion is way back in the forum, in a post by Keith somewhere around 2009, I'd guess, but I'm not going to go back and look.
Vanceone
Posts: 211
Joined: 2013-05-03 07:06:31

Re: Invisibly Tagging Text

Post by Vanceone »

This is really a limitation of the Cocoa RTF engine; I've no idea why it doesn't implement the RTF tag that exists (and has for decades, no less!) for hidden text.

Since hidden text is already part of the RTF spec, it would seem like a simple matter for Nisus to recognize the RTF tag; why they don't I have no idea. Particularly as it would give them a feature to compete with every other Cocoa RTF-based word processor. Microsoft Word, of course, has hidden text and has for decades.

In actuality, one of the things I miss most about Word is their field codes. In particular, I would love to be able to add field codes of my own to Nisus; sort of a way to add meta-data to selected text. Your idea is intriguing, adryan.

Have you actually tried to see if this is possible?
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: Invisibly Tagging Text

Post by adryan »

G’day, Vanceone et al

Regarding my proposed scheme, David rightly observes, “I'm not sure how desirable this is”. Answer: It’s not at all desirable! I merely took it on as an intellectual exercise and posted this “solution” as part of our collective endeavor to document all the nuances of our favorite word processor.

I have not bothered to implement the idea in all its technicolor detail, but I have done enough to see that it does work.

I was going to add that I could see no reason why a software engineer could not create a special tag that tells the word processor interpreter that text within its scope (viz, the tag itself) is not to be displayed. Vanceone suggests this has already been done elsewhere. I wonder whether a problem could arise with respect to compatibility when displaying the RTF file in various word processors in various operating systems.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
Vanceone
Posts: 211
Joined: 2013-05-03 07:06:31

Re: Invisibly Tagging Text

Post by Vanceone »

That's the thing: the RTF "Hidden" tag already exists in the RTF spec and has since, I don't know, the mid 90's? Long before the Cocoa RTF interpreter came along, that I know. So why doesn't that RTF interpreter, which Nisus uses, read it? Who knows?

That said, if you actually examine the RTF codes of a Nisus document, you'll note that Nisus has extended the RTF spec a fair amount already. RTF since I think version 2 back in the late 80's (before Word 5.1, I think, even) had a standard where if an application doesn't recognize a RTF code it just ignores it. Nisus could either just use the already there hidden text tag ( it's /v, for the curious) or implement their own. Other RTF programs would ignore it.

It's so frustrating; I've actually tried to use the hidden test tag by manually building an RTF file in a text editor (i's a bit like building an xml file), but while I can write pure RTF and have Nisus read it, when I put in the hidden text field it's not read and in fact the text marked "hidden" is actively deleted by NIsus, and actually I suspect by the Cocoa RTF interpreter.

Of course, manually building RTF is not the standard use case for Nisus, so that's not a huge surprise.

So anything that sort of works is a welcome improvement over what we have now, which is nothing. I wish Martin would chime in, but he's not posted for a couple of months I think.
Post Reply