Tag highlighting/hyperlinking broken for multiple valued tags of same name


#1

Hi,

when using the same tag with multiple values, only the first tag is getting correct syntax highlighting and hyperlink functionality.

Sample text to try:

Some text. @tag(1) @tag(2)

This results in the following display, with only @tag(1) receiving syntax highlighting and hypelink functionality:

IMO, @tag(2) should be treated like @tag(1), so that I can hyperlink-search for all lines with a tag value of 2 (by clicking on the digit 2 in the brackets), as well as for all lines with some tag “tag” (by clicking on “tag”). How do I make this work?

I am using FT 2.0.2.

Thanks,
Christian


#2

Not broken – rather, I think, by design.

For every line in the document, the underlying model assigns a unique value for each @keyname (tag name, or attribute).

See the node.tag(tagname) function in the SDK documentation.

A lot of the design depends on a tag/attribute having a unique value for each line - the whole nodePath filtering and search language, for example.

If you add a second tag with the same name to a line, the parser will just have to ignore the first one, and reassign the value of that tag/attribute for the given node/line to your second version of what you want it to be.

Not sure what your use case is, but until Folding Quantum Text comes out, a particular attribute/tag of a given line can’t have a simultaneous superposition of two different values.

Two different tag names, perhaps ?


#3

Thank you for that explanation. And it makes absolute sense when viewing it from the XML-like underlying model with the XPath-like filtering language. In XML terms, what I did, is put two attributes of the same name with different values on an XML element - which does not work in XML, either.

My use case is that I want to attach the numbers (IDs) of documents that are affected by a bug described in the text, like

hyperlinks don't work @doc(21378) @doc(6729)

meaning the documents 21378 and 6729 are affected by that bug. I would then be able to search either for all bugs that manifest in e.g. document # 6729 by clicking on the value 6729, or see a list of all bugs where there is a sample document for by clicking on @doc.

XML has the concept of a value list in attributes (corresponding to FT’s tags), written by space-separating the values. In FT, that would look something like

hyperlinks don't work @doc(21378 6729)

which I know currently does not do what I want (and probably never will).

But knowing now what the technical background is, the correct way to achieve what I want is indeed as you suggest: using different tags. So I would use

hyperlinks don't work @doc @d_21378 @d_6729

which would allow me to:

  • find all lines having document numbers attached by filtering on the generic @doc tag (indicating that fact, and yes, I’d have to do the housekeeping on this myself), and
  • search for all lines that affect e.g. document 6729 by searching for the @d_6729 tag

Thanks again for making me understand this aspect, and suggesting the solution. Highly appreciated!

Regards, Christian


#4

For other folks that run into this problem, another solution might be to add children with the various different values. This works for me in some cases. E.g.,

  • The big hairy bug
    * affected @doc(1234)
    * affected @doc(5678)

It might not be easy within a single document to return the parent via a filtered search, but with the txtquery plugin you can write a query is flexible to do what you want.


#5

Good !

And in addition to @derekvan’s good suggestion of using child nodes and searching for their parents with something like:

//@doc/parent::*

It may also be worth experimenting with searching for matches with the tagname ‘inline attribute’ of the @line property.

i.e. variants of things like:

//@line:tagname beginswith d

Rob


#6

New user. I just stumbled across this problem. I want to do something like “@k(xx) @k(yy)” and be able to find all k and all k(xx), etc.

I’m just checking to see if this is the current state of FT, and that the best work around for me would be to make children outlined above (I’m using more than @k tags so I want this to be as general as possible). Or has anything changed in the last 2 years?


#7

This still isn’t possible in either FoldingText or TaskPaper by design. In the underlying model tags/values are stored in a key value collection. So it’s only possible to have a single instance of each tag in each line. If you could give a more concrete example of exactly what you re trying to represent with your tags I might be able to suggest an alternative.


#8

At the moment, I’m just starting to use FT, I’m using k tags to represent courses and the value as the actual course, p for people and value for the actual person, a for admin task and value for actually what. But since I’ve started to use FT this year I’m easily persuaded to use some other schema (although the “children solution” seem to work well enough at the moment).

I happened to stumble across the desire to mark something with two courses today.


#9

There are a few options that I can think of …

Simplest would be to just tag course directly. Ie @math @science. The would great unless you have lots of tags or want to divide tags into categories.

Next easiest option would be to namespace your tags. So for example @k-math @k-science.

If you really wanted to store the courses as a value on a tag named “k” then my recommendation would be to separate the courses by comma. So for example @k(math,science).


#10

Thanks, I’ll think about this, play a bit and see what works best for me.