开发者

XSL-FO - is it possible to automatically format sourcecode?

开发者 https://www.devze.com 2023-04-03 07:47 出处:网络
Can this be done? I have a elemen开发者_运维问答t <programlisting> with a source code or XML part and I want to make it look nice. The only solution I found is to add white-space=\"pre\" in the

Can this be done? I have a elemen开发者_运维问答t <programlisting> with a source code or XML part and I want to make it look nice. The only solution I found is to add white-space="pre" in the transformation and format the XML manualy. But the painful thing is autoformat in the Eclipse IDE which ruins the manual attempt every time I use it.


I am assuming that you are producing a PDF. Is it for e-reading or print? Or to put it differently do you need need users to select/highlight the code and copy? If not you may consider using images to preserve the layout - hardly an ideal solution, but it will look as you want it to. What language is the source code? Are you using Docbook (it looks like you are) Are you wrapping your code inside CDATA?

0

精彩评论

暂无评论...
验证码 换一张
取 消