Commit 1759ed11 authored by Henke's avatar Henke
Browse files

Update

parent 100d830b
from __future__ import print_function
import argparse
import sys
from collections import namedtuple
TextPointer = namedtuple('TextPointer', 'index')
......@@ -39,7 +39,7 @@ def beeify(line, text_ptr, max_len, comment, inline_l, inline_r):
current += ' {}'.format(text[text_ptr.index])
text_ptr = TextPointer(text_ptr.index + 1)
if text_ptr.index >= len(text):
break
text_ptr = TextPointer(0)
if current != inline_l:
while len(current) + 1 + len(inline_r) < space_len:
......@@ -53,8 +53,8 @@ def beeify(line, text_ptr, max_len, comment, inline_l, inline_r):
while len(line) + len(current) + 1 + len(inline_r) + len(text[text_ptr.index]) <= max_len:
current += ' {}'.format(text[text_ptr.index])
text_ptr = TextPointer(text_ptr.index + 1)
if text_ptr.index >= len(text):
break
if text_ptr.index >= len(beetext()):
text_ptr = TextPointer(0)
if current != inline_l:
while len(line) + len(current) + 1 + len(inline_r) < max_len:
current += ' '
......@@ -69,7 +69,7 @@ def beeify(line, text_ptr, max_len, comment, inline_l, inline_r):
current += ' {}'.format(beetext()[text_ptr.index])
text_ptr = TextPointer(text_ptr.index + 1)
if text_ptr.index >= len(beetext()):
break
text_ptr = TextPointer(0)
if not current:
return line, text_ptr
......@@ -89,7 +89,9 @@ def beeify_file(fname, max_len, comment, text_ptr, L, R):
return bee_lines, text_ptr
def beeify_filename(fname):
return '{}.bee'.format(fname)
unbeed = fname.split('.')
unbeed = unbeed[:-1] + ['bee'] + [unbeed[-1]]
return '.'.join(unbeed)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create bee-ified source code')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment