Page 1 of 1

Using WebHelp macros in HTML fragments

Posted: Thu Jul 12, 2018 10:15 am
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

Re: Using WebHelp macros in HTML fragments

Posted: Wed Jul 18, 2018 9:27 am
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

Re: Using WebHelp macros in HTML fragments

Posted: Wed Jul 18, 2018 4:59 pm
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

Re: Using WebHelp macros in HTML fragments

Posted: Mon Aug 06, 2018 11:38 am
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

Re: Using WebHelp macros in HTML fragments

Posted: Tue Aug 07, 2018 12:27 pm
by ionela
Hi Antti,

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

Regards,
Ionela