Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
    A word-wrap function that preserves existing line breaks
    and most spaces in the text. Expects that existing line
    breaks are posix newlines (
).

    Loop through iterable created by splitting the text by a space.
    Construct lines with words and spaces until $width is reached.
    Start a new line with a newline when $width is reached.

    

        def wrap_line(text, width, indent_marker, indent_offset=0, indent_char=' ',
              indent_suffix=''):
    """
    A word-wrap function that preserves existing line breaks
    and most spaces in the text. Expects that existing line
    breaks are posix newlines (\n).

    Loop through iterable created by splitting the text by a space.
    Construct lines with words and spaces until $width is reached.
    Start a new line with a newline when $width is reached.

    """
    paren_index = text.find(indent_marker)
    if paren_index == 0:
        paren_index = 1
    indent = indent_char * (paren_index + indent_offset)

    def make_delimiter(line, word, width):
        """Determine whether we will add this word to the current line
        or begin a new line.

        """
        isbreak = len(line)-line.rfind('\n')-1 + \
            len(word.split('\n', 1)[0]) >= width
        if isbreak:
            return '\n%s%s' % (indent, indent_suffix)
        else:
            return ' '

    return reduce(lambda line, word, width=width: '%s%s%s' %
                  (line, make_delimiter(line, word, width),
                  word), text.split(' '))
        


src/a/s/asterisk_rest_libraries-HEAD/lib/javascript.py   asterisk_rest_libraries(Download)
"""
import re
from utils import get_file_content, wrap_line
 
 
            if match is not None:
                matched = True
                new_line = wrap_line(line, width, each[1], indent_char='\t',
                                     indent_suffix=each[2],
                                     indent_offset=each[3])

src/a/s/asterisk_rest_libraries-HEAD/lib/perl.py   asterisk_rest_libraries(Download)
"""
import re
from utils import get_file_content, wrap_line
 
 
            if match is not None:
                matched = True
                new_line = wrap_line(line, width, each[1], indent_char='\t',
                                     indent_suffix=each[2],
                                     indent_offset=each[3])