Using WebHelp macros in HTML fragments

eccc
Posts: 12

Using WebHelp macros in HTML fragments

Thu Jul 12, 2018 10:15 am

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: 2

Re: Using WebHelp macros in HTML fragments

Wed Jul 18, 2018 9:27 am

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: 131

Re: Using WebHelp macros in HTML fragments

Wed Jul 18, 2018 4:59 pm

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: 12

Re: Using WebHelp macros in HTML fragments

Mon Aug 06, 2018 11:38 am

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: 212

Re: Using WebHelp macros in HTML fragments

Tue Aug 07, 2018 12:27 pm

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

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 4 guests