How to implement auto-formatting of text (e.g. syntax highlighting of code snippets)?

C. Boemann cbo at boemann.dk
Tue Jul 24 12:12:01 BST 2012


On Tuesday 24 July 2012 03:08:27 Friedrich W. H. Kossebau wrote:
> 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
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel
Hi

The textediting plugins seems like what you are after. We already have 
autocorrection, and it sounds like it's just an advanced autocorrection you 
want.

see plugins/textediting

As for odf support i somehow doubt it is relevant enough. Maybe we can just 
reuse the language tags. That is sort of what it is actually



More information about the calligra-devel mailing list