Revision as of 06:42, 25 October 2024 editRemsense (talk | contribs)Extended confirmed users, Page movers, New page reviewers, Template editors59,258 edits per Misplaced Pages:Village pump (technical)#Workaround for Safari bug with small caps?← Previous edit | Revision as of 09:59, 24 November 2024 edit undoSMcCandlish (talk | contribs)Autopatrolled, Extended confirmed users, Page movers, File movers, New page reviewers, Pending changes reviewers, Rollbackers, Template editors201,658 edits rm. all-caps/small-caps stuff; see talk page and previous discussion. I'm skeptical this should be doing "text-transform: lowercase;", either. Someone might begin a sentence with a radical, e.g. "'Dragon' might less literally convey ...". If this lowercasing default is retained, then we at least need a parameter to force if off, e.g. |lc=y or |uc=n or |caps=no orTag: RevertedNext edit → | ||
Line 125: | Line 125: | ||
if add_label then | if add_label then | ||
local label_style = "\" |
local label_style = "\"text-transform: lowercase;\"" | ||
label = string.upper(labels) | label = string.upper(labels) | ||
Revision as of 09:59, 24 November 2024
Module documentation[view] [edit] [history] [purge]This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
Implements {{Kangxi radical}}.
The above documentation is transcluded from Module:Kangxi radical/doc. (edit | history)Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
require('strict') local p = {} function p.find(t, srch) -- search by value for k, _ in ipairs(t) do if t == srch then return k; end end end 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", } local variants = { -- five per line = 1, = 2, = 2, = 3, = 4, = 5, = 5, = 5, = 5, = 5, = 6, = 7, = 8, = 9, = 9, = 9, = 9, = 9, = 10, = 10, = 10, = 11, = 12, = 12, = 13, = 14, = 15, = 15, = 16, = 16, = 16, = 16, = 17, = 18, = 18, = 18, = 19, = 20, = 21, = 22, = 23, = 24, = 25, = 25, = 25, = 26, = 26, = 27, = 27, = 28, = 29, = 30, = 31, = 32, = 33, = 34, = 35, = 35, = 36, = 37, = 37, = 38, = 38, = 39, = 40, = 41, = 41, = 42, = 42, = 42, = 43, = 43, = 43, = 44, = 45, = 46, = 46, = 47, = 47, = 47, = 48, = 49, = 50, = 51, = 52, = 52, = 53, = 53, = 53, = 54, = 55, = 56, = 57, = 58, = 58, = 59, = 60, = 61, = 61, = 61, = 62, = 63, = 63, = 63, = 64, = 64, = 64, = 65, = 66, = 67, = 68, = 69, = 70, = 71, = 71, = 72, = 72, = 73, = 74, = 74, = 75, = 75, = 76, = 77, = 77, = 77, = 78, = 78, = 79, = 80, = 81, = 82, = 83, = 84, = 84, = 84, = 84, = 85, = 85, = 85, = 86, = 86, = 87, = 87, = 87, = 87, = 88, = 89, = 89, = 90, = 91, = 92, = 92, = 93, = 93, = 93, = 93, = 94, = 94, = 95, = 96, = 96, = 97, = 98, = 99, = 100, = 101, = 102, = 103, = 103, = 104, = 104, = 104, = 104, = 105, = 106, = 107, = 108, = 109, = 110, = 111, = 112, = 113, = 113, = 113, = 114, = 115, = 116, = 117, = 118, = 118, = 119, = 120, = 120, = 120, = 121, = 122, = 123, = 123, = 124, = 125, = 126, = 127, = 128, = 129, = 130, = 130, = 131, = 132, = 133, = 134, = 135, = 136, = 137, = 138, = 139, = 139, = 140, = 140, = 140, = 141, = 142, = 143, = 144, = 145, = 145, = 145, = 146, = 146, = 147, = 147, = 147, = 148, = 148, = 149, = 149, = 149, = 150, = 151, = 152, = 153, = 154, = 154, = 155, = 156, = 157, = 157, = 158, = 159, = 159, = 160, = 161, = 162, = 162, = 162, = 162, = 162, = 163, = 163, = 164, = 165, = 166, = 167, = 167, = 167, = 168, = 168, = 168, = 169, = 169, = 169, = 170, = 170, = 171, = 172, = 173, = 173, = 174, = 174, = 175, = 176, = 177, = 178, = 179, = 180, = 181, = 182, = 182, = 182, = 183, = 183, = 184, = 184, = 184, = 184, = 184, = 185, = 186, = 187, = 187, = 187, = 187, = 188, = 188, = 189, = 190, = 191, = 192, = 193, = 194, = 194, = 195, = 195, = 195, = 196, = 196, = 196, = 197, = 197, = 197, = 198, = 199, = 199, = 199, = 200, = 201, = 201, = 201, = 202, = 203, = 204, = 205, = 205, = 205, = 206, = 207, = 207, = 208, = 209, = 210, = 210, = 210, = 211, = 211, = 211, = 212, = 212, = 212, = 213, = 213, = 213, = 213, = 214, } function p.Kxr(frame) local getArgs = require('Module:Arguments').getArgs return p._Kxr(getArgs(frame)) end local function utfEscape(hex) return "&#" .. hex .. ";" end function p.toRadicalNumber(ch) local codepoint = mw.ustring.codepoint(ch) local result = nil if codepoint >= 0x2F00 and codepoint <= 0x2FD5 then result = codepoint - 0x2F00 + 1 else result = variants end if not result then result = p.find(labels, ch); end return result end function p._Kxr(args) local num = nil local add_link = false local add_label = args ~= "no" local add_numero = false local use_variant = false local glyph = "" local label = "" local result = "" if tonumber(args) then num = math.floor(tonumber(args)) else num = p.toRadicalNumber(string.lower(args)) if args or args then use_variant = true; end end local unicode = 0x2F00 + num - 1 if use_variant and mw.ustring.len(args) == 1 then glyph = args else glyph = utfEscape(unicode); end if args or args or args then add_link = true; end if add_label then local label_style = "\"text-transform: lowercase;\"" label = string.upper(labels) if add_link then label = "]"; end label = " <span style=" .. label_style .. ">'" .. label .. "'</span>" end result = "<span lang=\"und-Hani\">" .. glyph .. "</span>" .. label return result end return pCategory: