Wikimedia

[Lua task #10] Update code of the "Reign" template on English Wikipedia

Prerequisite: To work on this task, you MUST have some knowledge of Lua programming already (or another language plus completing the previous basic Lua tasks, #01 to #09, here in Google Code-in).

On Wikipedia, editors generally use templates to perform complex tasks, not least of which is ensuring that items are displayed in a consistent manner across Wikipedia.

1 Read the documentation for Template:Reign, which is used to provide a consistent display of the reigns of kings, emperors, etc.

2 Read the discussion at Probably-simple conversion, particularly noting the numerous test cases.

3 Create a new sandbox (or a new section) in your user space and collect as many of the test cases as you can find on that page.

If you understand Wikipedia template coding, examine the source of Template:Reign and work out an algorithm to duplicate its functionality. Otherwise, try to work out an algorithm from the task description.

4 Create a new Module sandbox (or a new section) and write a function that takes the same parameters as Template:Reign, and produces the correct output for each of the test cases.

5 In your sandbox, write calls to your module for each of the test cases that demonstrate the output for them.

6 Leave links to your sandbox here.

Task tags

  • lua
  • scribunto

Students who completed this task

C. F. Fairfeld, Sanath, Kid116, Gabriel CH Lee, Tarun Prasad, Linda Thelen, Jan Nowosielski, Om Desai

Task type

  • code Code
close

2017