Skip to content

Commit

Permalink
Use parentheses for stylistic consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewvincent committed Apr 18, 2022
1 parent c5183ca commit 96424fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/mkdnflow/files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,20 @@ local has_url = function(string)
for pos_start, url, prot, subd, tld, colon, port, slash, path in
string:gmatch('()(([%w_.~!*:@&+$/?%%#-]-)(%w[-.%w]*%.)(%w+)(:?)(%d*)(/?)([%w_.~!*:@&+$/?%%#=-]*))')
do
if protocols[prot:lower()] == (1 - #slash) * #path and not subd:find'%W%W'
if protocols[prot:lower()] == (1 - #slash) * #path and not subd:find('%W%W')
and (colon == '' or port ~= '' and port + 0 < 65536)
and (tlds[tld:lower()] or tld:find'^%d+$' and subd:find'^%d+%.%d+%.%d+%.$'
and max_of_four(tld, subd:match'^(%d+)%.(%d+)%.(%d+)%.$') < 256)
and (tlds[tld:lower()] or tld:find('^%d+$') and subd:find('^%d+%.%d+%.%d+%.$')
and max_of_four(tld, subd:match('^(%d+)%.(%d+)%.(%d+)%.$')) < 256)
then
finished[pos_start] = true
found_url = true
end
end

for pos_start, url, prot, dom, colon, port, slash, path in
string:gmatch'()((%f[%w]%a+://)(%w[-.%w]*)(:?)(%d*)(/?)([%w_.~!*:@&+$/?%%#=-]*))'
string:gmatch('()((%f[%w]%a+://)(%w[-.%w]*)(:?)(%d*)(/?)([%w_.~!*:@&+$/?%%#=-]*))')
do
if not finished[pos_start] and not (dom..'.'):find'%W%W'
if not finished[pos_start] and not (dom..'.'):find('%W%W')
and protocols[prot:lower()] == (1 - #slash) * #path
and (colon == '' or port ~= '' and port + 0 < 65536)
then
Expand Down

0 comments on commit 96424fb

Please sign in to comment.