Fandom

Wikia Developers Wiki

Global Lua Modules/YearNav

< Global Lua Modules

896pages on
this wiki
Add New Page
Talk0 Share

YearNav is a module designed to make it easier to traverse year-based pages or categories. It looks for a four-digit year in the page title, then provides links to similarly-named pages for other years. Which years are linked to can be modified, as can the form of the output.

Code

Module:YearNav

Use

{{#invoke:YearNav|YearNav|pattern}}

The pattern is where you put which years to link to as well as any special styling to them. It interprets ####+X or ####-X as where to place links to pages for years X away from the current page. If not specified the default pattern is: ####-10 ・・ ####-1 ・ '''####''' ・ ####+1 ・・ ####+10

Sample patterns and outputs

Output shown as if used on page entitled 1987 Sandwiches.

1

<span style='font-size:70%'>####-3</span> <span style='font-size:80%'>####-2</span> <span style='font-size:90%'>####-1</span> <span style='font-size:100%'>####</span> <span style='font-size:110%'>####+1</span> <span style='font-size:120%'>####+2</span> <span style='font-size:130%'>####+3</span>

1984 Sandwiches 1985 Sandwiches 1986 Sandwiches 1987 Sandwiches 1988 Sandwiches 1989 Sandwiches 1990 Sandwiches

2

''Previous century'': ####-100<br>''Following century'': ####+100

Previous century: 1887 Sandwiches
Following century: 2087 Sandwiches

3

<table style='background:linear-gradient(to right,rgba(255,255,255,0),#e1e7f6,rgba(255,255,255,0));'><tr><td>####-10 ・・ ####-1 ・ '''####''' ・ ####+1 ・・ ####+10</td></tr></table>

1984 Sandwiches ・・ 1986 Sandwiches1987 Sandwiches1988 Sandwiches ・・ 1989 Sandwiches


The pattern is pretty open, but some things will break it--particularly multiple curly brackets or pipe characters. In some cases it may be the better solution to invoke the module on the inside of something. For instance, instead of using the pattern from the immediate previous example, you'd get the same result from doing

<table style='background:linear-gradient(to right,rgba(255,255,255,0),#e1e7f6,rgba(255,255,255,0));'><tr><td>{{#invoke:YearNav|YearNav|####-10 ・・ ####-1 ・ '''####''' ・ ####+1 ・・ ####+10}}</td></tr></table>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.