Module:Kangxi radical
Appearance
require('strict')
local p = {}
local labels = { -- ten per line
"one", "line", "dot", "slash", "second", "hook", "two", "lid", "man", "legs",
"enter", "eight", "down box", "cover", "ice", "table", "open box", "knife", "power", "wrap",
"spoon", "right open box", "hiding enclosure", "ten", "divination", "seal", "cliff", "private", "again", "mouth",
"enclosure", "earth", "scholar", "go", "go slowly", "evening", "big", "woman", "child", "roof",
"inch", "small", "lame", "corpse", "sprout", "mountain", "river", "work", "oneself", "turban",
"dry", "short thread", "dotted cliff", "long stride", "two hands", "shoot", "bow", "snout", "bristle", "step",
"heart", "halberd", "door", "hand", "branch", "rap", "script", "dipper", "axe", "square",
"not", "sun", "say", "moon", "tree", "lack", "stop", "death", "weapon", "do not",
"compare", "fur", "clan", "steam", "water", "fire", "claw", "father", "double x", "half tree trunk",
"slice", "fang", "cow", "dog", "profound", "jade", "melon", "tile", "sweet", "life",
"use", "field", "bolt of cloth", "sickness", "dotted tent", "white", "skin", "dish", "eye", "spear",
"arrow", "stone", "spirit", "track", "grain", "cave", "stand", "bamboo", "rice", "silk",
"jar", "net", "sheep", "feather", "old", "and", "plow", "ear", "brush", "meat",
"minister", "self", "arrive", "mortar", "tongue", "oppose", "boat", "stopping", "color", "grass",
"tiger", "insect", "blood", "walk enclosure", "clothes", "west", "see", "horn", "speech", "valley",
"bean", "pig", "badger", "shell", "red", "run", "foot", "body", "cart", "bitter",
"morning", "walk", "city", "wine", "distinguish", "village", "gold", "long", "gate", "mound",
"slave", "short tailed bird", "rain", "blue", "wrong", "face", "leather", "tanned leather", "leek", "sound",
"leaf", "wind", "fly", "eat", "head", "fragrant", "horse", "bone", "tall", "hair",
"fight", "sacrificial wine", "cauldron", "ghost", "fish", "bird", "salt", "deer", "wheat", "hemp",
"yellow", "millet", "black", "embroidery", "frog", "tripod", "drum", "rat", "nose", "even",
"tooth", "dragon", "turtle", "flute",
}
function p.Kxr(frame)
-- simplify handling of args
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame)
return p._Kxr(args)
end
function p._Kxr(args)
local r = math.floor(tonumber(args[1]))
local link = false
mw.log(args["l"])
if args["l"] ~= nil or args["link"] ~= nil then
link = true
end
if r < 1 or r > 214 then
error("Argument must be between 1 and 214")
end
local unicode = 0x2F00 + r - 1
local u_str = "&#" .. unicode .. ";"
local lab = string.upper(labels[r])
if link then
lab = "[[Radical " .. tostring(r) .. "|".. lab .. "]]"
end
lab = "<span style=\"font-variant: small-caps;font-size:smaller;font-weight:bolder\">" .. lab .. "</span>"
local result = "<span lang=\"und-Hani\">" .. u_str .. "</span> ".. lab
mw.log(result)
return result
end
return p