User:Willscrlt/UBX/Musicbox/How it works
The following highly technical information explains how the Musicbox templates work for those that are interested. For everyone else, you may safely ignore this page. The main Musicbox documenation explains how to add a Musicbox to your user page, and the Musicbox catalog contains examples of every standard Genre Musicbox.
Musicbox template files
[edit]- {{User:Willscrlt/UBX/Musicbox}} is the main template that starts the "magic"
- It determines if the request is a Genre, Artist, Album, Song Title, Custom, or Unique Musicbox
- Genre Musicboxes are passed to {{User:Willscrlt/UBX/Musicbox/Genre}} for additional processing
- Artist, Album, Song Title, and Custom Musicboxes are passed to {{User:Willscrlt/UBX/Musicbox/Special}} for processing
- Unique Musicboxes are passed directly to {{User:Willscrlt/UBX/Musicbox/Basic}} for display
- {{User:Willscrlt/UBX/Musicbox/Genre}} determines the selected Genre
- Large Genres (Rock/Pop and Jazz) are passed to sub-parsers ({{User:Willscrlt/UBX/Musicbox/Genre/Rock-Pop}} and {{User:Willscrlt/UBX/Musicbox/Genre/Jazz}})
- The other Genres are directly processed and passed to {{User:Willscrlt/UBX/Musicbox/Basic}} for display
- Subparsers directly process large genres and then pass to {{User:Willscrlt/UBX/Musicbox/Basic}}
- {{User:Willscrlt/UBX/Musicbox/Basic}} displays the information passed to it from the preceding parser templates
- In symbolic form this would be represented as
- User:Willscrlt/UBX/Musicbox → Musicbox →
Everything could all be handled inside a single, enourmous template, but 1) it would be a nightmare to maintain, 2) it would discourage contributions from people wanting to add new Styles and sub-Types of music or updating wikilinks, 3) the performance would probably be slower and a bigger impact on the servers.
Musicbox categories
[edit]The categories populated by Musicbox's standard 20 Genres are located under Wikipedians by music genre:
- #0 is used only if the supplied attributes are unrecognized. #18 is used for artists, albums, and song titles, not for genres.
Additionally, Styles of music and sub-Types are categorized under the most specific category available if they pre-exist. In other words, if you select "big band" as a Style of Jazz you like, and if Category:Wikipedians who listen to big band music already exists (which it did at the time this documenation was written), then you will be added to that category instead of the more generic Category:Wikipedians who listen to jazz. However, to avoid categorizing users in deleted categories, this subcategorizing only is done where a category already exists and the category name matches Musicbox's terminology. An example that would not work is a sub-Type of "reggae music" when the category is named Category:Wikipedians who listen to reggae (the word "music" is not part of the category name, but is in Musicbox; therefore, they do not match and you would not be added to the reggae category but would be added to the generic world music category instead).
This automatic category matching for Styles and sub-Types can be tweaked within the template to fix a category mismatch like the one in the reggae example. It involves editing the appropriate Musicbox parser template and adding a category override attribute (|usecat=Category name goes here
).
Musicbox documenation files
[edit]- User:Willscrlt/UBX/Musicbox/doc — The main documentation for Musicbox
- User:Willscrlt/UBX/Musicbox/How it works — This page; technical details about Musicbox
- User:Willscrlt/UBX/Musicbox/Catalog — The contents page for the Musicbox catalog of examples and recognized Genres, Styles, and sub-Types displayed on the following subpages:
See also
[edit]- Musicbox documentation
- Information about userboxes at Wikipedia
- Help with templates at Wikipedia, at Meta, and at MediaWiki
- Help with magic words, parser functions, and variables
- Willscrlt's talk page for obtaining Musicbox technical support