Development:Bible navigation links
From Door43
|
For instance, "Luke 1" is followed by "Luke 2" and preceded by "Mark 16". When a user is reading any chapter of Scripture, they need to be able to easily navigate to the previous and next chapters. Here is how we are enabling this in Door43.
How it Works
Conventions Used
Bible translations in Door43 use one page for each chapter with a space separating the book name and the chapter number, e.g. Bible:Luke 1, Bible:1 Timothy 3.[1]
The Meta Structure
Following this convention, there should be a page for every chapter of the Bible in the Meta namespace, e.g. Meta:Luke 1. Each page in the Meta namespace will have two subpages "/next" and "/prev", e.g. Meta:Luke 1/prev, Meta:Luke 1/next.
The content of these subpages contains the bookname and chapter that corresponds to its parent page. For instance, the page Meta:Luke 1/prev should contain only the text "Mark 16", while the page Meta:Luke 1/next should contain only "Luke 2".
Templates & Variables
Instead of manually adding "previous chapter" and "next chapter" links to every chapter of every book of the Bible in every language on Door43[2], we want to be able to add them automatically, based on the chapter of Scripture currently being used. MediaWiki makes this easy, by using templates.
A template that would do this could be very simple and would reference the variables called {{BASEPAGENAME}}, which is the title of the current page (excluding any parent pages). For example, the template might include this:
- [[Bible:{{:Meta:{{BASEPAGENAME}}/prev}}|{{:Meta:{{BASEPAGENAME}}/prev}}]]
From left to right:
- It creates an internal link (with the [[ start tag and ]] end tags) in the "Bible" namespace.
- The page of the link is transcluded from the sub-page "/prev" under a page in the "Meta" namespace, that has the same name as the {{BASEPAGENAME}}. So, in our example above, if the user were on the page Bible:Luke 1, the transcluded page would be Meta:Luke 1/prev, which should contain the text "Mark 16".
- The title of the link (what comes to the right of the "|") is the same text as the link created above, that is, "Mark 16" in our example above.
This might seem kind of nebulous without a real example to see in action. Check out the header links on the Luke 1 page of the TSI version of the Bible in Indonesian (in progress). It references this template where you can see the variables and Meta link structure in use.
Making it Work in Every Language
We need a means of creating the Meta structure for Bible links automatically for any/every language in Door43. To do that, we need a PHP script (so we can integrate it into our PHP front-end that will contain web-based utilities to generate other needed "stuff" to make using Door43 easier for end-users) that does the following:
- Input a list of translated booknames (so that booknames are localized into the target language)
- Create links for each chapter of every bookname (number of chapters for books of the Bible are a known number) in the Meta namespace
- Output an XML text file] in MediaWiki XML format that can be imported into the wiki to create the links for a given language.
Resources & Links
Footnotes