Module:Ricepeure — Wiccionaire
Èn årtike di Wiccionaire.
I gn a nén co di dzo-pådje /doc pol notule d’ esplikêyes. Clitchîz cial po l’ ahiver.
-- This module is used for caesuras of a word for printers -- Only use with Modele:Ric as : -- {{ric|word}} local p = {} local builder = require("Module:Builder"); local language = require("Module:Lingaedje"); -- don't use dot (.) as separator but MIDDLE DOT (U+00B7) local _ricChar = "·" local _litNum = {"deus", "troes", "cwate", "cénk", "shijh", "set", "ût", "nouv", "dijh"} -- number of first caesura in string function countRic(s) return select(2, s:gsub(_ricChar, "")) end function render(text, lang) -- escaped dot as in [[bran.mint]],… local text = string.gsub(text, '\\%.', '__DOT__') -- use _ricChar as separator, not dot local text = string.gsub(text, '%.', _ricChar) -- replace escaped dot local text = string.gsub(text, '__DOT__', '.') -- number or separators in text local c = countRic(text) -- number of syllables local p = c+1 -- namespace number local ns = mw.title.getCurrentTitle().namespace -- remove not real separators as in a(.)wè text = string.gsub(text, '%('.._ricChar..'%)', '') -- first part of return content -- TODO make link for each language if page exists if lang == 'wa' then builder.add_content("[[Rawete:Ricepeure e walon|Ricepeures]] : ") else builder.add_content("Ricepeures : ") end -- if text cleaned != pagename local pagename = mw.title.getCurrentTitle().text local text_c = string.gsub(text, _ricChar, '') local text_c = string.gsub(text_c, " ", ' ') -- no U+00A0 in real page title but U+0020 if text ~= "" and text_c ~= pagename and ns == 0 then builder.error("li mot dins l’ ricepeure <code>"..text_c.."</code> est diferin do tite <code>"..pagename.."</code>") return false end if c > 0 then if string.sub(text, 1, string.len(_ricChar)) == _ricChar or string.sub(text, -string.len(_ricChar)) == _ricChar then builder.error("<code>"..text .. "</code> n’ est nén ene coreke ricepeure") elseif text == pagename then builder.add_content("nén [[rcepåve]]") builder.add_category(language.grammar({args={"Mots", lang, "di deus pîs", vowel="1"}}), 0) else builder.add_content(text) if _litNum[(p-1)] ~= nil then builder.add_category(language.grammar({args={"Mots", lang, "di ".._litNum[(p-1)].." pîs", vowel="1"}}), 0) end end else builder.add_content("nén [[rcepåve]]") builder.add_category(language.grammar({args={"Mots", lang, "d' on seu pî", vowel="1"}}), 0) end return true end -- Entry point of the module function p.init(frame) local text = '' local lang = "wa" if frame.args[1] then text = mw.text.trim(frame.args[1]) end if frame.args["lang"] then lang = mw.text.trim(frame.args["lang"]) end builder.init(frame, "Årtikes avou ene flotche dins l' ricepeure") render(text, lang) return builder.get_content() end return p