Html from Gtk.TextBuffer and Gtk.TextTag
- From: Maciej Rumianowski <maciej rumianowski gmail com>
- To: GTK+ list <gtk-list gnome org>
- Subject: Html from Gtk.TextBuffer and Gtk.TextTag
- Date: Fri, 10 Dec 2010 18:21:07 +0100
Dear List,
recently I have started to code a text editor. At the end the text will
be published to blogger, so html encoding is desired.
How should I approach that in vala?
I have found on gnome-blog's source that TextTags in rich_entry.py are
created with opening_tag and closing_tag. Before publishing, html
converting is done through a TextBuffer. Those opening and closing tags
are used:
in rich_entry.py
> html_converter.para_tag = self.buffer.create_tag("p")
> html_converter.para_tag.opening_tag = "<p>"
> html_converter.para_tag.closing_tag = "</p>"
in html_converter.py
> def getHTML(buffer):
> global para_tag
>
> next_iter = buffer.get_start_iter()
>
> open_tags = [ para_tag ]
> html = "<p>" + _getTagsHTML(next_iter, open_tags)
>
> while not next_iter.is_end():
> iter = next_iter
> next_iter = _getNextIter(iter)
>
> new_text = buffer.get_text(iter, next_iter, True)
> html = html + new_text + _getTagsHTML(next_iter, open_tags)
>
> return html.decode('utf8')
Should I do the same in vala?
Best Regards,
Maciek Rumianowski (rumianom)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]