as-markup

as-markup — Functions for managing AppStream description markup

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <appstream-glib.h>

enum                AsMarkupConvertFormat;
enum                AsMarkupConvertFlag;
gchar *             as_markup_convert_simple            (const gchar *markup,
                                                         GError **error);
gchar *             as_markup_convert                   (const gchar *markup,
                                                         AsMarkupConvertFormat format,
                                                         GError **error);
gchar *             as_markup_convert_full              (const gchar *markup,
                                                         AsMarkupConvertFormat format,
                                                         AsMarkupConvertFlag flags,
                                                         GError **error);
gboolean            as_markup_validate                  (const gchar *markup,
                                                         GError **error);
gchar **            as_markup_strsplit_words            (const gchar *text,
                                                         guint line_len);
gchar *             as_markup_import                    (const gchar *text,
                                                         AsMarkupConvertFormat format,
                                                         GError **error);

Description

These functions are used internally to libappstream-glib, and some may be useful to user-applications.

Details

enum AsMarkupConvertFormat

typedef enum {
	AS_MARKUP_CONVERT_FORMAT_SIMPLE,
	AS_MARKUP_CONVERT_FORMAT_MARKDOWN,
	AS_MARKUP_CONVERT_FORMAT_NULL,		/* Since: 0.5.2 */
	AS_MARKUP_CONVERT_FORMAT_APPSTREAM, /* Since: 0.5.2 */
	AS_MARKUP_CONVERT_FORMAT_HTML,		/* Since: 0.5.11 */
} AsMarkupConvertFormat;

The format used when converting to or from AppStream descriptions.

AS_MARKUP_CONVERT_FORMAT_SIMPLE

UTF-8 text

AS_MARKUP_CONVERT_FORMAT_MARKDOWN

Markdown format

AS_MARKUP_CONVERT_FORMAT_NULL

No output

AS_MARKUP_CONVERT_FORMAT_APPSTREAM

AppStream (passthrough)

AS_MARKUP_CONVERT_FORMAT_HTML

HyperText Markup Language

enum AsMarkupConvertFlag

typedef enum {
	AS_MARKUP_CONVERT_FLAG_NONE		= 0,
	AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS = 1 << 0,
} AsMarkupConvertFlag;

The flags used when converting descriptions from AppStream-style.

AS_MARKUP_CONVERT_FLAG_NONE

No flags set

AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS

Ignore errors where possible

as_markup_convert_simple ()

gchar *             as_markup_convert_simple            (const gchar *markup,
                                                         GError **error);

Converts an XML description into a printable form.

markup :

the text to copy.

error :

A GError or NULL

Returns :

a newly allocated NULL terminated string. [transfer full]

Since 0.1.0


as_markup_convert ()

gchar *             as_markup_convert                   (const gchar *markup,
                                                         AsMarkupConvertFormat format,
                                                         GError **error);

Converts an XML description into a printable form.

markup :

the text to copy.

format :

the AsMarkupConvertFormat, e.g. AS_MARKUP_CONVERT_FORMAT_MARKDOWN

error :

A GError or NULL

Returns :

a newly allocated NULL terminated string. [transfer full]

Since 0.3.5


as_markup_convert_full ()

gchar *             as_markup_convert_full              (const gchar *markup,
                                                         AsMarkupConvertFormat format,
                                                         AsMarkupConvertFlag flags,
                                                         GError **error);

Converts an XML description into a printable form.

markup :

the text to copy.

format :

the AsMarkupConvertFormat, e.g. AS_MARKUP_CONVERT_FORMAT_MARKDOWN

flags :

the AsMarkupConvertFlag, e.g. AS_MARKUP_CONVERT_FLAG_IGNORE_ERRORS

error :

A GError or NULL

Returns :

a newly allocated NULL terminated string. [transfer full]

Since 0.3.5


as_markup_validate ()

gboolean            as_markup_validate                  (const gchar *markup,
                                                         GError **error);

Validates some markup.

markup :

the text to validate

error :

A GError or NULL

Returns :

TRUE if the appstream description was valid

Since 0.5.1


as_markup_strsplit_words ()

gchar **            as_markup_strsplit_words            (const gchar *text,
                                                         guint line_len);

Splits up a long line into an array of smaller strings, each being no longer than line_len. Words are not split.

text :

the text to split.

line_len :

the maximum length of the output line

Returns :

lines, or NULL in event of an error. [transfer full]

Since 0.3.5


as_markup_import ()

gchar *             as_markup_import                    (const gchar *text,
                                                         AsMarkupConvertFormat format,
                                                         GError **error);

Imports text and converts to AppStream markup.

text :

the text to import.

format :

the AsMarkupConvertFormat, e.g. AS_MARKUP_CONVERT_FORMAT_SIMPLE

error :

A GError or NULL

Returns :

appstream markup, or NULL in event of an error. [transfer full]

Since 0.5.11