Show text in rich mode
323852
def show_rich_text(self, text, collapse=False, img_path=''):
        """"""
        self.switch_to_plugin()
        self.switch_to_rich_text()
        context = generate_context(collapse=collapse, img_path=img_path,
                                   css_path=self.css_path)
        self.render_sphinx_doc(text, context)
1013916
def render(self, text, auth=None):
        
        if markdown is None:
            import markdown
        if UrlizeExtension is None:
            from .mdx_urlize import UrlizeExtension
        return markdown.markdown(text, extensions=[
            'fenced_code',
            'codehilite(css_class=highlight)',
            'toc',
            'tables',
            'sane_lists',
            UrlizeExtension(),
        ])
576299
def _render_item(self, depth, key, value = None, **settings):
        
        strptrn  = self.INDENT * depth

        lchar = self.lchar(settings[self.SETTING_LIST_STYLE])
        s = self._es_text(settings, settings[self.SETTING_LIST_FORMATING])
        lchar = self.fmt_text(lchar, **s)

        strptrn = "{}"
        if value is not None:
            strptrn += ": {}"
        s = self._es_text(settings, settings[self.SETTING_TEXT_FORMATING])
        strptrn = self.fmt_text(strptrn.format(key, value), **s)

        return '{} {} {}'.format(self.INDENT * depth, lchar, strptrn)
1169650
def get_text(self, node):
        """"""
        return click.style(
            repr(node), fg='green' if node.level > 1 else 'red'
        )
964970
function filterText(text) {
        var newText = text;
        if (text.length > preferences.getMaxFileSize()) {
            newText = "";
        }
        return newText;
    }
509413
private void initModes() {

        // set all internal modes to disabled
        m_modeEnabled = false;
        m_modeReplaceParagraphs = false;
        m_modeWord = false;
        m_modeXhtml = false;

        // extract all operation modes
        List<String> modes = getModes();

        // configure the tidy depending on the operation mode
        if (modes.contains(CmsHtmlConverter.PARAM_ENABLED)) {
            m_modeEnabled = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_XHTML)) {
            m_modeEnabled = true;
            m_modeXhtml = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_WORD)) {
            m_modeEnabled = true;
            m_modeWord = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_REPLACE_PARAGRAPHS)) {
            m_modeEnabled = true;
            m_modeReplaceParagraphs = true;
        }

        // get line separator length
        m_lineSeparatorLength = System.getProperty("line.separator").length();

        // we need this only if the conversion is enabled
        if (m_modeEnabled) {

            // create the main tidy object
            m_tidy = new Tidy();

            // set specified word, XHTML conversion settings
            m_tidy.setXHTML(m_modeXhtml);
            m_tidy.setWord2000(m_modeWord);

            // add additional tags
            // those are required to handle word 2002 (and newer) documents
            Properties additionalTags = new Properties();
            additionalTags.put("new-empty-tags", "o:smarttagtype");
            additionalTags.put("new-inline-tags", "o:smarttagtype");
            m_tidy.getConfiguration().addProps(additionalTags);

            // set the default tidy configuration

            // set the tidy encoding
            m_tidy.setInputEncoding(getEncoding());
            m_tidy.setOutputEncoding(getEncoding());

            // disable the tidy meta element in output
            m_tidy.setTidyMark(false);
            // disable clean mode
            m_tidy.setMakeClean(false);
            // enable numeric entities
            m_tidy.setNumEntities(true);
            // create output of the body only
            m_tidy.setPrintBodyOnly(true);
            // force output creation even if there are tidy errors
            m_tidy.setForceOutput(true);
            // set tidy to quiet mode to prevent output
            m_tidy.setQuiet(true);
            // disable warning output
            m_tidy.setShowWarnings(false);
            // allow comments in the output
            m_tidy.setHideComments(false);
            // set no line break before a <br>
            m_tidy.setBreakBeforeBR(false);
            // don't wrap attribute values
            m_tidy.setWrapAttVals(false);
            // warp lines after 100 chars
            m_tidy.setWraplen(100);
            // no indentation
            m_tidy.setSpaces(0);

            if (m_modeWord) {
                // create the regular expression for cleanup, only used in word clean mode
                m_clearStyle = new Pattern[m_cleanupPatterns.length];
                for (int i = 0; i < m_cleanupPatterns.length; i++) {
                    m_clearStyle[i] = Pattern.compile(m_cleanupPatterns[i]);
                }
            }

            // add paragraph replacement regular expression and values if needed
            if (m_modeReplaceParagraphs) {
                // add the regular expression and values for paragraph replacements
                String[] newPatterns = new String[m_replacePatterns.length + m_replaceParagraphPatterns.length];
                String[] newValues = new String[m_replacePatterns.length + m_replaceParagraphPatterns.length];
                System.arraycopy(m_replacePatterns, 0, newPatterns, 0, m_replacePatterns.length);
                System.arraycopy(
                    m_replaceParagraphPatterns,
                    0,
                    newPatterns,
                    m_replacePatterns.length,
                    m_replaceParagraphPatterns.length);
                System.arraycopy(m_replaceValues, 0, newValues, 0, m_replacePatterns.length);
                System.arraycopy(
                    m_replaceParagraphValues,
                    0,
                    newValues,
                    m_replacePatterns.length,
                    m_replaceParagraphPatterns.length);
                m_replacePatterns = newPatterns;
                m_replaceValues = newValues;
            }

            // create the regular expression for replace
            m_replaceStyle = new Pattern[m_replacePatterns.length];
            for (int i = 0; i < m_replacePatterns.length; i++) {
                m_replaceStyle[i] = Pattern.compile(m_replacePatterns[i]);
            }
        }
    }
