Colored text
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 26
- Joined: Mon Feb 18, 2013 5:44 pm
Colored text
Is it possible to paste/convert colored code snippets from a word file or Eclipse IDE to Oxygen? Colored snippets are more readable, but now in Oxygen all code snippets look like a plain text. If it's not possible on the Oxygen level, is there any chance it could be done on the DITA-OT level?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Colored text
Post by sorin_ristache »
Hi,
In Text editing mode Oxygen has a customizable coloring scheme for each type of editor (XML, XSLT, XSD, XQuery, shell, Java, etc). Only the text content is read from the clipboard (where you copied it from Word or Eclipse), the styling is set by the current coloring scheme for the editor type where you paste the text. You can change the colors from menu Options -> Preferences -> Editor / Colors.
In Author editing mode the content is rendered by a CSS stylesheet. Only the text content is read from the clipboard and additionally the structure of this content: the organization of the copied content as ordered/unordered lists, tables, etc. The foreground and background colors, the font family, the font size for different snippets of text have to be set by a CSS stylesheet, not directly in the content of the XML document, because they are part of the presentation of the document, not part of the content, and the two should be kept separate. So you should set the colors that you want in the CSS stylesheet of your document type.
Regards,
Sorin
In Text editing mode Oxygen has a customizable coloring scheme for each type of editor (XML, XSLT, XSD, XQuery, shell, Java, etc). Only the text content is read from the clipboard (where you copied it from Word or Eclipse), the styling is set by the current coloring scheme for the editor type where you paste the text. You can change the colors from menu Options -> Preferences -> Editor / Colors.
In Author editing mode the content is rendered by a CSS stylesheet. Only the text content is read from the clipboard and additionally the structure of this content: the organization of the copied content as ordered/unordered lists, tables, etc. The foreground and background colors, the font family, the font size for different snippets of text have to be set by a CSS stylesheet, not directly in the content of the XML document, because they are part of the presentation of the document, not part of the content, and the two should be kept separate. So you should set the colors that you want in the CSS stylesheet of your document type.
Regards,
Sorin
-
- Posts: 26
- Joined: Mon Feb 18, 2013 5:44 pm
Re: Colored text
Thank you, Sorin. I didn't give the Athor mode and CSS a try, but in the Text mode when I paste a C code from Word nothing happens, it's inserted like a simple black text. I use the default color settings and insert it into the <codeblock> section. How do I make Oxygen to recognize the pasted text as a code fragment?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Colored text
Post by sorin_ristache »
Hi,
Your C code snippet will be colored with a different color for each type of C language token (C keyword, variable name,function name, etc) only in the editors for *.c files and *.cpp files, not inside the <codeblock> element of an XML document. Inside an XML document a codeblock is just plain text that is not interpreted, it does not have a special meaning as in a *.c or *.cpp file. If you create a new file of type C Programming Language or C++ Programming Language then each token of that code block will be colored as a C language token.
Regards,
Sorin
Your C code snippet will be colored with a different color for each type of C language token (C keyword, variable name,function name, etc) only in the editors for *.c files and *.cpp files, not inside the <codeblock> element of an XML document. Inside an XML document a codeblock is just plain text that is not interpreted, it does not have a special meaning as in a *.c or *.cpp file. If you create a new file of type C Programming Language or C++ Programming Language then each token of that code block will be colored as a C language token.
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Colored text
Post by sorin_ristache »
If you want the C code colored in the output of the Oxygen transformation that is available only in the Docbook transformations: you place your C code inside a <programlisting language="c"> element in a Docbook XML document and transform that to XHTML (the buit-in transformation Docbook XHTML) or PDF (the buit-in transformation Docbook PDF). The content of the <programlisting> element will be colored as C language code.
If you keep your content in DITA XML topics you will need to customize the XSLT stylesheets for the DITA Map PDF transformation. These stylesheets are located in [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\Customization, that is in the DITA-OT plugin called org.dita.pdf2. In your DITA XML topics you can for example set a custom value in the outputclass attribute on the codeblock element and match the codeblock/@outputclass attribute in the customized stylesheet for setting a color for that codeblock content.
Regards,
Sorin
If you keep your content in DITA XML topics you will need to customize the XSLT stylesheets for the DITA Map PDF transformation. These stylesheets are located in [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\Customization, that is in the DITA-OT plugin called org.dita.pdf2. In your DITA XML topics you can for example set a custom value in the outputclass attribute on the codeblock element and match the codeblock/@outputclass attribute in the customized stylesheet for setting a color for that codeblock content.
Regards,
Sorin
Return to “DITA (Editing and Publishing DITA Content)”
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