You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using @outputclass="normalize-space" on a codeblock, I expect the leading spaces to be trimmed in the output.
Actual Behavior
DITA-OT fails to publish the document.
I have put a full example attached (see Steps to reproduce).
But something as simple as <codeblock outputclass="normalize-space"> <tag></codeblock> fails as well.
Possible Solution
It seems that DITA-OT does not fancy a mix of spaces and entities as line start, especially if the snippet starts on the same line as the <codeblock> element.
Steps to Reproduce
The codeblocks-normalize-space.zip archive contains the file codeblocks.ditamap with the failing snippet located in the topic codeblocks-with-space-not-ok.dita.
Copy of the error message, log file or stack trace
[topic-fragment] Processing file:/C:/Users/fviolette/Desktop/temp/html5/oxygen_dita_temp/codeblocks-with-space-ok.dita
[topic-fragment] Processing file:/C:/Users/fviolette/Desktop/temp/html5/oxygen_dita_temp/codeblocks-with-space-not-ok.dita
BUILD FAILED
C:\git\documentation-dita\guidelines\docs\build\dita-ot-3.1.2\build.xml:45: The following error occurred while executing this line:
C:\git\documentation-dita\guidelines\docs\build\dita-ot-3.1.2\plugins\org.dita.base\build_preprocess.xml:234: java.lang.ArrayIndexOutOfBoundsException: -1
at org.dita.dost.writer.NormalizeCodeblock.normalizeSpace(NormalizeCodeblock.java:101)
at org.dita.dost.writer.NormalizeCodeblock.endElement(NormalizeCodeblock.java:76)
at org.xml.sax.helpers.XMLFilterImpl.endElement(Unknown Source)
at org.dita.dost.writer.CoderefResolver.endElement(CoderefResolver.java:141)
at org.dita.dost.writer.NormalizeTableFilter.endElement(NormalizeTableFilter.java:263)
at org.xml.sax.helpers.XMLFilterImpl.endElement(Unknown Source)
at org.dita.dost.writer.TopicFragmentFilter.endElement(TopicFragmentFilter.java:102)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.ditang.relaxng.defaults.RelaxNGDefaultsComponent.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImplXerces.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.ditang.relaxng.defaults.RelaxDefaultsParserConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:451)
at net.sf.saxon.event.Sender.send(Sender.java:153)
at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:375)
at org.dita.dost.util.XMLUtils.transformFile(XMLUtils.java:468)
at org.dita.dost.util.XMLUtils.transform(XMLUtils.java:420)
at org.dita.dost.util.XMLUtils.transform(XMLUtils.java:409)
at org.dita.dost.module.XmlFilterModule.execute(XmlFilterModule.java:54)
at org.dita.dost.ant.ExtensibleAntInvoker.execute(ExtensibleAntInvoker.java:169)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:448)
at org.apache.tools.ant.Target.performTasks(Target.java:469)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:446)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:448)
at org.apache.tools.ant.Target.performTasks(Target.java:469)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1370)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:849)
at org.apache.tools.ant.Main.startAnt(Main.java:228)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Total time: 5 seconds
The process finished with exit code: 1
When adding a line break at the beginning of the failing codeblock, the error becomes:
C:\git\documentation-dita\guidelines\docs\build\dita-ot-3.1.2\plugins\org.dita.base\build_preprocess.xml:234: java.lang.StringIndexOutOfBoundsException: String index out of range: -3
Environment
DITA-OT version:
3.1.2
Operating system and version:
Windows 10
How did you run DITA-OT?
oXygenXML
Transformation type:
HTML5, PDF2
The text was updated successfully, but these errors were encountered:
In 3.2.1, a codeblock starting with a blank line and @ouptutclass set to normalize-space gives:
C:\git\documentation-dita\guidelines\docs\build\dita-ot-3.2.1\plugins\org.dita.base\build_preprocess.xml:235: java.lang.StringIndexOutOfBoundsException: String index out of range: -19
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:585)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:445)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:352)
at org.apache.tools.ant.Target.execute(Target.java:437)
at org.apache.tools.ant.Target.performTasks(Target.java:458)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
What I've called a blank line is a line feed, in fact.
For what it's worth (saw the GitHub status update), here is my sample map, attached: codeblock-normalize-space.zip
Expected Behavior
When using @outputclass="normalize-space" on a codeblock, I expect the leading spaces to be trimmed in the output.
Actual Behavior
DITA-OT fails to publish the document.
I have put a full example attached (see Steps to reproduce).
But something as simple as
<codeblock outputclass="normalize-space"> <tag></codeblock>
fails as well.Possible Solution
It seems that DITA-OT does not fancy a mix of spaces and entities as line start, especially if the snippet starts on the same line as the
<codeblock>
element.Steps to Reproduce
The codeblocks-normalize-space.zip archive contains the file codeblocks.ditamap with the failing snippet located in the topic codeblocks-with-space-not-ok.dita.
Copy of the error message, log file or stack trace
When adding a line break at the beginning of the failing codeblock, the error becomes:
C:\git\documentation-dita\guidelines\docs\build\dita-ot-3.1.2\plugins\org.dita.base\build_preprocess.xml:234: java.lang.StringIndexOutOfBoundsException: String index out of range: -3
Environment
3.1.2
Windows 10
oXygenXML
HTML5, PDF2
The text was updated successfully, but these errors were encountered: