Improve arrow regex
This commit is contained in:
parent
19d44c32f9
commit
b589b68b8a
@ -108,14 +108,16 @@ def open_file_append(filename):
|
|||||||
|
|
||||||
def isarrow(inp):
|
def isarrow(inp):
|
||||||
"""
|
"""
|
||||||
Matches strings of one or multiple `-` or `=` (TODO: but not mixed)
|
Matches strings of one or multiple `-` or `=` (but not mixed)
|
||||||
optionally starting with `<` and/or ending with `>`.
|
optionally starting with `<` and/or ending with `>`.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
<-, --, ->, <->
|
<-, --, ->, <->
|
||||||
<==, ==, ==>, <=>
|
<==, ==, ==>, <=>
|
||||||
|
|
||||||
|
regex by @shiraneyo
|
||||||
"""
|
"""
|
||||||
return bool(re.match(r"^<?[=-]+>?$", inp))
|
return bool(re.match(r"^\s*(?P<leftHead><?)(?P<body>-+|=+)(?P<rightHead>>?)\s*$", inp))
|
||||||
|
|
||||||
def aspect_ratio(image_src):
|
def aspect_ratio(image_src):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user