mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-18 21:33:07 +02:00
regexp: Fix empty viewport filters in markdown
In markdown, there's no ' =' after '|', so the '+' in the filter regex doesn't match. Let's allow filter to be empty and distinguish between viewports and presets using negative look-ahead. This fixes the failing TestViewportsTaskGenerationEmptyFilter test.
This commit is contained in:
parent
7663a58793
commit
625c26d59f
1 changed files with 10 additions and 8 deletions
|
@ -47,11 +47,12 @@ VIEWPORT = {
|
|||
r'^' # Starts at the begging of the line
|
||||
r'[=]+' # Heading begging
|
||||
r'(?P<name>[^=\|\[\{]*)' # Name of the viewport, all before the | sign
|
||||
# Cannot include '[', '=', '|, and '{'
|
||||
r'\|' # Colon
|
||||
r'(?P<filter>[^=\|]+?)' # Filter
|
||||
# Cannot include '[', '=', '|', and '{'
|
||||
r'\|' # Bar
|
||||
r'(?!\|)' # (But not two, that would be a preset)
|
||||
r'(?P<filter>[^=\|]*?)' # Filter
|
||||
r'(' # Optional defaults
|
||||
r'\|' # Colon
|
||||
r'\|' # Bar
|
||||
r'(?P<defaults>[^=\|]+?)' # Default attrs
|
||||
r')?'
|
||||
r'\s*' # Any whitespace
|
||||
|
@ -66,11 +67,12 @@ VIEWPORT = {
|
|||
r'^' # Starts at the begging of the line
|
||||
r'[#]+' # Heading begging
|
||||
r'(?P<name>[^#\|\[\{]*)' # Name of the viewport, all before the | sign
|
||||
# Cannot include '[', '=', '|, and '{'
|
||||
r'\|' # Colon
|
||||
r'(?P<filter>[^#\|]+?)' # Filter
|
||||
# Cannot include '[', '#', '|', and '{'
|
||||
r'\|' # Bar
|
||||
r'(?!\|)' # (But not two, that would be a preset)
|
||||
r'(?P<filter>[^#\|]*?)' # Filter
|
||||
r'(' # Optional defaults
|
||||
r'\|' # Colon
|
||||
r'\|' # Bar
|
||||
r'(?P<defaults>[^#\|]+?)' # Default attrs
|
||||
r')?'
|
||||
r'\s*' # Any whitespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue