yoohoo! hot sauce please
10:27, 7 September 2026 (UTC)
Editing
Module:Infobox categorizer/doc
(section)
From 2swagg wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Alias set handling == <code>compileAliasSet(sets, options)</code> (reported as CAS in errors) compiles an ordered list of sets. Each set is a list of category records, with aliases and, optionally, domains identifying each category. For CAS to function, '''sets must be wrapped, even if there is just one.''' Wrap them like this: <syntaxhighlight lang="lua"> local subjectSites = { { category = '4chan', aliases = { '4chan', '4cuck' }, domains = { '4chan.org' } }, { category = 'Soyjak.party', aliases = { 'sharty', 'soyjak.party' } }, } local sharedSites = mw.loadData('Module:Infobox categorizer/sites') local sites = core.compileAliasSet({ subjectSites, sharedSites }) local matches = core.matchAliasSets(args.frequented_sites, sites) </syntaxhighlight> The order of the sets determine priority. The first set to claim an alias or domain will own that claim, later sets cannot assign the same claim to another category, in other words, that claim is occupied. Putting a subject's records before shared records lets the subject override "global" records. As an example, if a country set assigns "Frog" as an alias to France, and NAS sets "Frog" to Pepe, and both are loaded with the same matching mode & case setting (defaults mean this is likely, read more below), whichever set comes first will own "Frog". Keep this in mind with complicated infoboxes, since as time passes the list of aliases will grow and conflicting sets will become inevitable. You must choose what are the appropriate sets to load and their order. After compilation, <code>matchAliasSets(value, compiled)</code> (reported as MAS in errors) searches an input for the compiled aliases and domains. It returns every matching category once. For example, an input containing "4cuck" and "sharty" can return both "4chan" and "soyjak.party". MAS returns allow the subject module to categorize a field containing several sites, countries, or other recognized values. Record with the same category label are merged during compilation. {{Bantext|Within a single set, two different categories cannot claim the same alias after normalization}}{{Note|Under the same matching mode and case setting.}} or the same normalized domain. This is because each alias claim within a set must have one owner. Assigning "Frog" to both France and Pepe is contradictory, so CAS rejects the set with a config error. To fix this, remove or reassign the duplicate alias. If the competing sets are intentional, place them in separate sets and sort them by priority. In separately loaded sets, the conflicts are resolved by load order. An alias can be a string or a record containing additional matching settings if the situation calls for it. For example, the country code for the United States is "US". To avoid false flag detection of "us", making "US" case sensitive prevents lowercase "us" from matching and exact matching requires the entire field to be "US" only. This is done with <code>{'US', match = 'exact', caseSensitive = true}</code>{{Note|Remember, wiki content is extremely unpredictable and things that seem minute as this are still a key issue that you have to consider.}} The matching mode setting can be supplied through <code>options.match</code>, <code>set.match</code>, or <code>entry.match</code>, or the individual alias <code>match</code> setting. The more specific setting wins, the individual alias always has the highest priority. The default mode is <code>word</code>. Case sensitive-matching is enabled through <code>caseSensitive = true</code> on a record. more snca to add later {{notelist}} <includeonly> [[Category:Titles namespaces and categories modules]] [[Category:Utility modules]] </includeonly>
Summary:
Please note that all contributions to 2swagg wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
2swagg wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
janny
Noticeboard
Tools
What links here
Related changes
Special pages
Page information