Syntax highlight for CodeBlock of OpenDocument
By #6711, syntax highlighting for inline Code has been implemented. Syntax highlighting for CodeBlock is also implemented based on Docx Writer.
- Paragraph style of CodeBlock is changed from "Preformatted_20_Text" to "Source_Code".
- As similar to docx writer, CodeBlock is decomposed to "Code + LineBreak" lines.
- To do this, inlineToOpenDocument Code is updated again to treat multiple lines.
- Styles will be incorporated by Writer/ODT.hs
Further discussion will be added to #6710.
OK, now I understand better than I did in your comment on the other issue. I think this approach will work, yes!
Thank you for reviewing. Basically, I will continue based on this concept. But, entire of my plan to implement highlight is changed. I will write that concept to original issue #6710 (maybe tomorrow or later).
Several Items of progress,
- I found a bug in this code.
CodeBlockwith\nis not converted to LineBreak correctly. This is fixed locally. - I tried to update a test by updating writer.opendocument.
But original file cannot be opened by LibreOffice (LibreOffice says this xml has format error.). To check it, I placed this file into odt as a context.xml by my hand. I'm now checking grammatically incorrect portion and will update them together.
Sorry for bothering. As I updated my comment above, original write.opendocument has no problem.
My misunderstanding is caused by hand insertion to odt file. Filepath of figures are not same when I use --to odt and --to opendocument. (For odt output, filenames of figure are updated by odt writer and they are incorporated into its inside)
This includes update of CodeBlock and writer.opendocument for updating test.
Latest commit is excluding unintentionally incorporated local code for my test...
I will rebase and clean these commits and notice again.
Can you rebase against current master so I can try this out?
I rebased this here and noted a small regression: it seems that code blocks that are nested in lists are no longer indented:
Current:

odt_highlight:

@niszet, could you take a look?