Coerces Rich Text properly.
499865
def coerce(self, value, includes=None, errors=None, resources=None, default_locale='en-US', locale=None):
        """"""

        if includes is None:
            includes = []
        if errors is None:
            errors = []

        return self._coerce_block(
            value,
            includes=includes,
            errors=errors,
            resources=resources,
            default_locale=default_locale,
            locale=locale
        )
596342
def show_plain_text(self, text):
        """"""
        self.switch_to_plugin()
        self.switch_to_plain_text()
        self.set_plain_text(text, is_code=False)
964970
function filterText(text) {
        var newText = text;
        if (text.length > preferences.getMaxFileSize()) {
            newText = "";
        }
        return newText;
    }
1330826
public function forceLiteral()
    {
        $this->_filter = $this->_filterParams();
        // Keep binary status, if set
        $this->_filter->literal = true;
        $this->_filter->quoted = false;
    }
158109
function applyEmbeddedRuleset(text, ruleset) {
        var valueMap,
            embedded = text && text.match(embeddedRuleset),
            rules = embedded && embedded[1];

        if (rules) {
            valueMap = {
                "true": 2,  // true is error
                "": 1,      // blank is warning
                "false": 0, // false is ignore
                "info": 3,  // ORION allow info severity
                "3": 3,     // ORION allow info severity
                "2": 2,     // explicit error
                "1": 1,     // explicit warning
                "0": 0      // explicit ignore
            };

            rules.toLowerCase().split(",").forEach(function(rule) {
                var pair = rule.split(":"),
                    property = pair[0] || "",
                    value = pair[1] || "";

                ruleset[property.trim()] = valueMap[value.trim()];
            });
        }

        return ruleset;
    }
64330
def clean_text(self, text, **kwargs):
        """"""
        text = text.replace(" ", "")
        text = text.upper()
        return text
807126
def text(self,text):
        
        if text:
            text = utfstr(text)
            text = text.strip()
            text = re.sub('\s+',' ',text)
            if text:
                self.dirty = True
                self.escpos.text(text)
1363516
def clean(text):
    



    text = bold_italic.sub(r'\1', text)
    text = bold.sub(r'\1', text)
    text = italic_quote.sub(r'"\1"', text)
    text = italic.sub(r'"\1"', text)
    text = quote_quote.sub(r'"\1"', text)
    # residuals of unbalanced quotes
    text = text.replace("'''", '').replace("''", '"')
    text = newlines.sub(r'\n', text)
    text = bulletlist.sub(r'', text)

    # Collect spans

    spans = []
    # Drop HTML comments
    for m in comment.finditer(text):
            spans.append((m.start(), m.end()))

    # Drop self-closing tags
    for pattern in selfClosing_tag_patterns:
        for m in pattern.finditer(text):
            spans.append((m.start(), m.end()))

    # Drop ignored tags
    for left, right in ignored_tag_patterns:
        for m in left.finditer(text):
            spans.append((m.start(), m.end()))
        for m in right.finditer(text):
            spans.append((m.start(), m.end()))

    # Bulk remove all spans
    text = dropSpans(spans, text)

    # Drop discarded elements
    for tag in discardElements:
        text = dropNested(text, r'<\s*%s\b[^>/]*>' % tag, r'<\s*/\s*%s>' % tag)

    # Expand placeholders
    for pattern, placeholder in placeholder_tag_patterns:
        index = 1
        for match in pattern.finditer(text):
            text = text.replace(match.group(), '%s_%d' % (placeholder, index))
            index += 1

    text = text.replace('<<', u'Â«').replace('>>', u'Â»')

    #############################################

    # Cleanup text
    text = text.replace('\t', ' ')
    text = spaces.sub(' ', text)
    text = dots.sub('...', text)
    text = re.sub(u' (,:\.\)\]Â»)', r'\1', text)
    text = re.sub(u'(\[\(Â«) ', r'\1', text)
    text = re.sub(r'\n\W+?\n', '\n', text, flags=re.U) # lines with only punctuations
    text = text.replace(',,', ',').replace(',.', '.')

    return text
1105121
def slugify(text, sep='-'):
    """"""
    text = stringify(text)
    if text is None:
        return None
    text = text.replace(sep, WS)
    text = normalize(text, ascii=True)
    if text is None:
        return None
    return text.replace(WS, sep)
1282685
private void cleanContentLeadingSpaces()
    {
        if (getContent().length() > 0) {
            if (fPreviousInlineText.length() == 0
                || fPreviousInlineText
                .charAt(fPreviousInlineText.length() - 1) == ' ')
            {
                trimLeadingWhiteSpaces();
            }
        }
    }
496665
def with_text(self, text, markdown=None):
        '''
        '''
        self._text = text
        self._markdown = markdown or False

        return self
78374
def handle_whitespace(text):
    
    """
    text = re_retab.sub(sub_retab, text)
    text = re_whitespace.sub('', text).strip()
    return text
584479
def _normalize_answer(text: str) -> str:
    """"""

    parts = [_white_space_fix(_remove_articles(_normalize_number(_remove_punc(_lower(token)))))
             for token in _tokenize(text)]
    parts = [part for part in parts if part.strip()]
    normalized = ' '.join(parts).strip()
    return normalized
244300
def clean_text(self, text):
        ''''''
        if text is None:
            return ''
        text = re.sub(ILLEGAL_CHARACTERS_RE, '', text)
        if '<' in text or '&lt' in text:
            text = clean(text, tags=self.tags, strip=self.strip)

        return unescape(text)
1212320
def coerce(self, value):
        """"""
        if self.type == Style:
            return value
        elif self.type == list:
            return self.type(
                map(self.subtype, map(lambda x: x.strip(), value.split(',')))
            )
        elif self.type == dict:
            rv = {}
            for pair in value.split(','):
                key, val = pair.split(':')
                key = key.strip()
                val = val.strip()
                try:
                    rv[key] = self.subtype(val)
                except Exception:
                    rv[key] = val
            return rv
        return self.type(value)
681137
function sluggifyText (text) {
  const slug = unEscapeHtmlTags(text).toLowerCase()
    // Replace 'unsafe' chars with dashes (!!!! is changed to -)
    .replace(unsafeCharsRegex, '-')
    // Replace multiple concurrent dashes with a single dash
    .replace(multiDashRegex, '-')
    // Remove trailing -
    .replace(lastCharDashRegex, '')
  // Encode the resulting string to make it url-safe
  return encodeURIComponent(slug)
}
466337
def clean_text(text):
    """"""
    # Replace a few nasty unicode characters with their ASCII equivalent
    maps = {u'×': u'x', u'–': u'-', u'−': '-'}
    for element in maps:
        text = text.replace(element, maps[element])

    # Replace genitives
    text = re.sub(r'(?<=\w)\'s\b|(?<=\w)s\'(?!\w)', '  ', text)

    logging.debug(u'Clean text: "%s"', text)

    return text