Tagging a variable

Post here questions and problems related to editing and publishing DITA content.
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Tagging a variable

Post 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
Attachments
image.png
image.png (3.97 KiB) Viewed 1181 times
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Tagging a variable

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Tagging a variable

Post 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.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Tagging a variable

Post 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 1160 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
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: Tagging a variable

Post 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!
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Tagging a variable

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Tagging a variable

Post 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.
adrian_sorop
Posts: 73
Joined: Wed Jun 22, 2016 2:48 pm

Re: Tagging a variable

Post 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.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply