Skip to content

Commit

Permalink
feat: Add support for %s in URL path
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugyi200 committed Aug 29, 2024
1 parent 3fd8fd6 commit 154ba2a
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 175 deletions.
2 changes: 1 addition & 1 deletion src/zorg/grammar/ZorgFile.g4
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ h4_header : H4_HEADER space_atoms eol ;
eol : NL | EOF ;

// URL
url : ('https://' | 'http://') ID ('.' ID)* (':' NUM_ID)? ('/' ID ((AMP | COLON | DASH | EQUAL | QMARK) PERCENT? (ID | FSLASH))*)* ;
url : ('https://' | 'http://') ID ('.' ID)* (':' NUM_ID)? ('/' PERCENT? ID ((AMP | COLON | DASH | EQUAL | QMARK) PERCENT? (ID | FSLASH))*)* ;
2 changes: 1 addition & 1 deletion src/zorg/grammar/zorg_file/ZorgFile.interp

Large diffs are not rendered by default.

351 changes: 180 additions & 171 deletions src/zorg/grammar/zorg_file/ZorgFileParser.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/__snapshots__/test_run_action_open.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

################################ [[multiblocks]]
- 240510#0E Note A2
Expand Down
15 changes: 14 additions & 1 deletion tests/__snapshots__/test_run_compile.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,20 @@
'projects': [],
'properties': {'ID': 'foo_with_url_arg'},
'todo_payload': None,
'zid': '240828#03'}],
'zid': '240828#03'},
{'areas': [],
'block': None,
'body': '240828#04 ID::foo_slash_arg '
'https://go/foo/bar/%s',
'contexts': ['footnote'],
'create_date': FakeDate(2024, 8, 28),
'links': ['x:https://go/foo/bar/%s'],
'modify_date': FakeDate(2024, 8, 28),
'people': [],
'projects': [],
'properties': {'ID': 'foo_slash_arg'},
'todo_payload': None,
'zid': '240828#04'}],
'section': None}],
'h2s': [],
'page': None,
Expand Down
4 changes: 3 additions & 1 deletion tests/__snapshots__/test_run_db.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'ref:some_article',
'x:http://www.example.com',
'x:https://go/foo-bar-baz',
'x:https://go/foo/bar/%s',
'x:https://go/foo:bar:baz',
'x:https://go/foo?a=/&b=2&c=/',
'x:https://go/foo?bar=%s',
Expand All @@ -65,7 +66,7 @@
])
# ---
# name: test_run_db_create__note_count[YAMLConfigFile]
122
123
# ---
# name: test_run_db_create__people[YAMLConfigFile]
list([
Expand Down Expand Up @@ -289,6 +290,7 @@
'240828#01',
'240828#02',
'240828#03',
'240828#04',
'301231#X0',
'301231#X1',
])
Expand Down
12 changes: 12 additions & 0 deletions tests/__snapshots__/test_run_query.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

'''
# ---
Expand Down Expand Up @@ -52,6 +53,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s
o P3 240510#21 Some foobar todo.
o P3 240510#26 Some foobar todo.

Expand Down Expand Up @@ -83,6 +85,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

'''
# ---
Expand All @@ -94,6 +97,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s
- 240629#00 A note with a bullet property that contains a sublist
* url::
- https://www.foobar.com
Expand Down Expand Up @@ -266,6 +270,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

################################ [[multiblocks]]
o P3 240510#07 Some todo
Expand Down Expand Up @@ -782,6 +787,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

################################ @pomodoro
- 240323#0J #gtd pomodoro
Expand Down Expand Up @@ -1006,6 +1012,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s
- 301231#X1 @READ Some article
* RID::some_article
* url::http://www.example.com
Expand Down Expand Up @@ -1181,6 +1188,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

++++++++++++++++ +arms
- 240510#0L Sqtdicu Gfwebkj: fdxd://rd/czge-nxgz-vmuncaf
Expand Down Expand Up @@ -1393,6 +1401,7 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

################################ [[multiblocks]]
- 240510#0E Note A2
Expand Down Expand Up @@ -1602,6 +1611,7 @@
- 240704#00 LID::2 https://go/foo-bar-baz
- 240828#00 ID::foo_bar_baz https://go/foo:bar:baz
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

################################ [[priority]]
o P0 240313#03 High Priority TODO
Expand Down Expand Up @@ -1735,6 +1745,7 @@
tick_03
x:http://www.example.com
x:https://go/foo-bar-baz
x:https://go/foo/bar/%s
x:https://go/foo:bar:baz
x:https://go/foo?a=/&b=2&c=/
x:https://go/foo?bar=%s
Expand Down Expand Up @@ -1767,6 +1778,7 @@
x:https://go/foo?env=dev&bar=2&baz=3
x:https://go/foo?a=/&b=2&c=/
x:https://go/foo?bar=%s
x:https://go/foo/bar/%s
bar.sh
baz
buz#fuzz
Expand Down
1 change: 1 addition & 0 deletions tests/data/links.zo
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
- 240828#01 ID::foo_with_url_query https://go/foo?env=dev&bar=2&baz=3
- 240828#02 ID::foo_with_slashes_query https://go/foo?a=/&b=2&c=/
- 240828#03 ID::foo_with_url_arg https://go/foo?bar=%s
- 240828#04 ID::foo_slash_arg https://go/foo/bar/%s

0 comments on commit 154ba2a

Please sign in to comment.