Using WebHelp macros in HTML fragments

Post here questions and problems related to editing and publishing DITA content.
eccc
Posts: 16
Joined: Mon Apr 23, 2018 8:38 am

Using WebHelp macros in HTML fragments

Post by eccc »

Hi,

The ability to use WebHelp macros in HTML fragments is a welcome improvement! The instructions on using them, however, are a bit unclear:

https://www.oxygenxml.com/doc/versions/ ... -html.html

The instructions do not reveal that you have to use the element <whc:macro value="${<macro>}"/> if you wish to append a text node to an element. Is the format ${<macro>} only applicable for adding attribute values?

Another question I have is that is it possible to use these macros within inline JavaScript in an HTML fragment? For instance, I'd like to use the WebHelp localization framework in initializing dataTables and using localized UI texts for dataTables based on the output language.

Best regards,
Antti
Kiyoshirue
Posts: 4
Joined: Wed Jul 18, 2018 8:56 am

Re: Using WebHelp macros in HTML fragments

Post by Kiyoshirue »

Hello,

I'm also struggling with similar issues related to this very helpful improvement. Thanks for the tips and for posting this, Antti! I'd be highly interested in seeing this go forward.

Many thanks,
Kiyoshirue
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: Using WebHelp macros in HTML fragments

Post by alin »

Hello,

Thank you for your feedback. I have submitted a task to our documentation team to update the WebHelp macros related topic in our User Guide.

You are right. You can use the <whc:macro/> component to expand a ${macro} value in a text node.

The <whc:macro/> component can be used in inline JavaScript fragments. For example:

Code: Select all


        <script>
console.log('i18n text: ', '<whc:macro value="${i18n(webhelp.search)}"/>');
</script>
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
eccc
Posts: 16
Joined: Mon Apr 23, 2018 8:38 am

Re: Using WebHelp macros in HTML fragments

Post by eccc »

Thank you for your assistance! Also worth noting in the documentation is the fact that you'll need to declare the namespace for the whc: prefix in the root element of the fragment.

Antti
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Using WebHelp macros in HTML fragments

Post by ionela »

Hi Antti,

You are right, we'll mention this too in our documentation. Thank you for your suggestions.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
Post Reply