Compare commits

...

2 Commits

Author SHA1 Message Date
Nguyễn Gia Phong 81f8a80774
Update docs details
GitHub disabled HTTPS push a while ago
and Sphinx theme needs force update, because RTD.
2022-05-03 12:42:26 +09:00
Constantin Piber 51707f3917 Escape % before using strings in gsub 2022-05-03 10:09:07 +09:00
3 changed files with 9 additions and 6 deletions

View File

@ -44,7 +44,7 @@ Requesting for Merging a Patch
#. `Fork this repository`_
#. Check out the source code with::
git clone https://github.com/YOUR_GITHUB_USERNAME/vicious.git
git clone git@github.com:YOUR_GITHUB_USERNAME/vicious
cd vicious
#. Start working on your patch. If you want to add a new widget type,

View File

@ -1,3 +1,3 @@
Sphinx >= 3
sphinx_rtd_theme
sphinx_rtd_theme >= 1
sphinxcontrib-luadomain

View File

@ -10,6 +10,7 @@
-- Copyright (C) 2018-2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
-- Copyright (C) 2019 Alexander Koch <lynix47@gmail.com>
-- Copyright (C) 2019 Enric Morales <me@enric.me>
-- Copyright (C) 2022 Constantin Piber <cp.piber@gmail.com>
--
-- This file is part of Vicious.
--
@ -33,6 +34,7 @@ local rawget = rawget
local require = require
local tonumber = tonumber
local tostring = tostring
local type = type
local io = { open = io.open, popen = io.popen }
local setmetatable = setmetatable
local getmetatable = getmetatable
@ -164,11 +166,12 @@ end
-- {{{ Format a string with args
function helpers.format(format, args)
for var, val in pairs(args) do
format = format:gsub("$" .. (tonumber(var) and var or
var:gsub("[-+?*]", function(i) return "%"..i end)),
val)
if tonumber(var) == nil then
var = var:gsub("[-+?*]", function(i) return "%"..i end)
end
if type(val) == "string" then val = val:gsub("%%", "%%%%") end
format = format:gsub("$" .. var, val)
end
return format
end
-- }}}