Page 1 of 1

Tagging a variable

Posted: Wed May 18, 2022 6:01 pm
by Jeff_Reynolds
Hi everyone!

I don't seem to be able to wrap a variable with wintitle or uicontrol tags. In this example, I have a window title that I conref in, and once injected into the para I can't wrap additional tags around it. Any tips?

Code: Select all

The <wintitle><ph keyref="am_module"/></wintitle> window

Re: Tagging a variable

Posted: Thu May 19, 2022 7:15 am
by Radu
Hi Jeff,
I'm afraid according to the DITA 1.3 specification the <wintitle> element can contain either text content or the <text> element inside it:
https://www.oxygenxml.com/dita/1.3/spec ... __wintitle
But it does allow specifying the @keyref attribute directly on it like:

Code: Select all

<wintitle keyref="ABC"/>
Regards,
Radu

Re: Tagging a variable

Posted: Thu May 19, 2022 2:10 pm
by chrispitude
<uicontrol> allows <keyword>:
uicontrol = element uicontrol { (text | data | sort-as | data-about | foreign | unknown | keyword | apiname | option | parmname | cmdname | msgnum | varname | wintitle | numcharref | parameterentity | textentity | xmlatt | xmlelement | xmlnsname | xmlpi | term | abbreviated-form | \text | image | shortcut)+ }
so we use this form to decouple the element semantic intent from the variable reference:

Code: Select all

<uicontrol><keyword keyref="Product"/></uicontrol>
However, <wintitle> does not allow <keyword>:
wintitle = element wintitle { (text | \text)+ }
so we use Radu's suggested form.

Re: Tagging a variable

Posted: Thu May 19, 2022 2:40 pm
by chrispitude
Hi Radu,

I was going to suggest to simply double-click the variable in the DITA Reusable Components view and let Oxygen figure out that <keyword> is valid in <uicontrol>, but instead this happens:

image.png
image.png (13.42 KiB) Viewed 1159 times

It might be useful to have DITA Reusable Components to prefer variable-like elements (<ph>, <keyword>, ...?) before the first alphanumeric match when inserting text variables.

Here's a testcase:

oxygen_variable_insertion_in_uicontrol.zip
(1.61 KiB) Downloaded 172 times

Re: Tagging a variable

Posted: Thu May 19, 2022 5:46 pm
by Jeff_Reynolds
Thanks everyone for the responses. Another item to add to my reuse "to do" list. I'm in week 2 of CIDM's Advanced Reuse course so this information is very timely.

Cheers!

Re: Tagging a variable

Posted: Fri May 20, 2022 7:11 am
by Radu
Hi Chris,

I agree with your take about the double click behavior in the DITA Reusable Components view, I added an internal issue to improve it:

EXM-50563 Improve insertion strategy for double clicking a key in the DITA Reusable Components view

But in this case I think we should insert a ph with keyref instead of a keyword. There would be an entire discussion about whether we should insert ph or keyword with keyref. We have another internal issue for that as well:

EXM-40036 Control default added keyref element name in "DITA Reusable Components" view

I would incline towards inserting ph with keyref:
post43869.html#p43869

Regards,
Radu

Re: Tagging a variable

Posted: Fri May 20, 2022 2:09 pm
by chrispitude
Hi Radu,

I also much prefer <ph keyref="..."/>, but I think <uicontrol> is an unusual case in which <keyword> is allowed but <ph> is not. (And <wintitle> is even more unusual in that neither is allowed!)

I recall that DITA 2.0 was potentially going to enhance the content models of these elements to allow <ph>, but I don't know if these enhancements are in the final plan of record.

Re: Tagging a variable

Posted: Thu Oct 13, 2022 4:49 pm
by adrian_sorop
Hi,
Oxygen version 25.0 was just released.
The issue EXM-50563 Improve insertion strategy for double clicking a key in the DITA Reusable Components view was fixed.
The default action will insert a keyword when the destination element is an uicontrol
The Insert as Keyref action from contextual menu of DITA Reusable Components will now propose valid elments.
Regards,
Adrian S.