l.t.b.browser_helpers : module documentation

Part of lp.translations.browser

Translation-related formatting functions.
Class UnrecognisedCFormatString Exception: C-style format string fails to parse.
Function contract_rosetta_escapes Replace Rosetta escape sequences with the real characters.
Function expand_rosetta_escapes Replace characters needing a Rosetta escape sequences.
Function text_to_html Convert a unicode text to a HTML representation.
Function convert_newlines_to_web_form Convert Unicode string to CR/LF line endings as used in web forms.
Function count_lines Count the number of physical lines in a string.
Function parse_cformat_string Parse C-style format string into sequence of segments.
def contract_rosetta_escapes(text):
Replace Rosetta escape sequences with the real characters.
def expand_rosetta_escapes(unicode_text):
Replace characters needing a Rosetta escape sequences.
def text_to_html(text, flags, space=TranslationConstants.SPACE_CHAR, newline=TranslationConstants.NEWLINE_CHAR):
Convert a unicode text to a HTML representation.
def convert_newlines_to_web_form(unicode_text):
Convert Unicode string to CR/LF line endings as used in web forms.

Any style of line endings is accepted: MacOS-style CR, MS-DOS-style CR/LF, or rest-of-world-style LF.

def count_lines(text):
Count the number of physical lines in a string.

This is always at least as large as the number of logical lines in a string.

def parse_cformat_string(string):
Parse C-style format string into sequence of segments.

The result is a sequence of tuples (type, content), where type is either "string" (for a plain piece of string) or "interpolation" (for a printf()-style substitution). The other part of the tuple, content, will be the part of the input string that makes up the given element, so either plain text or a printf substitution such as %s or %.3d.

As in printf(), the double parenthesis (%%) is taken as plain text.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.