Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » Html from Gtk.TextBuffer and Gtk.TextTag [RSS Feed]

#1 Dec. 10, 2010 17:21:33

Maciej R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Html from Gtk.TextBuffer and Gtk.TextTag

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 =
> 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)

gtk-list mailing list


  • Root
  • » GTK+
  • » Html from Gtk.TextBuffer and Gtk.TextTag [RSS Feed]

Board footer

Moderator control

Enjoy the 12th of December

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support