1092589
protected function display_mode() {

		// Get timestamp
		$timestamp  = mktime( 0, 0, 0, $this->month, $this->day, $this->year );
		$this_month = getdate( $timestamp );
		$start_day  = $this_month['wday'];

		// All day events
		echo $this->get_all_day_row();

		// Multi day events
		echo $this->get_multi_day_row();

		// Loop through days of the month
		for ( $i = 0; $i <= ( 24 - 1 ); $i++ ) {

			// Get timestamp & hour
			$timestamp = mktime( $i, 0, 0, $this->month, $this->day, $this->year );

			// New row
			echo $this->get_row_start( $timestamp );

			// Get this table cell
			echo $this->get_row_cell( $i, $start_day );

			// Close row
			echo $this->get_row_end();
		}
	}
396852
def displayable(inputstr, strip=True):
    """"""
    return clean(str(inputstr), strip, rem_indents=False, encoding_errors="backslashreplace")
641230
def render_text(text, language=None):
    
    # Get the filter
    text_filter = SUPPORTED_LANGUAGES.get(language, None)
    if not text_filter:
        raise ImproperlyConfigured("markup filter does not exist: {0}. Valid options are: {1}".format(
            language, ', '.join(list(SUPPORTED_LANGUAGES.keys()))
        ))

    # Convert.
    return text_filter(text)
565044
def complete_opt_display(self, text, *_):
        
        return [t + " " for t in DISPLAYS if t.startswith(text)]
88531
def _render(self, content, **settings):
        
        lines = self._render_content(content, **settings)

        result = []
        s = self._es_margin(settings)
        for l in lines:
            result.append(self.fmt_margin(l, **s))

        return result
853049
def highlight_block(self, text):
        """"""
        text = to_text_string(text)
        if text.startswith("+++"):
            self.setFormat(0, len(text), self.formats["keyword"])
        elif text.startswith("---"):
            self.setFormat(0, len(text), self.formats["keyword"])
        elif text.startswith("+"):
            self.setFormat(0, len(text), self.formats["string"])
        elif text.startswith("-"):
            self.setFormat(0, len(text), self.formats["number"])
        elif text.startswith("@"):
            self.setFormat(0, len(text), self.formats["builtin"])
        
        self.highlight_spaces(text)
649671
function showNote(region) {
    if (!showNote.el) {
        showNote.el = document.querySelector('#subtitle');
    }
    showNote.el.textContent = region.data.note || '–';
}
1042394
def fmt_content(text, width = 0, align = '<', padding = None, padding_left = None, padding_right = None, padding_char = ' '):
        
        if padding_left is None:
            padding_left = padding
        if padding_right is None:
            padding_right = padding
        if padding_left is not None:
            text = '{}{}'.format(str(padding_char)[0] * int(padding_left), text)
        if padding_right is not None:
            text = '{}{}'.format(text, str(padding_char)[0] * int(padding_right))
        if width:
            strptrn = '{:' + ('{}{}{}'.format(str(padding_char)[0], str(TEXT_ALIGNMENT[align]), str(width))) + 's}'
            text = strptrn.format(text)
        return text
795962
def render_text(text, preformatted=False):
    
    builder = HtmlBuilder()
    builder._render_text(text, preformatted=preformatted)
    return builder._to_html()
1142382
def bk_red(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes &= ~win32.BACKGROUND_MASK
        wAttributes |=  win32.BACKGROUND_RED
        cls._set_text_attributes(wAttributes)
1034729
def _render_content(self, content, **settings):
        
        ocontent = content

        s = self._es_data(settings)
        content = self.fmt_data(content, **s)

        s = self._es_content(settings)
        content = self.fmt_content(content, **s)

        if settings[self.SETTING_TEXT_HIGHLIGHT]:
            s = self._es_text(settings, settings[self.SETTING_TEXT_HIGHLIGHT](ocontent))
        else:
            s = self._es_text(settings, settings[self.SETTING_TEXT_FORMATING])
        content = self.fmt_text(content, **s)

        s = self._es_margin(settings)
        content = self.fmt_margin(content, **s)

        return content