Template:Ca-dicc
Appearance
Unchecked
Module:CaDicc
-- Module:CaDicc
local M = {}
local function trim(s) return (tostring(s or ""):gsub("^%s+",""):gsub("%s+$","")) end
local function split(list, sep)
list = tostring(list or "")
sep = sep or "[,;]"
local t = {}
for item in list:gmatch("([^"..sep.."]+)") do
table.insert(t, trim(item))
end
return t
end
function M.bullets(frame)
local list = frame.args.list or ""
local items = split(list)
local out = {}
for _, it in ipairs(items) do
if it ~= "" then table.insert(out, "<li>" .. mw.text.nowiki(it) .. "</li>") end
end
return table.concat(out, "\n")
end
function M.commaList(frame)
local list = frame.args.list or ""
local items = split(list)
local out = {}
for _, it in ipairs(items) do
if it ~= "" then table.insert(out, mw.text.nowiki(it)) end
end
return table.concat(out, ", ")
end
function M.commaLinks(frame)
local list = frame.args.list or ""
local items = split(list)
local out = {}
for _, it in ipairs(items) do
if it ~= "" then
local title = mw.text.trim(it)
table.insert(out, "[[" .. title .. "]]")
end
end
return table.concat(out, ", ")
end
return M
Template documentation
[edit source]Template:Ca-dicc renders a compact or full dictionary entry card for a word/term, including headword, part of speech, pronunciation, etymology, definitions, examples, and related lists. Empty fields are omitted automatically.
Purpose
[edit source]- Provide consistent presentation of dictionary-like information within articles or glossary pages.
- Encourage concise etymology and definition entries while supporting examples and usage notes.
- Offer optional categorization for maintenance.
Usage
[edit source]Basic:
{{Ca-dicc
|head=example
|pos=noun
|ipa=ɪɡˈzɑːmpəl
|def=a thing characteristic of its kind
}}
With audio and etymology:
{{Ca-dicc
|head=example
|pos=noun
|ipa=ɪɡˈzɑːmpəl
|audio=File:En-us-example.ogg
|etym=From Latin ''exemplum''
|def=a thing characteristic of its kind
|examples=This is an example.;An instructive example appears in the text.
}}
Multiple definitions and lists:
{{Ca-dicc
|head=run
|pos=verb
|defs=to move swiftly on foot;to execute a program;to function or operate
|usage=colloquial;computing
|region=US
|synonyms=sprint, operate
|antonyms=walk, stop
|derived=runner, runtime
|see=movement, execution
}}
Compact and boxed display:
{{Ca-dicc
|head=lexicon
|pos=noun
|def=a vocabulary of a person, language, or field
|compact=yes
|box=yes
}}
Parameters
[edit source]- head
- Headword or lemma (required for proper categorization).
- pos
- Part of speech.
- ipa
- Pronunciation (IPA).
- audio
- Audio file link (File:...), optional.
- etym
- Brief etymology.
- def
- Single-line short definition.
- defs
- Multiple definitions; separate items by commas or semicolons.
- usage
- Usage labels (formal, colloquial, archaic, computing, etc.).
- region
- Regional label (US, UK, etc.).
- inflect
- Inflectional information (plural forms, conjugation pattern).
- examples
- Example sentences; separate by commas or semicolons.
- synonyms
- Comma/semicolon-separated synonyms.
- antonyms
- Comma/semicolon-separated antonyms.
- derived
- Related or derived terms (can be wiki-linked via see).
- see
- See also targets (comma-separated; auto-linked).
- notes
- Additional notes.
- lang
- Language badge text.
- compact
yes/true/1for slightly smaller header text.- box
yes/true/1to add a soft box style around the card.- nocat
- Suppress maintenance category emission.
- catprefix
- Override category prefix, default
Category:Dictionary entries.
Categories
[edit source]- By default:
[[Category:Dictionary entries]]
- Missing headword:
[[Category:Dictionary entries missing headword]]
Adjust with catprefix if your site uses a different tree.
Best practices
[edit source]- Keep
defconcise; usedefsfor elaboration. - Prefer IPA for pronunciation consistency.
- Cite etymology in article prose where needed; this template focuses on presentation.
- Use
compactfor lists or sidebars where vertical space is limited.