Outputs the result of highlighting a text.
163582
def highlight_text(args, parser):
    """"""
    tokenizer = utils.get_tokenizer(args)
    corpus = utils.get_corpus(args)
    output_dir = os.path.abspath(args.output)
    if os.path.exists(output_dir):
        parser.exit(status=3, message='Output directory already exists, '
                    'aborting.\n')
    os.makedirs(output_dir, exist_ok=True)
    if args.ngrams:
        if args.label is None or len(args.label) != len(args.ngrams):
            parser.error('There must be as many labels as there are files '
                         'of n-grams')
        report = tacl.NgramHighlightReport(corpus, tokenizer)
        ngrams = []
        for ngram_file in args.ngrams:
            ngrams.append(utils.get_ngrams(ngram_file))
        minus_ngrams = []
        if args.minus_ngrams:
            minus_ngrams = utils.get_ngrams(args.minus_ngrams)
        report.generate(args.output, args.base_name, ngrams, args.label,
                        minus_ngrams)
    else:
        report = tacl.ResultsHighlightReport(corpus, tokenizer)
        report.generate(args.output, args.base_name, args.results)
954677
function drawText(helper, item)
{
    if (item instanceof Text)
    {
        // updating text will return early if it is not dirty
        item.updateText(true);

        return true;
    }

    return false;
}
1127327
def cprint(text, fg=grey, bg=blackbg, w=norm, cr=False, encoding='utf8'):
    ''' 
    '''
    colorstart(fg, bg, w)
    out(text)
    colorend(cr)
398679
def text(self):
        """"""
        # ---note this shadows lxml _Element.text---
        txBody = self.txBody
        if txBody is None:
            return ''
        return '\n'.join([p.text for p in txBody.p_lst])
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)
1026361
def highlight_current_line(self):
        """"""
        selection = TextDecoration(self.textCursor())
        selection.format.setProperty(QTextFormat.FullWidthSelection,
                                     to_qvariant(True))
        selection.format.setBackground(self.currentline_color)
        selection.cursor.clearSelection()
        self.set_extra_selections('current_line', [selection])
        self.update_extra_selections()
1327080
def highlightByAlternate(self):
        
        palette = QtGui.QApplication.palette()
        palette.setColor(palette.HighlightedText, palette.color(palette.Text))
        
        clr = palette.color(palette.AlternateBase)
        palette.setColor(palette.Highlight, clr.darker(110))
        self.setPalette(palette)
