Borrow some code from fonts-rpm-macros, to drop a dependant code to generate srpm

This commit is contained in:
Akira TAGOH 2021-04-19 14:27:45 +09:00
parent 7aea53ad43
commit 36159fcb37

View File

@ -573,6 +573,37 @@ local function wordwrap(text)
return output
end
-- A helper to close AppStream XML runs
local function closetag(oldtag, newtag)
if (oldtag == nil) then
return ""
else
local output = "]]></" .. oldtag .. ">"
if (oldtag == "li") and (newtag ~= oldtag) then
output = output .. "</ul>"
end
return output
end
end
-- A helper to open AppStream XML runs
local function opentag(oldtag, newtag)
if (newtag == nil) then
return ""
else
local output = "<" .. newtag .. "><![CDATA["
if (newtag == "li") and (newtag ~= oldtag) then
output = "<ul>" .. output
end
return output
end
end
-- A helper to switch AppStream XML runs
local function switchtag(oldtag, newtag)
return closetag(oldtag, newtag) .. opentag(oldtag, newtag)
end
-- Reformat some text into something that can be included in an AppStream
-- XML description
local function txt2xml(text)