HTML compliance diagnostics

HTML compliance diagnostics — HTML recovery diagnostics and reporting limits

Functions

Types and Values

Description

A logger receives an issue valid for the duration of its callback. Description and remarks strings are static. A zero per-violation limit means unlimited reporting. Otherwise one truncation marker is emitted at the first suppressed issue; changing the logger, options or limit starts a new reporting budget.

Functions

GMimeHtmlComplianceLogger ()

void
(*GMimeHtmlComplianceLogger) (const GMimeHtmlComplianceIssue *issue,
                              gpointer user_data);

Receives an HTML compliance diagnostic.

Parameters

issue

a diagnostic valid only during this callback.

[transfer none]

user_data

callback data.

[closure][nullable]

g_mime_html_compliance_options_new ()

GMimeHtmlComplianceOptions *
g_mime_html_compliance_options_new (void);

Returns

new diagnostic options.

[transfer full]


g_mime_html_compliance_options_ref ()

GMimeHtmlComplianceOptions *
g_mime_html_compliance_options_ref (GMimeHtmlComplianceOptions *options);

Parameters

options

diagnostic options

 

Returns

options with an additional reference.

[transfer full]


g_mime_html_compliance_options_unref ()

void
g_mime_html_compliance_options_unref (GMimeHtmlComplianceOptions *options);

Releases one reference to options .

Parameters

options

diagnostic options to release.

[transfer full][nullable]

g_mime_html_compliance_options_clone ()

GMimeHtmlComplianceOptions *
g_mime_html_compliance_options_clone (const GMimeHtmlComplianceOptions *options);

Parameters

options

diagnostic options to copy

 

Returns

an independent copy of options .

[transfer full]


g_mime_html_compliance_options_get_max_issues_per_violation ()

guint
g_mime_html_compliance_options_get_max_issues_per_violation
                               (const GMimeHtmlComplianceOptions *options);

Gets the reporting limit for each violation. The default is zero, meaning unlimited reporting.

Parameters

options

diagnostic options

 

Returns

the maximum number of reports per violation, or zero for no limit


g_mime_html_compliance_options_set_max_issues_per_violation ()

void
g_mime_html_compliance_options_set_max_issues_per_violation
                               (GMimeHtmlComplianceOptions *options,
                                guint maximum);

Sets the reporting limit. A tokenizer emits one GMIME_HTML_COMPLIANCE_VIOLATION_TOO_MANY_COMPLIANCE_ISSUES diagnostic when reports are first suppressed. Changing the limit resets its reporting budget.

Parameters

options

diagnostic options

 

maximum

the maximum number of reports per violation, or zero for no limit

 

g_mime_html_compliance_violation_get_description ()

const char *
g_mime_html_compliance_violation_get_description
                               (GMimeHtmlComplianceViolation violation);

Parameters

violation

a compliance violation

 

Returns

a static description of violation .

[transfer none]


g_mime_html_compliance_violation_get_remarks ()

const char *
g_mime_html_compliance_violation_get_remarks
                               (GMimeHtmlComplianceViolation violation);

Parameters

violation

a compliance violation

 

Returns

static remarks about violation .

[transfer none]


g_mime_html_compliance_violation_get_severity ()

GMimeComplianceSeverity
g_mime_html_compliance_violation_get_severity
                               (GMimeHtmlComplianceViolation violation);

Gets the default severity of violation .

Parameters

violation

a compliance violation

 

Returns

the diagnostic severity


g_mime_html_compliance_violation_get_categories ()

GMimeComplianceCategories
g_mime_html_compliance_violation_get_categories
                               (GMimeHtmlComplianceViolation violation);

Gets the diagnostic categories associated with violation .

Parameters

violation

a compliance violation

 

Returns

the diagnostic category flags

Types and Values

enum GMimeHtmlComplianceViolation

HTML lexical and structural recovery diagnostics. Descriptions, remarks, severities and categories are available through the violation accessors.

Members

GMIME_HTML_COMPLIANCE_VIOLATION_NONE

No violation.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_BEFORE_TAG_NAME

Input ended immediately after a tag opener.

 

GMIME_HTML_COMPLIANCE_VIOLATION_INVALID_FIRST_CHARACTER_OF_TAG_NAME

A tag opener was followed by an invalid first name character.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME

A tag opener was followed by a question mark.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_END_TAG_NAME

An end tag had no name.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_IN_TAG

Input ended inside a tag.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_SOLIDUS_IN_TAG

A slash inside a tag was not followed by its closing greater-than sign.

 

GMIME_HTML_COMPLIANCE_VIOLATION_END_TAG_WITH_ATTRIBUTES

An end tag had attributes.

 

GMIME_HTML_COMPLIANCE_VIOLATION_END_TAG_WITH_TRAILING_SOLIDUS

An end tag had a trailing slash.

 

GMIME_HTML_COMPLIANCE_VIOLATION_DUPLICATE_ATTRIBUTE

A tag repeated an attribute name.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_ATTRIBUTE_VALUE

An attribute name and equals sign were not followed by a value.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_WHITESPACE_BETWEEN_ATTRIBUTES

A quoted attribute value was not followed by whitespace.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME

An attribute name contained a quote or less-than sign.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE

An unquoted attribute value contained a forbidden character.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME

An attribute name began with an equals sign.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ABRUPT_CLOSING_OF_EMPTY_COMMENT

An empty comment was closed prematurely.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_IN_COMMENT

Input ended inside a comment.

 

GMIME_HTML_COMPLIANCE_VIOLATION_INCORRECTLY_CLOSED_COMMENT

A comment closer contained an unexpected exclamation mark.

 

GMIME_HTML_COMPLIANCE_VIOLATION_INCORRECTLY_OPENED_COMMENT

