コード例 #1
0
ファイル: block.py プロジェクト: hirokiky/genaa
def run(opt):
    if opt.list:
        return generate_style_list()

    if getattr(opt, 'text'):
        text = opt.text
    else:
        text = sys.stdin.read()

    return render_block(u(text).split('\n'), style_mapping[opt.style])
コード例 #2
0
ファイル: block.py プロジェクト: hirokiky/genaa
def generate_style_list(styles=style_mapping):
    example_text = u"""\
 *
  *  * *    *  *    *
***   **  * *   **   *
      *    **  **  ***\
""".split('\n')
    examples = []
    for style in sorted(styles):
        example_block = render_block(example_text, style_mapping[style])
        examples.append(style + ':\n' + example_block)
    return '\n\n'.join(examples)