for match in line_re.finditer(text):
line = match.group() if line.startswith('>') or line.startswith('+'): # Colorize the prompt as such, # then put rest of line into current_code_block
insertions.append((len(current_code_block),
[(0, Generic.Prompt, line[:2])]))
current_code_block += line[2:] else: # We have reached a non-prompt line! # If we have stored prompt lines, need to process them first. if current_code_block: # Weave together the prompts and highlight code. yieldfrom do_insertions(
insertions, slexer.get_tokens_unprocessed(current_code_block)) # Reset vars for next code block.
current_code_block = ''
insertions = [] # Now process the actual line itself, this is output from R. yield match.start(), Generic.Output, line
# If we happen to end on a code block with nothing after it, need to # process the last code block. This is neither elegant nor DRY so # should be changed. if current_code_block: yieldfrom do_insertions(
insertions, slexer.get_tokens_unprocessed(current_code_block))
class SLexer(RegexLexer): """ For S, S-plus, and R source code. """
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.