18,700
edits
(Created page with "This page and its subpages are used by templates to construct links and tables on BSL function and variable pages, the ...") |
m (link fix) |
||
Line 24: | Line 24: | ||
First, when BSLjunc wants to display a message with the name of a command's group, it calls the [[Template:Find BSL Group|Find BSL Group]] template to search every grouping page (the subpages of this very page) for the name of the command. Now, this template utilizes [[Template:Foreach|Foreach]], and as explained on that template page, the number of calls that Foreach should make depends on how many items will be found when the page is parsed. There's no function that we can use to count commas in advance, so we have to manually embed that number directly in the page. That's why, if you scroll down to the bottom of this page, the number of command groups comes before the actual names of the command groups; that element is read in first and passed to Foreach, which passes that many of the page's group names to the specified template. | First, when BSLjunc wants to display a message with the name of a command's group, it calls the [[Template:Find BSL Group|Find BSL Group]] template to search every grouping page (the subpages of this very page) for the name of the command. Now, this template utilizes [[Template:Foreach|Foreach]], and as explained on that template page, the number of calls that Foreach should make depends on how many items will be found when the page is parsed. There's no function that we can use to count commas in advance, so we have to manually embed that number directly in the page. That's why, if you scroll down to the bottom of this page, the number of command groups comes before the actual names of the command groups; that element is read in first and passed to Foreach, which passes that many of the page's group names to the specified template. | ||
The second use for grouping information is when building tables. Each grouped page calls [[Template:BSL Group Table|BSL Group Table]], which looks for a grouping page by the same name as the page that called it. So if "BSL:AI activity" is calling the template, BSL Group Table looks for "BSL:Grouping/AI activity". If it exists, Foreach is used to pass each command name on that grouping page to the [[Template:BSL Table | The second use for grouping information is when building tables. Each grouped page calls [[Template:BSL Group Table|BSL Group Table]], which looks for a grouping page by the same name as the page that called it. So if "BSL:AI activity" is calling the template, BSL Group Table looks for "BSL:Grouping/AI activity". If it exists, Foreach is used to pass each command name on that grouping page to the [[Template:BSL Group Table Entry|BSL Group Table Entry]] template, which simply calls (transcludes) the command page by that name while passing it "yes" for the "tableform" parameter (discussed above), and supplying the name of the group to which the command belongs. That group name will get used by BSLjunc for the "Group" column of the table for which it is providing table row markup. | ||
Thus, a grouped page can construct a table with a single direct call to a template. BSL List uses a similar approach to constructing its complete table, except that it needs to list the commands in every group, not just one, so it uses Foreach to call BSL Group Table for every group name that is listed below on this page (actually it uses [[Template:Foreach2|Foreach2]], which is a duplicate of Foreach; this is because Foreach is already being used to perform the inner loop that processes every command name in a single group, and MediaWiki freaks out about a "template loop" if a template calls itself). | Thus, a grouped page can construct a table with a single direct call to a template. BSL List uses a similar approach to constructing its complete table, except that it needs to list the commands in every group, not just one, so it uses Foreach to call BSL Group Table for every group name that is listed below on this page (actually it uses [[Template:Foreach2|Foreach2]], which is a duplicate of Foreach; this is because Foreach is already being used to perform the inner loop that processes every command name in a single group, and MediaWiki freaks out about a "template loop" if a template calls itself). |