From: Jo-Philipp Wich Date: Wed, 20 Aug 2008 16:40:25 +0000 (+0000) Subject: * luci/libs: add striptags() to luci.util X-Git-Tag: 0.8.0~336 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b718fe88d64c8b33ab0ef2c3d5d2ac26d8c154d;p=oweals%2Fluci.git * luci/libs: add striptags() to luci.util --- diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index c6d9ec6ce..66e368299 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -208,6 +208,13 @@ function pcdata(value) return value:gsub(">", ">") end +--- Strip HTML tags from given string. +-- @param value String containing the HTML text +-- @return String with HTML tags stripped of +function striptags(s) + return (s:gsub("]*>", " "):gsub("%s+", " ")) +end + --- Splits given string on a defined separator sequence and return a table -- containing the resulting substrings. The optional max parameter specifies -- the number of bytes to process, regardless of the actual length of the given