newlines not working in <codeblock> tags
Oxygen general issues.
-
- Posts: 48
- Joined: Sat Jan 04, 2020 1:17 am
newlines not working in <codeblock> tags
Hello,
We have an xml topic which uses newlines in a <codeblock> tag, but the output does not use the newlines, instead wrapping the text and losing the indentations.
Please see the example "Windows Sample Script" here:
https://docs.oracle.com/en/cloud/saas/e ... ipt_1.html
In oxygen, you can see the newlines and correct indent:
Thanks,
Will
We have an xml topic which uses newlines in a <codeblock> tag, but the output does not use the newlines, instead wrapping the text and losing the indentations.
Please see the example "Windows Sample Script" here:
https://docs.oracle.com/en/cloud/saas/e ... ipt_1.html
In oxygen, you can see the newlines and correct indent:
image.png
Someone had said they thought there might be an Oxygen setting to enable newlines in <codeblock> tags. Is there such a thing? Or, what am I missing?Thanks,
Will
You do not have the required permissions to view the files attached to this post.
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: newlines not working in <codeblock> tags
Post by julien_lacour »
Hello Will,
It seems that your XML document is a DITA topic, could you confirm?
Could you also indicate in which output does the problem occur? (PDF, WebHelp, etc.)
Regards,
Julien
It seems that your XML document is a DITA topic, could you confirm?
Could you also indicate in which output does the problem occur? (PDF, WebHelp, etc.)
Regards,
Julien
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: newlines not working in <codeblock> tags
Hi Will,
Are you using for publishing Oxygen's bundled DITA Open Toolkit publishing engine or a custom publishing engine?
Did you maybe install an extra publishing plugin which may have induced this problem? Because on my side this problem does not occur when publishing with Oxygen's publishing engine to HTML5 or PDF.
Regards,
Radu
Are you using for publishing Oxygen's bundled DITA Open Toolkit publishing engine or a custom publishing engine?
Did you maybe install an extra publishing plugin which may have induced this problem? Because on my side this problem does not occur when publishing with Oxygen's publishing engine to HTML5 or PDF.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 48
- Joined: Sat Jan 04, 2020 1:17 am
Re: newlines not working in <codeblock> tags
Hello Radu,
We are migrating from Arbortext to Oxygen, and have ported the DITA-OT 1.8.5 into Oxygen as a Framework.
Basically, our custom Oxygen plugin creates the DITA command as a string, and executes it through a Runtime class using a bat file to call ant. The ant call looks basically like:
ant -f build.xml -Dclean.temp=yes -Ddita.dir=C:\dir -Dbasedir=C:\dir
-Dtranstype=pdf-epm
-Dargs.input=C:\dita_files\publications.ditamap
-Doutput.dir=C:\output
-Dargs.filter=C:\publication.ditaval
-Ddita.map.filename.root=aName
-Dargs.doc.source.dir=C:\dita_files\publication.ditamap
This same setup worked in Arbortext, while preserving newlines and tabs in <codeline> tags.
Would you know of any settings in Oxygen I can try, or arguments I can pass to DITA that might help preserve the endlines and tabs in <codeblock> tags?
Is there somewhere in the Oxygen folder setup I can look to see how Oxygen's publishing engine makes the same sort of call to DITA?
Thanks for anything you can offer.
Will
We are migrating from Arbortext to Oxygen, and have ported the DITA-OT 1.8.5 into Oxygen as a Framework.
Basically, our custom Oxygen plugin creates the DITA command as a string, and executes it through a Runtime class using a bat file to call ant. The ant call looks basically like:
ant -f build.xml -Dclean.temp=yes -Ddita.dir=C:\dir -Dbasedir=C:\dir
-Dtranstype=pdf-epm
-Dargs.input=C:\dita_files\publications.ditamap
-Doutput.dir=C:\output
-Dargs.filter=C:\publication.ditaval
-Ddita.map.filename.root=aName
-Dargs.doc.source.dir=C:\dita_files\publication.ditamap
This same setup worked in Arbortext, while preserving newlines and tabs in <codeline> tags.
Would you know of any settings in Oxygen I can try, or arguments I can pass to DITA that might help preserve the endlines and tabs in <codeblock> tags?
Is there somewhere in the Oxygen folder setup I can look to see how Oxygen's publishing engine makes the same sort of call to DITA?
Thanks for anything you can offer.
Will
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: newlines not working in <codeblock> tags
Hi Will,
That ant call you are making from the Oxygen plugin creates a new process, totally separated from Oxygen.
Can you try to open a Windows command prompt and run inside it the same process? Does it yield the same results?
Is it possible that since migrating from Arbortext you also made changes to the publishing? Maybe make extra changes to the DITA OT which might explain this problem?
One more question, what Ant installation are you using? Did you bundle "Apache Ant" with your plugin or do you use Oxygen's bundled Apache Ant from its "OXYGEN_INSTALL_DIR\tools\ant" folder? Or do you rely on the fact that all users have Apache Ant pre-installed in their system?
Regards,
Radu
That ant call you are making from the Oxygen plugin creates a new process, totally separated from Oxygen.
Can you try to open a Windows command prompt and run inside it the same process? Does it yield the same results?
Is it possible that since migrating from Arbortext you also made changes to the publishing? Maybe make extra changes to the DITA OT which might explain this problem?
One more question, what Ant installation are you using? Did you bundle "Apache Ant" with your plugin or do you use Oxygen's bundled Apache Ant from its "OXYGEN_INSTALL_DIR\tools\ant" folder? Or do you rely on the fact that all users have Apache Ant pre-installed in their system?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 48
- Joined: Sat Jan 04, 2020 1:17 am
Re: newlines not working in <codeblock> tags
Hi Radu,
Thanks very much for your thoughts! I will use them, if my current hunch is wrong.
At the moment, I suspect that the Java class DocumentBuilder parsing we use is somehow removing newlines. Which is also outside of Oxygen.
You and your team have been very helpful so many times...
Thanks a ton for all you've done!
Will
Thanks very much for your thoughts! I will use them, if my current hunch is wrong.
At the moment, I suspect that the Java class DocumentBuilder parsing we use is somehow removing newlines. Which is also outside of Oxygen.
You and your team have been very helpful so many times...
Thanks a ton for all you've done!
Will
-
- Posts: 48
- Joined: Sat Jan 04, 2020 1:17 am
Re: newlines not working in <codeblock> tags
Hello again Radu,
I'm sorry to bother you again on this, but would you know offhand how Oxygen represents newline in a <codeblock> in an xml file?
I am experimenting with trying to convert newlines to an escape character, to see if it will make it past the parser.
What I've tried so far:

