You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
532 B
24 lines
532 B
from panflute import Space,SoftBreak,Str
|
|
from typing import Union
|
|
|
|
# Import local files
|
|
from context import Context
|
|
|
|
Whitespace = Union[Space,SoftBreak]
|
|
|
|
class NBSP(Space):
|
|
pass
|
|
|
|
def bavlna(e: Whitespace, c: Context) -> bool:
|
|
"""Determine if given piece of whitespace should be non-breakable."""
|
|
|
|
if c.get_metadata("language") == "cs":
|
|
|
|
# TODO: Add more clever stuff
|
|
if isinstance(e.prev, Str) and isinstance(e.next, Str) and e.prev.text.lower() in ['k', 's', 'v', 'z', 'o', 'u', 'a', 'i']:
|
|
return True
|
|
|
|
|
|
|
|
return False
|
|
|
|
|