Page 1 of 1
Automatically set @keys attribute for new topics
Posted: Mon Mar 09, 2020 9:05 pm
by chrispitude
An increasingly common DITA best-practice is to define @keys values for all topic references, then use keyrefs instead of hrefs for references to topics and their contents.
Currently, users must remember to set the @keys value each time they create a new topic in the map. This is error-prone.
It would be great if Oxygen could provide an option to set this automatically:
- new_topic_keys.png (36.66 KiB) Viewed 2665 times
Re: Automatically set @keys attribute for new topics
Posted: Tue Mar 10, 2020 10:22 am
by Radu
Hi Chris,
Thanks for the suggestion, based on a previous request of yours we have an issue logged with ID EXM-40196.
We'll update this forum thread when the issue is implemented.
Regards,
Radu
Re: Automatically set @keys attribute for new topics
Posted: Wed May 20, 2020 12:30 pm
by sorin_carbunaru
Hello Chris,
It's been done in Oxygen 22.1. You can find some more info at
https://www.oxygenxml.com/doc/versions/ ... opics.html (look for
Use the file name as the value of the "keys" attribute for topic references).
Best wishes,
Sorin Carbunaru
oXygen XML
Re: Automatically set @keys attribute for new topics
Posted: Tue Dec 08, 2020 9:37 pm
by chrispitude
Hello! We're using Oxygen v23. (Impressive release, by the way!)
I noticed something interesting today. The
DITA > Maps > Use file name as the value of the "keys" attribute setting affects
<mapref> elements as well as <topicref> elements. For example, if I add a peer map reference (@scope="peer", @processing-role="resource-only", @keyscope defined):
- image.png (10.42 KiB) Viewed 2271 times
then the resulting <mapref>
also has @keys defined:
- image.png (3.93 KiB) Viewed 2271 times
which I can confirm by going back into Edit Properties:
- image.png (7.16 KiB) Viewed 2271 times
But even if I delete the mapref's @keys value there, it gets recreated when I exit the Edit Properties dialog.
I understand the use of having a topicref with @keys, but not a mapref with @keys. Is this a useful behavior to have? What does it allow me to do? Is it harmless, or could it cause an unintentional key namespace collision?
Thanks!
Re: Automatically set @keys attribute for new topics
Posted: Wed Dec 09, 2020 3:45 pm
by sorin_carbunaru
Hi Chris!
The <mapref> element is, in the end, just a convenience element that is equivalent to a <topicref> with the @format attribute set to "ditamap". Therefore, I would say it's normal for the <mapref> to also get a @keys attribute, just like other references do. You can later use the key name to refer the map using @keyref. And I don't think it's harmful.
In regards to the fact that you cannot remove the key using the "Edit Properties" dialog, I am afraid I cannot reproduce this behavior... After I click OK, the @keys attribute is removed.
Best wishes,
Sorin Carbunaru
Re: Automatically set @keys attribute for new topics
Posted: Mon Dec 21, 2020 4:18 pm
by chrispitude
Hi Sorin,
I found that the key is removed if you delete it and hit OK, but it comes back if you go back into the editing window and make some other change (or even nothing, as shown below) then hit OK:
- key_redefined.gif (153.64 KiB) Viewed 2136 times
If this is a bug, it's a very minor one. I'll leave it to you to decide whether you want to file it. This behavior is not causing us any issues.
Re: Automatically set @keys attribute for new topics
Posted: Mon Dec 21, 2020 5:30 pm
by sorin_carbunaru
Hi Chris,
Now I am able to reproduce the bug. Thank you for the info! I created EXM-47008
.
All the best,
Sorin C.