Markup Helpers

Markup Helpers — Helpers for reading/writing markup to GtkTextBuffers.

Functions

Description

This API provides the ability to serialize and deserialize mark to/from GtkTextBuffers.

Functions

talkatu_markup_deserialize_html ()

gboolean
talkatu_markup_deserialize_html (GtkTextBuffer *register_buffer,
                                 GtkTextBuffer *content_buffer,
                                 GtkTextIter *iter,
                                 const guint8 *data,
                                 gsize length,
                                 gboolean create_tags,
                                 gpointer user_data,
                                 GError **error);

This is a GtkTextBufferDeserializeFunc function that will deserialize HTML data from data into content_buffer . It should be registered with with gtk_text_buffer_register_deserializer_format in the buffer's instance_init function.

Parameters

register_buffer

The GtkTextBuffer the format is registered with.

 

content_buffer

The GtkTextBuffer to deserialize into.

 

iter

Insertion point for the deserialized text.

 

data

The data to deserialize.

 

length

The length of data .

 

create_tags

TRUE if deserializing may create tags

 

user_data

User data that was specified when registering the format.

 

error

Return location for a GError.

 

Returns

TRUE on success, or FALSE on error with error set.


talkatu_markup_append_html ()

void
talkatu_markup_append_html (TalkatuBuffer *buffer,
                            const gchar *text,
                            gint len);

Appends text to buffer at the current insertion point of buffer .

Parameters

buffer

The TalkatuBuffer instance.

 

text

The text to append.

 

len

The len of text .

 

talkatu_markup_insert_html ()

void
talkatu_markup_insert_html (TalkatuBuffer *buffer,
                            GtkTextIter *iter,
                            const gchar *text,
                            gint len);

Inserts text in buffer at iter .

Parameters

buffer

The TalkatuBuffer instance.

 

iter

The insertion point for the deserialized text.

 

text

The text to insert.

 

len

The length of text .

 

talkatu_markup_set_html ()

void
talkatu_markup_set_html (TalkatuBuffer *buffer,
                         const gchar *text,
                         gint len);

Replaces all text in buffer with text .

Parameters

buffer

A TalkatuBuffer instance

 

text

The HTML text to set.

 

len

The length of text , or -1.

 

talkatu_markup_serialize_html ()

guint8 *
talkatu_markup_serialize_html (GtkTextBuffer *register_buffer,
                               GtkTextBuffer *content_buffer,
                               const GtkTextIter *start,
                               const GtkTextIter *end,
                               gsize *length,
                               gpointer user_data);

This is a GtkTextBufferSerializeFunc that should be registered with gtk_text_buffer_register_serialize_func in the buffer's instance_init method.

Parameters

register_buffer

The GtkTextBuffer for which the format is registered.

 

content_buffer

The GtkTextBuffer to serialize.

 

start

Start of the block of text to serialize.

 

end

End of the block of text to serialize.

 

length

Return location for the length of the serialized data.

 

user_data

User data that was specified when registering the format.

 

Returns

The serialized HTML data.

[transfer full]


talkatu_markup_get_html ()

gchar *
talkatu_markup_get_html (GtkTextBuffer *buffer,
                         gsize *len);

Extracts all text from buffer as an HTML string.

Parameters

buffer

The GtkTextBuffer instance.

 

len

A return address for the length of text extracted.

 

Returns

The extracted HTML string.

[transfer full]


talkatu_markup_get_html_range ()

gchar *
talkatu_markup_get_html_range (GtkTextBuffer *buffer,
                               const GtkTextIter *start,
                               const GtkTextIter *end,
                               gsize *len);

Extracts a section of buffer into an HTML string.

Parameters

buffer

The GtkTextBuffer instance.

 

start

The starting point to get.

 

end

The ending point to get.

 

len

A return address for the length of text extracted.

 

Returns

The HTML string.

[transfer full]

Types and Values