示例#1
0
def generate_preview(document, size):
    content_length = 0
    result = []
    for para in split_document(trim_right(document)):
        content_length += para.length()
        if size < content_length:
            break
        result.append(para)
    return reduce(lambda r, para: r + para.build(), result, [])
示例#2
0
def generate_preview(document, size):
    content_length = 0
    result = []
    for para in split_document(trim_right(document.split('\n'))):
        content_length += para.length()
        if size < content_length:
            break
        result.append(para)
    return reduce(lambda r, para: r + para.build(), result, [])
示例#3
0
def forge(document):
    return reduce(lambda r, para: r + para.build(),
                  split_document(trim_right(document)), [])
示例#4
0
def forge(document):
    from paragraph import split_document
    return reduce(lambda r, para: r + para.build(),
                  split_document(trim_right(document)), [])
示例#5
0
def forge(document):
    return reduce(lambda r, para: r + para.build(),
                  split_document(trim_right(document.split('\n'))), [])
示例#6
0
def forge(document):
    from paragraph import split_document
    return reduce(lambda r, para: r + para.build(),
                  split_document(trim_right(document)), [])