Skip to content

Commit

Permalink
Merge pull request #20 from bralbral/develop
Browse files Browse the repository at this point in the history
wrapper.py -> Skip processing empty string in transform_html
  • Loading branch information
Tishka17 authored Sep 29, 2023
2 parents e66af59 + a2dfdd2 commit 89afd19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sulguk/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import List
from typing import List, Optional

from sulguk.render.state import MessageEntity, State
from .transformer import Transformer
Expand All @@ -11,7 +11,11 @@ class RenderResult:
entities: List[MessageEntity]


def transform_html(raw_html: str) -> RenderResult:
def transform_html(raw_html: Optional[str]) -> RenderResult:

if raw_html is None or raw_html.strip() == "":
return RenderResult(text="", entities=[])

transformer = Transformer()
transformer.feed(raw_html)
state = State()
Expand Down

0 comments on commit 89afd19

Please sign in to comment.