{"action":"created","issue":{"url":"https://api.github.com/repos/dita-ot/dita-ot/issues/2940","repository_url":"https://api.github.com/repos/dita-ot/dita-ot","labels_url":"https://api.github.com/repos/dita-ot/dita-ot/issues/2940/labels{/name}","comments_url":"https://api.github.com/repos/dita-ot/dita-ot/issues/2940/comments","events_url":"https://api.github.com/repos/dita-ot/dita-ot/issues/2940/events","html_url":"https://github.com/dita-ot/dita-ot/issues/2940","id":317291367,"number":2940,"title":"HTML Help fails if title is wrapped in ph indexterm","user":{"login":"Enigma644","id":29318,"avatar_url":"https://avatars2.githubusercontent.com/u/29318?v=4","gravatar_id":"","url":"https://api.github.com/users/Enigma644","html_url":"https://github.com/Enigma644","followers_url":"https://api.github.com/users/Enigma644/followers","following_url":"https://api.github.com/users/Enigma644/following{/other_user}","gists_url":"https://api.github.com/users/Enigma644/gists{/gist_id}","starred_url":"https://api.github.com/users/Enigma644/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Enigma644/subscriptions","organizations_url":"https://api.github.com/users/Enigma644/orgs","repos_url":"https://api.github.com/users/Enigma644/repos","events_url":"https://api.github.com/users/Enigma644/events{/privacy}","received_events_url":"https://api.github.com/users/Enigma644/received_events","type":"User","site_admin":false},"labels":[{"id":3843302,"url":"https://api.github.com/repos/dita-ot/dita-ot/labels/htmlhelp","name":"htmlhelp","color":"84b6e8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-24T15:57:28Z","updated_at":"2018-05-04T19:32:10Z","closed_at":null,"author_association":"NONE","body":"## Expected Behavior\r\n<!-- If you're describing a bug, tell us what should happen. -->\r\nTrying to do HTML Help output to CHM file.\r\n\r\n## Actual Behavior\r\n<!-- Tell us what happens instead of the expected behavior. -->\r\nNo CHM produced, NullPointerException in log.\r\n\r\n## Possible Solution\r\n<!-- Optional suggestions on how to fix the issue, or implement the changes. -->\r\nSeems to be something to do with indexterm being in the title and also being in the body.\r\n<!-- If you know how to fix the issue, please create a pull request instead. -->\r\n\r\n## Steps to Reproduce\r\n<!-- Test case, Gist, set of files or steps required to reproduce the issue. -->\r\n\r\n[testFiles.zip](https://github.com/dita-ot/dita-ot/files/1943570/testFiles.zip)\r\n1. Unzip.\r\n2. Correct paths in bat for your setup.\r\n3. Run makeCHM.bat\r\n\r\n<!-- Create a Gist via <https://gist.github.com/> to upload your test files. -->\r\n<!-- Link to the Gist from the issue or attach a .zip archive of your files. -->\r\n\r\n## Copy of the error message, log file or stack trace\r\n<!-- Long logs should be attached or in linked Gists, not in the issue body. -->\r\n [pipeline] file:/C:/Users/James/Desktop/swap/DOTK/input/TestTopic.dita:3:146: [DOTX037W][WARN]: No title found for this document; using \"***\" in XHTML title bar. \r\nError: The following error occurred while executing this line:\r\nC:\\Stuff\\DITA-OT-3.0.3\\plugins\\org.dita.htmlhelp\\build_dita2htmlhelp.xml:90: java.lang.NullPointerException\r\n\r\n## Environment\r\n<!-- Include relevant details about the environment you experienced this in. -->\r\n\r\n* DITA-OT version:3.0.3\r\n* Operating system and version: Winx64\r\n* How did you run DITA-OT?\r\nCall \"C:\\Stuff\\DITA-OT-3.0.3\\bin\\dita.bat\" /transtype:htmlhelp -i=\"C:\\Users\\James\\Desktop\\swap\\DOTK\\input\\map.ditamap\" -o=\"C:\\Users\\James\\Desktop\\swap\\DOTK\\output\" -l=\"C:\\Users\\James\\Desktop\\swap\\DOTK\\log.log\"\r\n* Transformation type:\r\nhtmlhelp\r\n\r\n<!--\r\nBefore submitting, check the Preview tab above to verify the XML markup appears\r\ncorrectly and remember you can edit the description later to add information.\r\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/dita-ot/dita-ot/issues/comments/386709763","html_url":"https://github.com/dita-ot/dita-ot/issues/2940#issuecomment-386709763","issue_url":"https://api.github.com/repos/dita-ot/dita-ot/issues/2940","id":386709763,"user":{"login":"robander","id":1649639,"avatar_url":"https://avatars2.githubusercontent.com/u/1649639?v=4","gravatar_id":"","url":"https://api.github.com/users/robander","html_url":"https://github.com/robander","followers_url":"https://api.github.com/users/robander/followers","following_url":"https://api.github.com/users/robander/following{/other_user}","gists_url":"https://api.github.com/users/robander/gists{/gist_id}","starred_url":"https://api.github.com/users/robander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robander/subscriptions","organizations_url":"https://api.github.com/users/robander/orgs","repos_url":"https://api.github.com/users/robander/repos","events_url":"https://api.github.com/users/robander/events{/privacy}","received_events_url":"https://api.github.com/users/robander/received_events","type":"User","site_admin":false},"created_at":"2018-05-04T19:32:10Z","updated_at":"2018-05-04T19:32:10Z","author_association":"OWNER","body":"I have to say that like @drmacro this markup makes me very nervous, even while I agree that the code should never crash with a null pointer error.\r\n\r\nI can understand how you arrived at it - as you say, reused sections get indexed automatically, and it's easy to select the text and surround it with the term. While index terms are not intended to be rendered with the content, the `args.indexshow` parameter is a clever way to get around that. That said ... I think over time you'll run into more problems, much like the one you saw with section titles treated as missing.\r\n\r\nThe `args.indexshow` parameter was created to help with content reviews -- so that reviewers could see exactly where the terms are defined while also reviewing the final publication. As such, it only results in \"shown\" terms when they are in the topic content / when they are pulled from the prolog to show as part of the content. There are a lot of other places where we explicitly ignore index terms -- those processes will not be updated to say \"ignore except with indexshow\", because that's not what the parameter is intended for. Offhand I can think of a few places where that would happen, and you've already encountered some of them:\r\n\r\n- Section titles -- if the title is empty, generating an empty heading results in something like `<h2/>` that a lot of browsers _really_ don't handle well. That's why we check for any text content or [element content that is not hidden] before creating the heading.\r\n- Topic titles (in a TOC, in the HTML `<title>` that appears with the browser window, in PDF bookmarks, in running headers and footers, etc): all of these will be processed in a way that drops index terms\r\n- Cross references -- any time you cross reference a topic (or anything really), index terms will be ignored when link text is generated\r\n- Any other location where content is pulled, as opposed to reused-with-conref, such as when short descriptions are pulled for link previews\r\n\r\nI'm sure there are more, those are just some of the most common. \r\n\r\nRather than the existing parameter that shows index terms in the content, it seems like what you'd really need here is a parameter that means \"treat index terms as both an index term and also treat them as part of the content flow\". \r\n\r\nThe easiest way I can think of to get processing like that to work -- and also avoid the various issues you're seeing now -- would be to add a custom step (early) in the preprocess that takes your title content and treats it as both inline and as an index. The benefit to that approach is that you can keep editing as you are now, but also avoid all of the issues I listed above, along with all of the other ones I'm missing, _and also any future code that pulls content without pulling index terms._ A step like that could really go from either direction. For example, something like one of these:\r\n\r\n- If every title should be indexed: when you find a title that does not have an indexterm, generate an indexterm in that title with the same contents as the title\r\n- Or, if you find a title that _only_ has an indexterm, keep that term while also copying the contents into the title itself\r\n- Or, if you find a title that has content and an _empty_ index term, copy the contents into that term\r\n- I'm sure there are several options like this, all of which would depend on your overall content structure / what's easiest to manage when editing."}}
{"actor":{"display_login":"robander"}}