|
|
|
@ -121,13 +121,23 @@ function DocumentRegistry:getProviders(file)
|
|
|
|
|
|
|
|
|
|
--- @todo some implementation based on mime types?
|
|
|
|
|
for _, provider in ipairs(self.providers) do
|
|
|
|
|
local added = false
|
|
|
|
|
local suffix = string.sub(file, -string.len(provider.extension) - 1)
|
|
|
|
|
if string.lower(suffix) == "."..provider.extension then
|
|
|
|
|
for i, prov_prev in ipairs(providers) do
|
|
|
|
|
if prov_prev.provider == provider.provider then
|
|
|
|
|
if prov_prev.weight >= provider.weight then
|
|
|
|
|
added = true
|
|
|
|
|
else
|
|
|
|
|
table.remove(providers, i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- if extension == provider.extension then
|
|
|
|
|
-- stick highest weighted provider at the front
|
|
|
|
|
if #providers >= 1 and provider.weight > providers[1].weight then
|
|
|
|
|
if not added and #providers >= 1 and provider.weight > providers[1].weight then
|
|
|
|
|
table.insert(providers, 1, provider)
|
|
|
|
|
else
|
|
|
|
|
elseif not added then
|
|
|
|
|
table.insert(providers, provider)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|