Module:CTD: Difference between revisions

Add nospaces() helper, used to build compact short names for category names
(Created page with "local ctd = {} -- функции для Большого теософского словаря; copied from https://ru1.teopedia.org/lib/Module:CTD local function isempty(s)...")
 
(Add nospaces() helper, used to build compact short names for category names)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
local ctd = {} -- функции для Большого теософского словаря; copied from https://ru1.teopedia.org/lib/Module:CTD
local ctd = {} -- See main module at https://ru1.teopedia.org/lib/Module:CTD


local function isempty(s)
local function isempty(s)
Line 44: Line 44:
-------------------------------------------------
-------------------------------------------------
-- Create short description without hyper links
-- Create short description without hyper links
-- Used in : Шаблон:Понятие БТС
-- Used in : Template:CTD article
-- Call example:  
-- Call example:  
-- {{#invoke: CTD | shortly  
-- {{#invoke: CTD | shortly  
Line 75: Line 75:
return result
return result
end
end
-------------------------------------------------
-- Remove whitespace from a short piece of text (e.g. initials), to build
-- a compact variant of a person's short name for category names.
-- Used in : Template:CTD article
-- Call example:
-- {{#invoke: CTD | nospaces | {{{initials|}}} }}
function ctd.nospaces( frame )
local text = frame.args[1] or ''
return ( mw.ustring.gsub( text, '%s+', '' ) )
end
return ctd