Skip to content

Commit

Permalink
Merge pull request #16 from MohammadrezaAmani/inui-0.9.3-css
Browse files Browse the repository at this point in the history
feat(css): add css support to project.
  • Loading branch information
MohammadrezaAmani authored Oct 28, 2024
2 parents e473a94 + aa8ccd9 commit e930724
Show file tree
Hide file tree
Showing 8 changed files with 2,618 additions and 12 deletions.
23 changes: 19 additions & 4 deletions inui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ def __repr__(self) -> str:
return self.render()

def __add__(self, other) -> str:
return self.render() + str(other)
return self.__str__() + " " + self._str(other)

def __radd__(self, other) -> str:
return str(other) + self.render()
return self._str(other) + " " + self.__str__()

def __len__(self):
return len(self.render())
return len(self.__str__())

def __getitem__(self, item):
return self.render()[item]
return self.__str__()[item]

def _str(self, data):
try:
Expand All @@ -165,6 +165,21 @@ def _str(self, data):
pass
return str(data)

def __lt__(self, other):
return f"{self._str(other)} > {self.__str__()}"

def __gt__(self, other):
return f"{self.__str__()} > {self._str(other)}"

def __le__(self, other):
return f"{self.__str__()} <= {self._str(other)}"

def __ge__(self, other):
return f"{self.__str__()} >= {self._str(other)}"

def css(self, tag: str = ""):
return tag + self.start_tag


class BaseElement(Base): ...

Expand Down
Loading

0 comments on commit e930724

Please sign in to comment.