示例#1
0
文件: show.py 项目: richsmith/fluidic
def execute(input, options, environment):

    def interpret(input):
        if isinstance(input, iotypes.File):
            return input
        else:
            return iotypes.File(input)
        
    if input:
        #assert len(options) == 0
        file = interpret(input)
    else:
        #assert len(options) == 1
        file = interpret(options[0])

    if isinstance(file, iotypes.Directory):
        return show_directory(file)
    elif icon.is_thumbnailable(file):
        _output = show_image(file)
    elif isinstance(file, iotypes.CodeFile):
        _output = html.div(get_highlight(file), clazz='text')
    else: # else assume text file for now
        _output = html.div(show_text(file), clazz='text')

    output.print_misc(_output, 'show')
示例#2
0
def execute(input, options, environment):

    file = input
    title_html = get_title(file)
    type_html = html.p(html.em(file.get_type_description()))
    details_html = details_table_to_html(file.get_details())

    html_str = title_html + type_html + details_html

    return html.div(html_str, clazz='properties')
示例#3
0
def add_output(text, elementName):
    element = '\n\n' + html.div(text, clazz=elementName)

    with open(output_file, "a") as file:
        file.write(element)