Skip to content

Commit

Permalink
Change is_url to has_url (for accuracy)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewvincent committed Apr 18, 2022
1 parent 3b9a2a0 commit c5183ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/mkdnflow/files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ end

--[[
is_url() determines whether a string is a URL
has_url() determines whether a string is a URL
Returns a boolean or nil
Private function
--]]
local is_url = function(string)
local has_url = function(string)
-- This function based largely on the solution in https://stackoverflow.com/
-- questions/23590304/finding-a-url-in-a-string-lua-pattern
-- Table of top-level domains
Expand Down Expand Up @@ -262,15 +262,15 @@ end
path_type() determines what kind of path is in a url
Returns a string:
1. 'file' if the path has the 'file:' prefix,
2. 'url' is the result of is_url(path) is true
2. 'url' is the result of has_url(path) is true
3. 'filename' if (1) and (2) aren't true
Private function
--]]
local path_type = function(path)
if string.find(path, '^file:') then
return('file')
elseif is_url(path) then
elseif has_url(path) then
return('url')
elseif string.find(path, '^@') then
return('citation')
Expand Down

0 comments on commit c5183ca

Please sign in to comment.