Page 1 of 1

Invisibly Tagging Text

Posted: 2016-07-02 04:05:54
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.


Re: Invisibly Tagging Text

Posted: 2016-07-04 05:10:42
by David Sharp
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.

Re: Invisibly Tagging Text

Posted: 2016-07-04 05:29:43
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.


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.

Re: Invisibly Tagging Text

Posted: 2016-07-07 12:41:53
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?

Re: Invisibly Tagging Text

Posted: 2016-07-07 16:25:06
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.


Re: Invisibly Tagging Text

Posted: 2016-07-08 08:13:49
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.