Home | Trees | Indices | Help |
---|
|
Convert and validate markup in text.
Author: Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>
License: GPLv3
Functions | |||
string |
|
||
string |
|
||
string |
|
||
string |
|
||
string |
|
||
string |
|
||
string |
|
||
dict |
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
(msg, cat) -> parts
|
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
list of (int, int, string) tuples |
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
string or None |
|
||
list of (int, int, string) tuples |
|
||
(msgstr, msg, cat) -> numerr
|
|
||
(msgstr, msg, cat) -> spans
|
|
||
list of (int, int, string) tuples |
|
Variables | |
flag_no_check_markup =
|
|
xml_entities =
|
|
WS_SPACE =
|
|
WS_TAB =
|
|
WS_NEWLINE =
|
|
html_entities =
|
|
kuit_entities =
|
|
__package__ =
|
|
x =
|
|
y =
|
Function Details |
Convert wrapped plain text to unwrapped. Two or more newlines are considered as paragraph boundaries and left in, while all other newlines are removed. Whitespace in the text is simplified throughout.
|
Convert any XML-like markup to plain text. By default, all tags in the text are replaced with a single space;
entities, unless one of the XML default ( If only a particular subset of tags should be taken into account, it
can be specified by the If a tag should be replaced with a special sequence of characters
(either opening or closing tag), or the text wrapped by it replaced too,
this can be specified by the To have some entities other than the XML default replaced with proper
values, a dictionary of known entities with values may be provided using
the Whitespace can be preserved within some elements, as given by their
tags in the Some elements may be completely removed, as given by the
It is assumed that the markup is well-formed, and if it is not the result is undefined; but best attempt at conversion is made. There are several other functions in this module which deal with well
known markups, such that it is not necessary to use this function with
If you only want to resolve entities from a known set, instead of
calling this function with empty
|
Convert HTML markup to plain text.
|
Convert Qt rich-text markup to plain text.
|
Convert KUIT markup to plain text.
|
Convert KDE4 GUI markup to plain text. KDE4 GUI texts may contain both Qt rich-text and KUIT markup, even
mixed in the same text. Note that the conversion cannot be achieved, in
general, by first converting Qt rich-text, and then KUIT, or vice versa.
For example, if the text has
|
Convert Docbook 4.x markup to plain text.
|
Collect lightweight XML format specification, level 1. Level 1 specification is the dictionary of all known tags, with allowed attributes and subtags for each. File of the level 1 specification is in the following format: # A comment. # Tag with unconstrained attributes and subtags: tagA; # Tag with constrained attributes and unconstrained subtags: tagF : attr1 attr2 ...; # Tag with unconstrained attributes and constrained subtags: tagF > stag1 stag2 ...; # Tag with constrained attributes and subtags: tagF : attr1 attr2 ... > stag1 stag2 ...; # Tag with no attributes and unconstrained subtags: tagA :; # Tag with unconstrained attributes and no subtags: tagA >; # Tag with no attributes and no subtags: tagA :>; # Attribute value constrained by a regular expression: .... attr1=/^(val1|val2|val3)$/i ... # Reserved dummy tag specifying attributes common to all tags: pe-common-attrib : attrX attrY; The specification can contain a dummy tag named
Specification file must be UTF-8 encoded.
|
Validate XML markup in text against level1 specification. Text is not required to have a top tag; if it does not, a dummy one will be assigned to assure that the check passes. If If Tag and attribute names can be made case-insensitive by setting
If text is a part of user interface, and the environment may use the
literal ampersand as accelerator marker, it can be allowed to pass the
check by setting Text can be one or more entity definitions of the form
The result of the check is list of erroneous spans in the text, each given by start and end index (in Python standard semantics), and the error description, packed in a tuple. If there are no errors, empty list is returned. Reported spans need not be formally complete with respect to the error location, but are heuristically determined to be short and provide good visual indication of what triggers the error.
|
Check general XML markup in translation [hook factory]. Text is only checked to be well-formed XML, and possibly also whether encountered entities are defined. Markup errors are reported to stdout.
Entities in addition to XML's default (
If a message has sieve flag
|
Like check_xml, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Validate Docbook 4.x markup in text against level1 specification. Markup definition is extended to include
See validate_xml_l1 for description of the
|
Check XML markup in translations of Docbook 4.x catalogs [hook factory]. See check_xml for description of parameters.
|
Like check_docbook4, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Check for any known problem in translation in messages in Docbook 4.x catalogs [hook factory]. Currently performed checks:
See check_xml for description of parameters.
|
Validate HTML markup in text against level1 specification. At the moment, this function can only check HTML markup if well-formed in the XML sense, although HTML allows omission of some closing tags. See validate_xml_l1 for description of the
|
Check HTML markup in translations [hook factory]. See check_xml for description of parameters. See notes on checking HTML markup to validate_html_l1.
|
Like check_html, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Validate Qt rich-text markup in text against level1 specification. At the moment, this function can only check Qt rich-text if well-formed in the XML sense, although Qt rich-text allows HTML-type omission of closing tags. See validate_xml_l1 for description of the
|
Check Qt rich-text markup in translations [hook factory]. See check_xml for description of parameters. See notes on checking Qt rich-text to validate_qtrich_l1.
|
Like check_qtrich, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Validate KUIT markup in text against level1 specification. KUIT is the semantic markup for user interface in KDE4. See validate_xml_l1 for description of the
|
Validate markup in texts used in KDE4 GUI. KDE4 GUI texts may contain both Qt rich-text and KUIT markup, even mixed in the same text. See validate_xml_l1 for description of the
|
Check XML markup in translations of KDE4 UI catalogs [hook factory]. See check_xml for description of parameters.
|
Like check_kde4, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Validate Pango markup in text against level1 specification. See validate_xml_l1 for description of the
|
Check XML markup in translations of Pango UI catalogs [hook factory]. See check_xml for description of parameters.
|
Like check_pango, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Convert numeric XML entity to character. Numeric XML entities can be decimal, If the entity cannot be converted to a character, for whatever reason,
|
Check whether XML-like entities in the text are among known. The text does not have to be XML markup as such. No XML parsing is performed, only the raw search for XML-like entities.
|
Check existence of XML entities in translations [hook factory]. See check_xml for description of parameters
|
Like check_xmlents, except that erroneous spans are returned instead of reporting problems to stdout [hook factory].
|
Check if sets of
See validate_xml_l1 for description of the return value.
|
Variables Details |
xml_entities
|
html_entities
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Jul 24 21:00:27 2014 | http://epydoc.sourceforge.net |