How to implement auto-formatting of text (e.g. syntax highlighting of code snippets)?
Friedrich W. H. Kossebau
kossebau at kde.org
Tue Jul 24 02:08:27 BST 2012
Hi,
feature, not bug this time :)
As software developer you often have sourcecode snippets in your documents or
slides. Now, ideally that code snippet has some syntax highlighting like you
are used from your sourcecode editor.
Of course, that should be done automatically, like in the editor, after you
set the type of syntax.
How do I implement this in Calligra? As a shape? Or is it hopefully possible
to have some text style which updates the formatting of the text it is set for
on every text change? What about the linebreaks? Is there a way to group a
range of paragraphs? How eats entered series of whitespaces (and all at begin
of line), or are they just ignored in normal styles?
Is there something in ODF which supports that (besides setting some calligra-
namespaced attribute, which to a text paragraph in the storage format)?
Could it be similar to how either tables are embedded in the text flow, or by
how e.g. a multi-paragraph quote is done, by having three paragraph styles for
codes (begin paragraph style, middle paragraphs style, end paragraph style),
which Calligra is smart enough to detect and then have a special handler which
cares for the autoformatting?
For roundtrips with non-Calligra programs the text would be just saved as
normally formatted text, just with additional annotation that tells Calligra
to use autoformatting for it.
Anyone ever started on this?
I dream of being able to reuse Kate's syntax highlighting engine for that, for
maximal reuse and consistency :)
Is autoformatting perhaps also something to consider to add to ODF 1.3?
Any other autoformatting use cases besides syntax highlighting for sourcecode?
Cheers
Friedrich
More information about the calligra-devel
mailing list