Module:User:ZxxZxxZ/2

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of ZxxZxxZ, for his own experimentation. Items in this module may be added and removed at ZxxZxxZ's discretion; do not rely on this module's stability.


local export = {}
local common = require("Module:fa-common")
local bs_stuff = require("Module:useful stuff")
local links = require("Module:User:ZxxZxxZ")
 
function export.main(frame)
    local pframe = frame:getParent()
    local args = pframe.args
    local word = mw.title.getCurrentTitle().text
    local tr = args["tr"]; if tr == "" then tr = nil end
    local c = args["c"]
 
    local text = bs_stuff.tag_text(word, "fa", "strong", "fa-Arab")
 
    if tr  then
        text = text .. " (<span lang=\"\">" .. tr .. "</span>)"
    end
 
    if c == "+" then
        local comparative_word = word .. common.ZWNJ(word) .. "تر"
        local superlative_word = word .. common.ZWNJ(word) .. "ترین"
 
        text = text .. ", ''comparative'' "
        if tr then
             text = text .. links.annotated_link(comparative_word, nil, "fa", "span", "fa-Arab form-of comparative-form-of lang-fa transliteration-{{anchorencode:" .. tr .. "-tar}}", tr .. "-tar")
        else
             text = text .. links.annotated_link(comparative_word, nil, "fa", "span", "fa-Arab form-of comparative-form-of lang-fa")
        end
 
        text = text .. ", ''superlative'' "
        if tr then
             text = text .. links.annotated_link(superlative_word, nil, "fa", "span", "fa-Arab form-of superlative-form-of lang-fa transliteration-{{anchorencode:" .. tr .. "-tarin}}", tr .. "-tarin")
        else
             text = text .. links.annotated_link(superlative_word, nil, "fa", "span", "fa-Arab form-of superlative-form-of lang-fa")
        end
    end
 
    if mw.title.getCurrentTitle().nsText == "" then
        text = text .. "[[Category:Persian adjectives]]"
    end
 
    return text
end
 
return export