Topics

Keyref a combination of keywords? #DITA-OT #keys

stinakab
 

Hello,

I was wondering about the following: if it is possible to add several keyword elements to a keywords element within a keydef ditamap, why can't the keyref attribute of a keyword element in topic reference all added keywords?

Example key definition:

  <keydef keys="shortcut_ctrl_cmd_cut">
    <topicmeta>
      <keywords>
        <keyword>Ctrl/Cmd</keyword>
        <keyword>-</keyword>
        <keyword>X</keyword>
      </keywords>
    </topicmeta>
  </keydef>

If I keyref this using a keyword element in my topic, I get the following:
<keyword keyref="shortcut_ctrl_cmd_cut/>
However, in the output, only the first keyword of the keydef is used.

Why I would like to do this? All our shortcuts get a specific layout, meaning that they get a grey background and are displayed in bold, but the hyphen, as in the example above, should not get a background color at all, because we want to simulate key combinations.
In our output, we want something like this:

So far, this has only been possible by having a definition for every key on the keyboard. Adding all these keys and the hyphen inbetween is cumbersome, and now I would like to know if there is a way to include all keywords in one keyref.
If this is possible, where and how would I make a change?

We're using DITA OT 3.3.2, Oxygen XML Editor 21.1.

Thanks,
Christina

Radu Coravu
 

Hi Christina,

The DITA 1.3 specs says:

https://www.oxygenxml.com/dita/1.3/specs/archSpec/base/processing-keyref-for-text.html

For elements that do not allow the @href attribute, content is taken from the first <keyword> element inside of <keywords> inside of the <topicmeta>.
so a keyref to a topicmeta will always resolve to the first keyword, this is not configurable as the specification is clear in what it wants to achieve.

Also the keyref resolves to plain text so I don't think that what you want (to have a certain character marked unlike the others) can be achieved using a keyword with keyref.

Maybe instead of you can use a keyword with conkeyref to a keyword defined something like:

<keyword id="reused">Ctrl<text>-</text>X</keyword>
because a conkeyref preserves the inline elements inside the reused element but a keyref will resolve to plain text.

Regards,
Radu
Radu Coravu
Oxygen XML Editor
On 7/28/20 12:45 PM, stinakab via groups.io wrote:
Hello,

I was wondering about the following: if it is possible to add several keyword elements to a keywords element within a keydef ditamap, why can't the keyref attribute of a keyword element in topic reference all added keywords?

Example key definition:

  <keydef keys="shortcut_ctrl_cmd_cut">
    <topicmeta>
      <keywords>
        <keyword>Ctrl/Cmd</keyword>
        <keyword>-</keyword>
        <keyword>X</keyword>
      </keywords>
    </topicmeta>
  </keydef>

If I keyref this using a keyword element in my topic, I get the following:
<keyword keyref="shortcut_ctrl_cmd_cut/>
However, in the output, only the first keyword of the keydef is used.

Why I would like to do this? All our shortcuts get a specific layout, meaning that they get a grey background and are displayed in bold, but the hyphen, as in the example above, should not get a background color at all, because we want to simulate key combinations.
In our output, we want something like this:

So far, this has only been possible by having a definition for every key on the keyboard. Adding all these keys and the hyphen inbetween is cumbersome, and now I would like to know if there is a way to include all keywords in one keyref.
If this is possible, where and how would I make a change?

We're using DITA OT 3.3.2, Oxygen XML Editor 21.1.

Thanks,
Christina


  

stinakab
 

Hi Radu,

Thanks so much for pointing me to that page. I had been googling insanely for an answer.

I will check if the idea of using a conkeyref is an option for us.

Thanks again,
Christina