Files
klammertext/sks/table/border.py

24 lines
781 B
Python
Raw Normal View History

import re
class Border:
def __init__(self, top, right, bottom, left, left_all, right_all):
self.top = top
self.right = right
self.bottom = bottom
self.left = left
self.left_all = left_all
self.right_all = right_all
def __str__(self):
def sym(value, letter):
return letter if value else ""
T, R, B, L, l, r = self.top, self.right, self.bottom, self.left, self.left_all, self.right_all
abbrev = f'{sym(T, "t")}{sym(R, "r")}{sym(B, "b")}{sym(L, "l")}{sym(l, "L")}{sym(R, "R")}'
abbrev = re.sub(" ", "", abbrev)
if abbrev:
abbrev = f"|{abbrev}|"
return f'<border{abbrev}>'
def has(self):
return [self.top, self.right, self.bottom, self.left]