dita-ot / dita-ot

DITA Open Toolkit — the open-source publishing engine for content authored in the Darwin Information Typing Architecture.
https://www.dita-ot.org
Apache License 2.0
404 stars 196 forks source link

Topics with "copy-to" attribute are not compiled when generating chm #3839

Open Ice-Maple opened 2 years ago

Ice-Maple commented 2 years ago

Expected Behavior

Topics with copy-to attribute are included in the ditamap. when using org.dita.htmlhelp to generate chm, those topics should display correctly.

Actual Behavior

chm is generated, but topics with copy-to attribute are not compiled. The log shows as below: compile.HTML.Help: [exec] Microsoft HTML Help Compiler 4.74.8702 [exec] [exec] Compiling c:\Users\ADMINI~1\AppData\Local\Temp\2\temp202112151413596 02\temp_chm_dir\test.chm [exec] [exec] HHC5003: Error: Compilation failed while compiling 7db7550535317cc69 1175a975a0e8852d8aab7b0.html. [exec] HHC5003: Error: Compilation failed while compiling b4c4dd4207caaa0a0 8f9e10c812907b6fd04f883.html. [exec] [exec] [exec] The following files were not compiled: [exec] 7db7550535317cc691175a975a0e8852d8aab7b0.html [exec] b4c4dd4207caaa0a08f9e10c812907b6fd04f883.html [copy] Copying 1 file to C:\DITA\out\test\chm I've checked the uncompiled topic in the chm, its property shows its href is test.chm::/b4c4dd4207caaa0a08f9e10c812907b6fd04f883.html

Possible Solution

I rerun the task and halt the process to see the temp file. The test.hhc file in the temp_chm_dir displays as below: `

` Obviously, the vaule of the copy-to topics, were random IDs like b7d204e4b37413a10b2c58ba44f36ce606f47579, but other topics are display correctly like qs/test.html. I read the log, and found the dita topics are all renamed with random IDs. But they were finally renamed back when producing htmls, and uri in the hhc used their original names. So they are matched. However, the copy-to topics' uris are assigned to random IDs. Then I checked the map2hhcImpl.xsl and found copy-to topics were proccessed here. ` ` I guess the "@copy-to" property is accquired from the ditamap. Then I checked the ditamap in the temp dir, and found topics are changed like this: `test01test01` The href value is as before, but the copy-to value is random ID. So I guess the plugin gets filename by copy-to vaule for topics using copy-to, and the problem occurs. But it gets filename by href for other topics, so there's no problem. Actually, the copy-to files "test-1.html" and "test-2.html" are generated correctly in the temp folder. So it's just the href problem. But I still don't know why it assigns random IDs to copy-to value. ## Steps to Reproduce 1. Create a ditamap with copy-to attributes, like this: ` ` 2.run the dita-to to generate chm: `cd C:\DITA\dita-ot-3.6\bin && dita --input="C:\DITA\tmp\test\test.ditamap" --format=htmlhelp` 3.check the output chm. ## Copy of the error message, log file or stack trace ## Environment * DITA-OT version: 3.1 and 3.6 * Operating system and version: Windows * How did you run DITA-OT? dita command * Transformation type: HtmlHelp(chm)
raducoravu commented 2 years ago

I remember that you make CHM publishing work decently in the DITA OT bundled with Oxygen XML Editor I edited the build file: dita-ot/plugins/org.dita.htmlhelp/build_dita2htmlhelp.xml and replaced preprocess2 with preprocess in the target's depends= attribute.

Ice-Maple commented 2 years ago

I remember that you make CHM publishing work decently in the DITA OT bundled with Oxygen XML Editor I edited the build file: dita-ot/plugins/org.dita.htmlhelp/build_dita2htmlhelp.xml and replaced preprocess2 with preprocess in the target's depends= attribute.

Thanks very much. The Problem is solved. We used to publish chm on a windows sever, not in the local. I've just copied the org.dita.htmlhelp from the oxygen editor to the server to overwrite the original plugins. And it works! Thus I hope the dita-ot can also fix the problem as what oxygen did.

jomjohn commented 1 year ago

I see this same bug in the HTML5 (with preprocess2) output and copy-to.

When I have a copy-to topicref such as: <topicref href="topics/topic2.dita" copy-to="COPY_FILE.dita">

In the output TOC I get: <li class="topicref"><a href="67e4b302638f9a737d3dc4ed35e1284a78f8974e.html">Topic-2</a></li>

When it should be: <li class="topicref"><a href="COPY_FILE.html">Topic-2</a></li>

I believe this symptom has the same rooted issue as with https://github.com/dita-ot/dita-ot/issues/4042 and #3514