WebHelp: Best way to get the whole map tree into JavaScript?

Post here questions and problems related to editing and publishing DITA content.
raybiss
Posts: 31
Joined: Sat Jan 17, 2015 6:21 pm

WebHelp: Best way to get the whole map tree into JavaScript?

Post by raybiss »

Hi,

Publishing WebHelp responsive through Oxygen Editor; what would be the best way to get the whole map tree into javaScript? Transforming it to a json object would be nice if I can find where to put the template to process the topicref structure and place it in the footer. I'm already reading some values with whc:macro but I don't know how I could process the map tree?

I want to add a class to visited topics (in the left menu and the tiles on the index page) but need to make sure subtopics are visited before tagging a top level!

My script is currently working fine with the limited left menu tree but the whole tree is never accessible; neither from the top menu bar or the left/right menu tree. I tried the applyRecursion parameter mentioned in topic21201.html but I’m using tiles on the index page and this would not work if the loaded page is not index.html.

If I cannot find a way to add this transformation to the publishing process/template, how could I get a copy of either "toc.xml" or "webhelp-top-menu.xml" from the temp folder to the output folder? I could always read this file through AJAX.

Thanks for any idea you might have.

Regards,
Raymond
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: WebHelp: Best way to get the whole map tree into JavaScript?

Post by alin »

Hello,

You can generate the Publication TOC as JSON file by processing the temporary toc.xml file.
For this you need to register an XSLT file on the com.oxygenxml.webhelp.xsl.createNavLinks XSLT extention point.

I have created a sample Publishing Template that generates a toc.json file in the output directory. The PT is available here: https://github.com/oxygenxml/oxygen-pub ... s/json-toc

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
raybiss
Posts: 31
Joined: Sat Jan 17, 2015 6:21 pm

Re: WebHelp: Best way to get the whole map tree into JavaScript?

Post by raybiss »

Hi Alin,

Thank you very much for taking the time to answer my question.

I will study your template and adapt my script to read from this JSON file.

Best regards,
Raymond
Post Reply