Templater generates broken output file. #55
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my examples folder, I have a template named xml.docx, which contains a simple loop with a tag in it. Although Docxgen generates the output file with this template, it is broken. When I dug the output file, I found problem with document.xml. At many places, there were "</w:t></w:t>" instead of just one occurrence, which eventually causes the broken output. I believe (not sure) extra closing tag is added by handleRecursiveCase() method. After playing with the template testing with different forms of xmls, I found the problem occurs only with extra </w:t>(s) at multiple places. So without trying to change much of your code, I just scan through the xml generated, and replace double occurrence of </w:t> with single. If you have a better solution, go ahead.
P.S The template was initially generated by word, and hence, the problem may arise with other users as well.