Difference between revisions of "Template:LDS/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Biggins
m (Improved readability of template code)
imported>Biggins
(HUGE REVISION: moved virtually all the logic to a (sandboxed) Lua module)
Line 2: Line 2:
 
   #switch: {{{website}}} <!--==== If the "website=lds" flag is set, just call the LDS/legacy template ====-->
 
   #switch: {{{website}}} <!--==== If the "website=lds" flag is set, just call the LDS/legacy template ====-->
 
   |lds = {{LDS/legacy|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}} }}
 
   |lds = {{LDS/legacy|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}} }}
  |[[wikisource:{{ <!--==== By default, we will build a link to wikisource ====-->
+
<!--==== Otherwise, let the Lua do-a all the work! ====-->
    #if: {{{2|}}} <!--==== There are at least two parameters (the text to display and the book name) ====-->
+
  |{{#invoke:Sandbox/Biggins/LDS/sandbox|main}}
    |{{
+
}}<noinclude>
      #switch:{{{2}}} <!--==== Switch to determine which of the standard works to link to on Wikisource ====-->
 
 
 
<!--==== If the book is in the BoM, link to the 1981 edition of the BoM on Wikisource ====-->
 
<!--==== (NB: CURRENTLY NOT IMPLEMENTING LINKS TO THE TITLE PAGE AND TESTIMONIES OF THE 3/8 WITNESSES) ====-->
 
      |1-ne|1_ne|1ne|2-ne|2_ne|2ne|jacob|enos|jarom|omni|w-of-m|wofm|w_of_m|mosiah|alma|hel|3-ne|3_ne|3ne|4-ne|4_ne|4ne|morm|mormon|ether|moro|moroni|1 Nephi|2 Nephi|Jacob|Enos|Jarom|Omni|Words of Mormon|Words Of Mormon|Mosiah|Alma|Helaman|3 Nephi|4 Nephi|Mormon|Ether|Moroni=Book of Mormon (1981)
 
 
 
<!--==== If the book is in the D&C, link to the (1981 edition of?) the D&C on Wikisource ====-->
 
      |od|Official Declaration|dc|Doctrine and Covenants|The Doctrine And Covenants|Doctrine And Covenants=The Doctrine and Covenants
 
 
 
<!--==== If the book is in the PoGP, link to the 1913 PoGP on Wikisource ====-->
 
      |moses|abr|fac-1|fac1|fac-2|fac2|fac-3|fac3|js-m|jsm|js-h|jsh|a-of-f|a_of_f|aoff|Moses|Abraham|Joseph Smith Matthew|JS Matthew|JST Matthew|Joseph Smith History|JS History|JSH|JS-H|The Articles of Faith|Articles Of Faith|The Articles Of Faith|Articles of Faith=The Pearl of Great Price (1913)
 
 
 
<!--==== JST LINKS GO TO STUDY HELPS APPENDIX (https://www.churchofjesuschrist.org/study/scriptures/jst?lang=eng) IN CURRENT VERSION OF LDS TEMPLATE - THIS VERSION LEAVES THEM OUT AT LEAST FOR NOW BUT KEEPS THE CODE IN THIS COMMENT FOR REFERENCE
 
      |jst-gen|jst-ex|jst-1-chr|jst-ps|jst-isa|jst-matt|jst-mark|jst-luke|jst-john|jst-acts|jst-rom|jst-1-cor|jst-gal|jst-col|jst-2-thes|jst-1-tim|jst-heb|jst-james|jst-2-pet|jst-rev=jst ====-->
 
 
 
<!--==== Since the Bible has the most books, we just default to that rather than creating an unnecessarily huge Switch statement ====-->
 
      |#default=Bible (King James)
 
 
 
      }}/{{
 
            #switch: {{{2}}} <!--==== Switch statement to determine which individual book (or Section of the D&C) to link to on Wikisource. NB: For backwards compatibility, this template must accept the abbreviations on cocj.org ====-->
 
 
 
<!--==== BoM books (NB: CURRENTLY NOT IMPLEMENTING LINKS TO THE TITLE PAGE AND TESTIMONIES OF THE 3/8 WITNESSES) ====-->
 
            |1-ne|1_ne|1ne=1 Nephi|2-ne|2_ne|2ne=2 Nephi|jacob=Jacob|enos=Enos|jarom=Jarom|omni=Omni|w_of_m|wofm|w-of-m|Words Of Mormon=Words of Mormon|mosiah=Mosiah|alma=Alma|hel=Helaman|3-ne|3_ne|3ne=3 Nephi|4-ne|4_ne|4ne=4 Nephi|morm|mormon=Mormon|ether=Ether|moro|moroni=Moroni
 
 
 
<!--==== D&C Sections (TODO: Accommodate "D&C" and other ampersand-inclusive variations!) ====-->
 
            |od|Official Declaration=Official Declaration {{{3|}}}|dc|dandc|d-and-c|Doctrine and Covenants|The Doctrine And Covenants|Doctrine And Covenants=Section {{{3|}}}
 
 
 
<!--==== PoGP books (NB: CITATIONS TO THE FACSIMILES GO TO THE BOOK OF ABRAHAM GENERALLY) ====-->
 
            |moses=Moses|fac-1|fac1|fac-2|fac2|fac-3|fac3|abr=Abraham|js-m|jsm|Joseph Smith Matthew|JS Matthew|JST Matthew=Matthew|js-h|jsh|JS History|Joseph Smith History|JSH|JS-H=History|a-of-f|a_of_f|aoff|The Articles of Faith|Articles Of Faith|The Articles Of Faith=Articles of Faith
 
 
 
<!--==== Old Testament books ====-->
 
            |gen=Genesis|ex=Exodus|lev=Leviticus|num=Numbers|duet=Deuteronomy|josh=Joshua|judg=Judges|ruth=Ruth|1sam|1-sam=1 Samuel|2sam|2-sam=2 Samuel|1kgs|1-kgs|1_kgs=1 Kings|2kgs|2-kgs|2_kgs=2 Kings|1chr|1-chr|1_chr=1 Chronicles|2chr|2_chr|2-chr=2 Chronicles|ezra=Ezra|neh=Nehemiah|esth=Esther|job=Job|ps=Psalms|prov=Proverbs|eccl=Ecclesiastes|song|songs|The Song of Solomon|Songs of Solomon|The Songs of Solomon=Song of Solomon|isa=Isaiah|jer=Jeremiah|lam=Lamentations|ezek=Ezekiel|dan=Daniel|hosea=Hosea|joel=Joel|amos=Amos|obad=Obadiah|jonah=Jonah|micah=Micah|nahum=Nahum|hab=Habakkuk|zeph=Zephanish|hag=Haggai|zech|zach|Zacharaih=Zechariah|mal=Malachi
 
 
 
<!--==== New Testament books ====-->
 
            |matt=Matthew|mark=Mark|luke=Luke|john=John|acts|The Acts=Acts|rom=Romans|1-cor|1_cor|1cor=1 Corinthians|2-cor|2_cor|2cor=2 Corinthians|gal=Galatians|eph=Ephesians|philip=Philippians|col=Colossians|1-thes|1_thes|1thes|1-thess|1_thess|1thess=1 Thessalonians|2-thes|2_thes|2thes|2-thess|2_thess|2thess=2 Thessalonians|1-tim|1_tim|1tim=1 Timothy|2-tim|2_tim|2tim=2 Timothy|titus=Titus|philem=Philemon|heb|Hebrew=Hebrews|james=James|1-pet|1_pet|1pet=1 Peter|2-pet|2_pet|2pet=2 Peter|1-jn|1_jn|1jn=1 John|2-jn|2_jn|2jn=2 John|3-jn|3_jn|3jn=3 John|jude=Jude|rev|Revelations=Revelation
 
 
 
<!--==== By default, use the book name provided by the user (e.g., if they passed in "Words of Mormon") ====-->
 
            |#default={{{2|}}}
 
            }} <!--==== End of the switch for which book to link to ====-->
 
 
 
<!--==== This is the 'false' branch of the #if statement way above testing for whether there are 2+ parameters. If fewer than 2 parameters were passed in, link to the Mormonism portal section about the Standard Works on Wikisource ====-->
 
    |Portal:Mormonism#LDS_Standard_Works_(Scriptures)
 
    }}{{
 
 
 
<!--==== Generate the specific chapter and/or verse to jump to in the cited book: ====-->
 
        #if: {{{3|}}} <!--==== See if a chapter was provided ====-->
 
        | %23{{ <!--==== Chapter provided, start building a fragment to jump to (%23 is the URL code for the # symbol) ====-->
 
              #if: {{{4|}}} <!--==== See if a verse was also provided ====-->
 
              | {{{3}}}:{{{4}}} <!--==== Both provided: jump to, e.g., #3:16 ====-->
 
              | Chapter_{{{3}}} <!--==== Only chapter provided: jump to, e.g., #Chapter_5 ====-->
 
      }}
 
        | <!--==== No chapter provided: don't jump anywhere ====-->
 
        }}<!--====
 
 
 
==== The above code built the address on Wikisource to link to; this next line builds the text to display ====
 
-->|{{{1|LDS Standard Works}}}{{#if:{{{3|}}}|&nbsp;{{{3}}}|}}{{#if:{{{4|}}}|&#58;{{{4}}}|}}{{#if:{{{5|}}}|{{#if:{{{8|}}}|{{{5}}}|–{{{5}}}}}|}}]]}}<noinclude>
 
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 06:31, 31 July 2020

Script error: No such module "Sandbox/Biggins/LDS/sandbox".

This template makes it easy to create links to Latter Day Saint movement scriptures, including to specific chapters/sections and verses inside those texts. By default, the template links to the texts as stored on Wikisource, but adding the optional "website=lds" parameter will create links to the LDS Church's website instead.

The most common usage for the template, citing to a single scripture verse, uses four parameters: {{LDS|display text|book name|chapter|verse}}

For example, {{LDS|Eth.|Ether|12|4}} renders as Eth. 12:4.

Additional parameters can be provided to cite to a range of verses and/or to the LDS Church website instead of Wikisource, as explained below.

Basic usage

{{LDS|Eth.|Ether|12|4}}

Results:

  1. Creates html link to https://en.wikisource.org/wiki/Book_of_Mormon_(1981)/Ether#12:4
  2. Jumps to verse on page
  3. Displays in the article text as: Eth. 12:4

Note

The first two parameters ("display text" and "book name") in many cases may be the same or similar, but they should always both be provided. For example, to produce Alma 7:11 you should type {{LDS|Alma|alma|7|11}}. Forgetting to provide the book name when it is the same or similar to the display text is the most common error when using this template.

Template Data

For citing to LDS scriptures on Wikisource (or the LDS church website)

Template parameters

ParameterDescriptionTypeStatus
display text1

text to display to user before the chapter/verse numbers; usually the full book name ("First Nephi") or an abbreviation ("1 Ne."), but it could be anything (e.g., "My favorite book of scripture") or even left blank (useful if citing to multiple different chapters of the same book and you don't want to repeat the book name)

Default
LDS Standard Works
Example
1 Ne.
Stringsuggested
book name2

name of book (or an alias/abbreviation); this parameter is not case sensitive (e.g., 'alma' is the same as 'Alma')

Example
1-ne
Stringsuggested
chapter3

chapter (or section) of scripture being cited

Example
12
Numbersuggested
verse4

verse of scripture being cited

Example
4
Numbersuggested
end verse5

end verse(s) of a series of cited verses, such as the 5 in "John 3:4–5" or the "–5, 16" in "John 3:4–5, 16". An en dash is automatically added between this parameter and the verse# parameter unless the end verse flag has a value (see the end verse flag parameter for more info about that usage)

Example
5
Stringoptional
footnote6

[DEPRECATED] letter of footnote to cite to. If this parameter has any value, it changes the citation to link to the verse *and* highlights the footnote matching the letter. If no match found, does not highlight anything.

Stringdeprecated
cross ref flag7

[DEPRECATED] if this has any value, then it changes the citation to link to the verse only and displays all verses that cross reference to it in the LDS church website's sidebar. (Ignores the value in footnote, if any)

Unknowndeprecated
nonconsecutive end verse flag8

if this has any value at all, then the hyphen before the 'end verse' parameter will not be automatically added. This allows for quoting of non-contiguous verses such as "John 3:5, 16" — the end verse parameter in this example should be ", 16"

Example
y
Stringoptional
websitewebsite

website to which to link; default is wikisource, but set this (named!) parameter to "lds" to cite to the LDS Church's website instead

Default
wikisource
Example
lds
Stringoptional

Book Name parameter aliases

The book name parameter can be the full name of the book of scripture cited (e.g., Alma, 1 Nephi, Moses, or 2 Kings) or any of these common aliases/abbreviations:

LDS Template Book Name Aliases
Standard Work Book Aliases
Bible (King James) Deuteronomy deut, dt
Hosea hos
Nehemiah neh
Leviticus lev, lv
1 Samuel 1sam, 1sm, 1_sam, 1-sam, 1 sam
Ruth ru, ruth
Malachi mal
Ecclesiastes eccles, eccl, qoheleth
John jn
Isaiah isa, is
Exodus exod, ex
Mark mk
2 Chronicles 2chron, 2chr, 2-chr, 2_chr, 2 chr
1 Chronicles 1chron, 1chr, 1-chr, 1_chr, 1 chr
1 Corinthians 1cor, 1-cor, 1_cor, 1 cor
2 Corinthians 2cor, 2-cor, 2_cor, 2 cor
Daniel dan, dn
Luke lk
Song of Solomon songofsol, songofsongs, song, songs, sg, canticles, canticleofcanticles, songs of solomon
Judges judg, jgs
Joel jl
Lamentations lam
Proverbs prov, prv
Psalms ps, pss, psalm
Joshua josh, jo
2 Timothy 2tim, 2tm, 2-tim, 2_tim, 2 tim
1 Timothy 1tim, 1tm, 1-tim, 1_tim, 1 tim
Esther est, esth
Ezekiel ezek, ez
2 John 2jn, 2-jn, 2_jn, 2 jn
1 John 1jn, 1-jn, 1_jn, 1 jn
Obadiah obad, ob
3 John 3jn, 3-jn, 3_jn, 3 jn
Habakkuk hab, hb
Nahum nah, na
Micah mic, mi
Job jb
Titus ti
James jas
Zechariah zech, zec, zach, zac
Matthew matt, mt
Philemon philem, phlm
Ephesians eph
Numbers num, nm
Jude
Jeremiah jer
1 Peter 1pet, 1pt, 1-pet, 1_pet, 1 pet
Hebrews heb, hebrew
Jonah jon
Amos am
Colossians col
Ezra
Philippians phil, philip
Revelation rev, apocalypse, apoc, rv, revelations
Galatians gal
Romans rom, roman
Acts actsoftheapostles, the acts, acts of the apostles, the acts of the apostles
Haggai hag, hg
Zephaniah zeph, zep
2 Thessalonians 2thess, 2thes, 2-thes, 2_thes, 2-thess, 2_thess, 2 thess, 2 thes
1 Thessalonians 1thess, 1thes, 1-thes, 1_thes, 1-thess, 1_thess, 1 thess, 1 thes
Genesis gen, gn
2 Kings 2kgs, 2-kgs, 2_kgs, 2 kgs
1 Kings 1kgs, 1-kgs, 1_kgs, 1 kgs
2 Peter 2pet, 2pt, 2-pet, 2_pet, 2 pet
2 Samuel 2sam, 2sm, 2_sam, 2-sam, 2 sam
The Doctrine and Covenants Official Declaration od, official declaration
The Doctrine and Covenants dc, d-c, d&c, d & c, doctrine and covenants
Book of Mormon (1981) Omni omn
Testimony of Three Witnesses three, 3witnesses
Mosiah
Helaman hel
Title Page ttl, ttlpg, title, title-page, title_page
Enos en
Mormon morm, mormon
1 Nephi 1-ne, 1_ne, 1ne, 1 ne
3 Nephi 3-ne, 3_ne, 3ne, 3 ne
Testimony of Eight Witnesses eight, 8witnesses
Words of Mormon w-of-m, wofm, w_of_m
Ether
Jacob jac
Moroni moro, moroni
4 Nephi 4-ne, 4_ne, 4ne, 4 ne
Alma
Jarom jar
2 Nephi 2-ne, 2_ne, 2ne, 2 ne
Lectures on Faith Lectures on Faith lof, l-o-f, l-of-f, loff, lectures
The Pearl of Great Price (1913) History js-h, jsh, js history, joseph smith history, js-hist, js hist
Abraham abr, fac-1, fac1, fac-2, fac2, fac-3, fac3
JST Matthew js-m, jsm, joseph smith matthew, jst matt, jst-matt, jst-matthew, js matthew
Moses
Articles of Faith a-of-f, a_of_f, aoff, the articles of faith

Examples

Wikitext Result Notes
{{LDS}} LDS Standard Works Not providing any parameters produces a link to the LDS standard works listed in the Mormonism portal on Wikisource
{{LDS|Helaman|helaman}} Helaman Cite to entire book
{{LDS|The First Book of Nephi|1ne}} The First Book of Nephi The display text parameter can be used to specify exactly how the book name is displayed
{{LDS|Eth.|Ether|12}} Eth. 12 Cite to entire chapter
{{LDS|Doctrine and Covenants|dc|130|11}} Doctrine and Covenants 130:11 Cite to specific verse
{{LDS|Eth.|Ether|12|4|6}} Eth. 12:4–6 Cite to consecutive range of verses simply by adding an end verse parameter (note the en dash automatically added between beginning and ending verses)
{{LDS|John|john|3|5|–14, 16|||y}} John 3:5–14, 16 Cite to nonconsecutive verses (note that the en dash must be manually included in this instance)
Some famous scriptures in Ether are {{LDS|Eth.|Ether|12|4|, 6|||y}}; {{LDS||ether|13|9}}; and {{LDS||ether|15|31}}.
Some famous scriptures in Ether are Eth. 12:4, 6; 13:9; and 15:31. Leave the display text parameter blank to only include the chapter/verse in the link
{{LDS|1 Ne.|1_ne|3|7|8|website=lds}}
1 Ne. 3:7–8 Include "website=lds" to link to the LDS Church's website (this simply calls the {{LDS/legacy}} template)

See also

  • The LDSverse module's test cases page has many more usage examples, including citations to the KJV, the Book of Mormon, the Doctrine and Covenants, the Pearl of Great Price, and the Lectures on Faith.
  • {{LDS/legacy}}
  • {{Bibleverse}}