A markup-declaration opener was not followed by a recognized declaration.

 

GMIME_HTML_COMPLIANCE_VIOLATION_NESTED_COMMENT

A comment contained another comment opener.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ABRUPT_DOC_TYPE_PUBLIC_IDENTIFIER

A greater-than sign terminated a DOCTYPE public identifier before its closing quote.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ABRUPT_DOC_TYPE_SYSTEM_IDENTIFIER

A greater-than sign terminated a DOCTYPE system identifier before its closing quote.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_IN_DOC_TYPE

Input ended inside a DOCTYPE.

 

GMIME_HTML_COMPLIANCE_VIOLATION_INVALID_CHARACTER_SEQUENCE_AFTER_DOC_TYPE_NAME

A DOCTYPE name was followed by an invalid keyword or character.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_DOC_TYPE_NAME

A DOCTYPE had no name.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_DOC_TYPE_PUBLIC_IDENTIFIER

A DOCTYPE PUBLIC keyword was not followed by a public identifier.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_DOC_TYPE_SYSTEM_IDENTIFIER

A DOCTYPE SYSTEM keyword was not followed by a system identifier.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_QUOTE_BEFORE_DOC_TYPE_PUBLIC_IDENTIFIER

A DOCTYPE public identifier was not quoted.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_QUOTE_BEFORE_DOC_TYPE_SYSTEM_IDENTIFIER

A DOCTYPE system identifier was not quoted.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_WHITESPACE_AFTER_DOC_TYPE_PUBLIC_KEYWORD

A DOCTYPE PUBLIC keyword was not followed by whitespace.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_WHITESPACE_AFTER_DOC_TYPE_SYSTEM_KEYWORD

A DOCTYPE SYSTEM keyword was not followed by whitespace.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_WHITESPACE_BEFORE_DOC_TYPE_NAME

The DOCTYPE keyword was not followed by whitespace.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_WHITESPACE_BETWEEN_DOC_TYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS

DOCTYPE public and system identifiers were not separated by whitespace.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_CHARACTER_AFTER_DOC_TYPE_SYSTEM_IDENTIFIER

A DOCTYPE system identifier was followed by an invalid character.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE

A numeric character reference had no digits.

 

GMIME_HTML_COMPLIANCE_VIOLATION_CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE

A numeric character reference exceeded U+10FFFF.

 

GMIME_HTML_COMPLIANCE_VIOLATION_CONTROL_CHARACTER_REFERENCE

A numeric character reference named a control character.

 

GMIME_HTML_COMPLIANCE_VIOLATION_MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE

A character reference lacked its terminating semicolon.

 

GMIME_HTML_COMPLIANCE_VIOLATION_NONCHARACTER_CHARACTER_REFERENCE

A numeric character reference named a Unicode noncharacter.

 

GMIME_HTML_COMPLIANCE_VIOLATION_NULL_CHARACTER_REFERENCE

A numeric character reference named U+0000.

 

GMIME_HTML_COMPLIANCE_VIOLATION_SURROGATE_CHARACTER_REFERENCE

A numeric character reference named a UTF-16 surrogate code point.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNKNOWN_NAMED_CHARACTER_REFERENCE

A semicolon-terminated named character reference was unrecognized.

 

GMIME_HTML_COMPLIANCE_VIOLATION_C_DATA_IN_HTML_CONTENT

A CDATA section appeared outside SVG or MathML content.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_IN_C_DATA

Input ended inside a CDATA section.

 

GMIME_HTML_COMPLIANCE_VIOLATION_EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT

Input ended inside comment-like text in a script element.

 

GMIME_HTML_COMPLIANCE_VIOLATION_UNEXPECTED_NULL_CHARACTER

Input contained U+0000.

 

GMIME_HTML_COMPLIANCE_VIOLATION_IGNORED_START_TAG

A start tag was ignored.

 

GMIME_HTML_COMPLIANCE_VIOLATION_FOREIGN_CONTENT_BREAKOUT

A tag broke out of foreign content, closing SVG or MathML elements.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ATTRIBUTES_MERGED_INTO_EXISTING_ELEMENT

A start tag's attributes were added to an existing element.

 

GMIME_HTML_COMPLIANCE_VIOLATION_ELEMENT_DEPTH_LIMIT_EXCEEDED

Element nesting exceeded the configured limit.

 

GMIME_HTML_COMPLIANCE_VIOLATION_FORMATTING_RECOVERY_LIMIT_EXCEEDED

Active formatting could not be recovered within the configured budget.

 

GMIME_HTML_COMPLIANCE_VIOLATION_TOO_MANY_COMPLIANCE_ISSUES

The diagnostic cap suppressed further issues. Its value is reserved outside the range of ordinary violations.

 

GMimeHtmlComplianceIssue

typedef struct {
	GMimeHtmlComplianceViolation violation;
	GMimeComplianceSeverity severity;
	GMimeComplianceCategories categories;
	gint64 offset;
	int line_number, line_position;
	const char *description;
} GMimeHtmlComplianceIssue;

A diagnostic borrowed by a compliance callback. The structure is only valid for the duration of that callback.

Members

GMimeHtmlComplianceViolation violation;

the reported violation

 

GMimeComplianceSeverity severity;

diagnostic severity

 

GMimeComplianceCategories categories;

diagnostic categories

 

gint64 offset;

zero-based Unicode scalar offset

 

int line_number;

one-based line number

 

int line_position;

one-based Unicode scalar column

 

const char *description;

a borrowed description.

[transfer none]

GMimeHtmlComplianceOptions

typedef struct _GMimeHtmlComplianceOptions GMimeHtmlComplianceOptions;

Reference-counted options controlling HTML diagnostic reporting limits.