Module:bho-headword

विक्षनरी से

This module powers all Bhojpuri headword-line templates. All of them support at least the following arguments:

|head=, |head2=, |head3=, ...
Explicitly specified headword(s), for introducing links in multiword expressions. Note that by default each word of a multiword lemma is linked, so you only need to use this when the default links don't suffice (e.g. the multiword expression consists of non-lemma forms, which need to be linked to their lemmas).
|tr=, |tr2=, |tr3=, ...
Manual transliteration(s), in case the automatic transliteration is incorrect.
|sort=
Sort key. Rarely needs to be given.

In addition, all but {{bho-adj}} and {{bho-num-ord}} support the following arguments:

|g=, |g2=, |g3=, ...
Gender(s). Possible values are m, f, m-p, f-p, mf (can be either masculine or feminine), mf-p (plural-only, can be either masculine or feminine), mfbysense (can be either masculine or feminine, depending on the natural gender of the person or animal being referred to), mfbysense-p (plural-only, can be either masculine or feminine, depending on the natural gender of the person or animal being referred to).

local export = {}
local pos_functions = {}
local links = require('Module:links')
local labels = require('Module:labels')

local lang = require('Module:languages').getByCode('bho')
local PAGENAME = mw.title.getCurrentTitle().text
local current_script = lang:findBestScript(PAGENAME)

function export.show(frame)
	local args = require('Module:parameters').process(frame:getParent().args,{
		['g'] = {default = '?'},
		['head'] = {},
	})
	local poscat = frame.args[1] or error('Part of speech has not been specified. Please pass parameter 1 to the module invocation.')
	
	local data = {lang = lang, sc = current_script, pos_category = poscat, sccat = true, categories = {}, heads = {args['head'] or PAGENAME}, genders = {}, inflections = {}}
	
	if poscat == 'संज्ञाएँ' or poscat == 'नामवाचक संज्ञाएँ' then
		if args['g'] == 'm' or args['g'] == 'f' then
			table.insert(data.genders, args['g'])
		else
			table.insert(data.genders, '?')
		end
	end
	
	return require('Module:headword').full_headword(data)
end

return export