Page 1 of 1

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

Posted: Sun Oct 17, 2021 5:47 am
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

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

Posted: Wed Oct 27, 2021 4:16 pm
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

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

Posted: Tue Nov 02, 2021 12:54 am
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