Module:reconstruction

Hello, you have come here looking for the meaning of the word Module:reconstruction. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:reconstruction, but we will also tell you about its etymology, its characteristics and you will know how to say Module:reconstruction in singular and plural. Everything you need to know about the word Module:reconstruction you have here. The definition of the word Module:reconstruction will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:reconstruction, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

-- from ]
local POS_headers = require "Module:table".listToSet {
	"Adjective", "Adverb", "Ambiposition", "Article", "Circumfix",
	"Circumposition", "Classifier", "Combining form", "Conjunction",
	"Contraction", "Counter", "Determiner", "Diacritical mark", "Han character",
	"Hanja", "Hanzi", "Ideophone", "Infix", "Interfix", "Interjection", "Kanji",
	"Letter", "Ligature", "Noun", "Number", "Numeral", "Participle", "Particle",
	"Phrase", "Postposition", "Prefix", "Preposition", "Prepositional phrase",
	"Pronoun", "Proper noun", "Proverb", "Punctuation mark", "Romanization",
	"Root", "Suffix", "Syllable", "Symbol", "Verb", 
}

-- This isn't a perfect pattern, but should work in entries that don't have
-- bad syntax.
local title_pattern = "%f==+%s*(.-)%s*==+"
local function count_POS_headers(title)
	local POS_count = 0
	local content = title:getContent()
	if content then
		for header in content:gmatch(title_pattern) do
			if POS_headers then
				POS_count = POS_count + 1
			end
		end
	end
	
	return POS_count
end

local function has_header(title, header_to_find)
	local content = title:getContent()
	if content then
		for header in content:gmatch(title_pattern) do
			if header == header_to_find then
				return true
			end
		end
	end
	
	return false
end

-- Track Proto-Indo-European entries with more than one part-of-speech header.
-- Invoked by {{reconstruction}}, requested by Victar.
function export.main(frame)
	local title = mw.title.getCurrentTitle()
	local cats = {}
	
	local language = title.text:match "^+"
	local langcode = require("Module:languages").getByCanonicalName(language)
	if not langcode then
		-- Can happen e.g. if used on a user page
		return
	end
	if language == "Proto-Indo-European" and count_POS_headers(title) > 1 then
		table.insert(cats, "Proto-Indo-European entries with more than one part of speech")
	end
	
	local has_references_header = has_header(title, "References")
	local has_further_reading_header = has_header(title, "Further reading")
	if not has_references_header then
		table.insert(cats, language .. " entries without References header")
	end
	
	local temp_rfref = ""
	if not (has_references_header or has_further_reading_header) then
		table.insert(cats, language .. " entries without References or Further reading header")
		if langcode and langcode._code=="sla-pro" then
			local book_search = ""
			temp_rfref = frame:expandTemplate{ title = "Template:rfref", args = { langcode._code, "Check ] or "..book_search } }
		end
	end
	
	return temp_rfref .. require("Module:utilities").format_categories(cats, langcode)
end

return export