127782
def write_color(self,text, attr=None):
        
        '''
        if isinstance(attr,AnsiState):
            defaultstate = attr
        elif attr is None:  #use attribute form initial console
            attr = self.defaultstate.copy()
        else:
            defaultstate = AnsiState()
            defaultstate.winattr = attr
            attr = defaultstate
        chunks = terminal_escape.split(text)
        n = 0 # count the characters we actually write, omitting the escapes
        res=[]
        for chunk in chunks:
            m = escape_parts.match(chunk)
            if m:
                parts = m.group(1).split(u";")
                if len(parts) == 1 and parts[0] == u"0":
                    attr = self.defaultstate.copy()
                    continue
                for part in parts:
                    if part == u"0": # No text attribute
                        attr = self.defaultstate.copy()
                        attr.bold=False
                    elif part == u"7": # switch on reverse
                        attr.inverse=True
                    elif part == u"1": # switch on bold (i.e. intensify foreground color)
                        attr.bold=True 
                    elif len(part) == 2 and u"30" <= part <= u"37": # set foreground color
                        attr.color = trtable[int(part) - 30]
                    elif len(part) == 2 and u"40" <= part <= u"47": # set background color
                        attr.backgroundcolor = trtable[int(part) - 40]
                continue
            n += len(chunk)
            if True:
                res.append((attr.copy(), chunk))
        return n,res
527999
def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
        '''
        
        '''
        if title and not title_color:
            title_color = color
        if title_color and not title:
            title_color = None

        self.__colored_output(title, message, title_color, color, ident=ident)
1328187
def cprint(
    text,
    fg=Color.normal,
    bg=Color.normal,
    fg_dark=False,
    bg_dark=False,
    underlined=False,
    parse=False,
):
    
    if parse:
        color_re = Color.color_re()
        lines = text.splitlines()
        count = len(lines)
        for i, line in enumerate(lines):
            previous = 0
            end = len(line)
            for match in color_re.finditer(line):
                sys.stdout.write(line[previous : match.start()])
                d = match.groupdict()
                set_color(
                    d["color"], fg_dark=False if d["dark"] is None else True
                )
                previous = match.end()
            sys.stdout.write(
                line[previous:end]
                + ("\n" if (i < (count - 1) or text[-1] == "\n") else "")
            )
    else:
        set_color(fg, bg, fg_dark, bg_dark, underlined)
        sys.stdout.write(text)
        set_color()
1130665
def output_colored(code, text, is_bold=False):
    
    if is_bold:
        code = '1;%s' % code

    return '\033[%sm%s\033[0m' % (code, text)
675607
def toggle_highlighting(self, state):
        """"""
        if self.editor is not None:
            if state:
                self.highlight_matches()
            else:
                self.clear_matches()
1371799
function highlightText(unhighlightedCode, languageId, partialContext) {
			var language = languages[languageId],
				analyzerContext;
			
			partialContext = partialContext || { };
			if (language === undefined) {
				//use default language if one wasn't specified or hasn't been registered
				language = languages[DEFAULT_LANGUAGE];
			}

			fireEvent("beforeHighlight", this, { code: unhighlightedCode, language: language, previousContext: partialContext });
			
			analyzerContext = createAnalyzerContext(
				tokenize.call(this, unhighlightedCode, language, partialContext, this.options),
				partialContext,
				this.options
			);
			
			analyze.call(this, analyzerContext, partialContext.index ? partialContext.index + 1 : 0);
			
			fireEvent("afterHighlight", this, { analyzerContext: analyzerContext });

			return analyzerContext;
		}
843607
function highlightRows(highlighter) {
  $('.data > tbody > tr').each(function(i, rowEl) {
    var row = $(rowEl);
    var item = row.data('item');
    var shouldHighlight = highlighter(item); // <-- Compiled function from Filtrex!
    row.css('background-color', shouldHighlight ? '#ff5' : '#fff');
  });
}
228592
function( text ) {
			if ( this._.indent ) {
				this.indentation();
				!this._.inPre && ( text = CKEDITOR.tools.ltrim( text ) );
			}

			this._.output.push( text );
		}
248696
def py_syntax_highlight(self, s):
        
        if not self.enable:
            return s
        state = 0
        spaces = " \t\n"
        ops = ".,;:+-*/%&!=|(){}[]^<>"
        i = 0
        cur_token = ""
        color_args = {0: {}, len(s): {}}  # type: typing.Dict[int,typing.Dict[str]]  # pos in s -> color kwargs

        def finish_identifier():
            """
            Reset color to standard for current identifier.
            """
            if cur_token in py_keywords:
                color_args[max([k for k in color_args.keys() if k < i])] = {"color": self.fg_colors[0]}

        while i < len(s):
            c = s[i]
            i += 1
            if c == "\n":
                if state == 3:
                    finish_identifier()
                color_args[i] = {}
                state = 0
            elif state == 0:
                if c in spaces:
                    pass
                elif c in ops:
                    color_args[i - 1] = {"color": self.fg_colors[0]}
                    color_args[i] = {}
                elif c == "#":
                    color_args[i - 1] = {"color": self.fg_colors[3]}
                    state = 6
                elif c == '"':
                    color_args[i - 1] = {"color": self.fg_colors[2]}
                    state = 1
                elif c == "'":
                    color_args[i - 1] = {"color": self.fg_colors[2]}
                    state = 2
                else:
                    cur_token = c
                    color_args[i - 1] = {}
                    state = 3
            elif state == 1:  # string via "
                if c == "\\":
                    state = 4
                elif c == "\"":
                    color_args[i] = {}
                    state = 0
            elif state == 2:  # string via '
                if c == "\\":
                    state = 5
                elif c == "'":
                    color_args[i] = {}
                    state = 0
            elif state == 3:  # identifier
                if c in spaces + ops + "#\"'":
                    finish_identifier()
                    color_args[i] = {}
                    state = 0
                    i -= 1
                else:
                    cur_token += c
            elif state == 4:  # escape in "
                state = 1
            elif state == 5:  # escape in '
                state = 2
            elif state == 6:  # comment
                pass
        if state == 3:
            finish_identifier()
        out = ""
        i = 0
        while i < len(s):
            j = min([k for k in color_args.keys() if k > i])
            out += self.color(s[i:j], **color_args[i])
            i = j
        return out
147875
def success(message)
      puts message.prepend('➜ ').colorize(:light_green)
    end