Files
klammertext/sks/table/border.py
Andy Kopra 2ba7ceee7a Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:32:38 +02:00

24 lines
781 B
Python

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]