Browse Source
Also includes an hour and a half of debugging this issue: https://github.com/sergiocorreia/panflute/pull/224 just to find out it was already fixed in the version that I looked at the source code of but not in the version installed on my system.pull/28/head
Jan Černohorský
2 years ago
6 changed files with 52 additions and 5 deletions
@ -1,12 +1,24 @@ |
|||||
from panflute import Space,SoftBreak |
from panflute import Space,SoftBreak,Str |
||||
from typing import Union |
from typing import Union |
||||
|
|
||||
|
# Import local files |
||||
|
from context import Context |
||||
|
|
||||
Whitespace = Union[Space,SoftBreak] |
Whitespace = Union[Space,SoftBreak] |
||||
|
|
||||
class NBSP(Space): |
class NBSP(Space): |
||||
pass |
pass |
||||
|
|
||||
def bavlna(e: Whitespace): |
def bavlna(e: Whitespace, c: Context) -> bool: |
||||
"""Determine if given piece of whitespace should be non-breakable.""" |
"""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 |
return False |
||||
|
|
||||
|
Loading…
Reference in new issue