Module:Glossary

--[[

This module provides helper functions for Template:Glossary_entry.

]]

local gloss = {}

-- (added by Pyrrhus Nov. 2019) This function simulates the parser function function gloss.explode( frame ) local new_args = str._getParameters( frame.args, {'text', 'delimiter', 'index'} ) local mytext = new_args['text'] or '' local mydelimiter = new_args['delimiter'] or '' local myindex = tonumber(new_args['index']) local stringParts = mw.text.split( mytext, mydelimiter, true ) return stringParts[0] .. myindex end

-- (added by Pyrrhus Nov. 2019) This function returns the hostname for a URL function gloss.hostname( frame ) local new_args = str._getParameters( frame.args, {'url'} ) local myUrl = new_args['url'] or '' local myUrlObject = mw.uri.new( myUrl ) return myUrlObject["host"] end

return gloss