\n
\r\n

If you don't know offhand, no worries.
Thanks much,
Will
I'm sorry to bother you again on this, but would you know offhand how Oxygen represents newline in a <codeblock> in an xml file?
I am experimenting with trying to convert newlines to an escape character, to see if it will make it past the parser.
What I've tried so far:

\n
\r\n

If you don't know offhand, no worries.
Thanks much,
Will
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: newlines not working in <codeblock> tags
Hi Will,
Usually new lines are represented with the "\n" character which is visually shown as a line break in any editor, including Oxygen. It's equivalent entity reference notations are " " (decimal 10) and "
" (hexadecimal A) but they are equivalent, so you can use either one but the output should look the same.
Coming back to your problem, I think it may occur because you are running ANT but you are not specifying to the "ant" process a set of Java JAR libraries to load so it probably does not load the JAR libraries from the "DITA-OT\lib" folder. You are using a very old version of the DITA-OT. Back then you needed to run a "startcmd.bat" and in the command line which opened up you needed to run the Ant command:
http://dita-ot.sourceforge.net/1.8/
So I'm not sure if you are doing the equivalent of that in your plugin, the equivalent probably being that when the Java process is started you need to pass to it environmental variables similar to what the "DITA-OT\startcmd.bat" contains.
Or the problem might occur because of a custom publishing plugin which treats the content of codeblocks incorrectly in the XSLT code.
Regards,
Radu
Usually new lines are represented with the "\n" character which is visually shown as a line break in any editor, including Oxygen. It's equivalent entity reference notations are " " (decimal 10) and "
" (hexadecimal A) but they are equivalent, so you can use either one but the output should look the same.
Coming back to your problem, I think it may occur because you are running ANT but you are not specifying to the "ant" process a set of Java JAR libraries to load so it probably does not load the JAR libraries from the "DITA-OT\lib" folder. You are using a very old version of the DITA-OT. Back then you needed to run a "startcmd.bat" and in the command line which opened up you needed to run the Ant command:
http://dita-ot.sourceforge.net/1.8/
So I'm not sure if you are doing the equivalent of that in your plugin, the equivalent probably being that when the Java process is started you need to pass to it environmental variables similar to what the "DITA-OT\startcmd.bat" contains.
Or the problem might occur because of a custom publishing plugin which treats the content of codeblocks incorrectly in the XSLT code.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service