Compare commits
2 Commits
b20f68bdb7
...
81f8a80774
Author | SHA1 | Date |
---|---|---|
Nguyễn Gia Phong | 81f8a80774 | |
Constantin Piber | 51707f3917 |
|
@ -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,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Sphinx >= 3
|
||||
sphinx_rtd_theme
|
||||
sphinx_rtd_theme >= 1
|
||||
sphinxcontrib-luadomain
|
||||
|
|
11
helpers.lua
11
helpers.lua
|
@ -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
|
||||
-- }}}
|
||||
|
|
Loading…
Reference in New Issue