יחידה:תגים

מתוך ויקיפדיה, האנציקלופדיה החופשית

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:תגים/תיעוד

local p = {}

function p.removeSpanTagsAndKeepText(html)
    local pattern = '<span[^>]*>(.-)</span>'
    local cleanedHtml = html
    
    repeat
        local newHtml, count = string.gsub(cleanedHtml, pattern, "%1")
        if count > 0 then
            cleanedHtml = newHtml
        else
            break  -- Exit the loop when no more span tags are found
        end
    until false
    
    return cleanedHtml
end

function p.removeSpanTagsAndKeepTextByFrame(frame)
	str = frame.args.string
	return p.removeSpanTagsAndKeepText(str)
end
	
return p