Jump to content

Module:bibliography/documentation

Wiktionary වෙතින්

Language submodules

[සංස්කරණය]

Work in progress!
Stubby documentation.

The language submodules should return a table with two values. One, bib_ref, should be the title of the page that houses the bibliography which {{R}} will link to. The other, sources, should contain the bibliographic information of all the sources cited. Each source should be formatted as such.

[ID] = {
	[parameters] = values,
	...
},
  • The source ID is short string that is used to indicate a specific source or grouping, used as the second parameter by {{R}}. Note the following formatting guidelines:
    • The standard syntax preferable for the majority of source is Author:YEAR, e.g. Nakassis:2013 which will be displayed as ⟨Nakassis (2013)⟩. Note the year may be followed by a letter (a, b, etc.) if there are multiple works by the same author from the same year in the bibliography. Multiple authors should be separated by ampersands & and commas ,, e.g. Author, Author & Author:YEAR, although for works which multiple editors abbreviation are more common.
    • Abbreviations of the title, e.g. OED for the Oxford English Dictionary. This will be italicised and displayed on the bibliography page. You can also add a preceding author, e.g. Lejeune:Mémoires is displayed as ⟨Lejeune Mémoires⟩. The alias without the colon is generated automatically, hence it can be called by {{R}} simply as Lejeune Mémoires.
    • The caret ^ indicates that the following script should be in superscript. This is usually done for edition numbers, e.g. Documents^2 is displayed as ⟨Documents2⟩. The alias without the caret is generated automatically, hence it can be called simply as Documents2.
  • You can also use the parameter id to override the data table key if needed.
  • alias may be a single string or lists of strings. All the possible aliases that {{R}} may identify the source as.
  • title, formattable text.
  • author, formattable text, may be a list of authors.
    • If a table, alongside the all general parameters accepted by formattable text, you can also specify the parameter type for the author's role in the work, e.g. translator, editor, compiler, etc.
  • year, non-formattable text.
    • The value can be a range, like 1997-2006 or 1985-present.
  • published_year the year in which it was published, if for whatever reason differs from year.
  • first_edition the year in which the first edition of the work was published in.
  • location, formattable text, may be a list.
  • publisher, formattable text, may be a list.
    • If a university press, location is automatically assumed if this parameter's value is [location] UP.
  • edition, the cited edition number, e.g. 2nd.
  • volume, indicates the cited volume of a work.
    • Not to be confused with volumes, which is a list of the volumes of the cited work.
    • May be either simply a number or a table with the following parameters:
      • volume.number, non-formattable text.
      • volume.title, formattable text.
  • series, indicates the series the work belongs to.
    • series.name, the title of the series, mandatory, formattable text.
    • series.number, the number of the cited work within the series, non-formattable text.
  • chapter_of, indicates whether the cited work is just a chapter of a larger book.
    • The data here is just as any other source, as also the arguments transl_of and volumes do.
    • chapter_of.pages, the page range of the cited chapter, non-formattable text.
  • journal, indicates the journal the cited article belongs to.
    • journal.name, the title of the journal, mandatory, formattable text.
    • journal.number, the cited issue. May be either a single number or a list of two numbers (usually described as the volume and the number).
    • journal.pages, the page range of the article, non-formattable text.
  • transl_of, if the work is a translation, specify information of the original work under this one.
  • link, various links, e.g. link.isbn, link.ia, link.gb, link.url and more. The full list is at Module:bibliography/links.
  • volumes list of sources, indicates the volumes of the cited work.
    • Not to be confused with volume which indicates what the cited volume of a work.
    • Their syntax is the same as other sources, with the exception of number, which will be treated as if it was volume.number.
  • page_url, entry_url, section_url, etc. Various examples, because it is tiring to explain in detail:
    • page_url = { ia = true }, retrieves the Internet Archive ID from the link parameter and uses that as the page URL.
    • page_url = { ia = true, set_page = -3 }, if the cited page and the URL page differ by three.
    • page_url = { ia = true, set_page = "/2-3" }, if the cited page is twice the URL page, e.g. when the scan has two physical pages scanned together corresponding to one PDF page, and with an offset of 3.
    • page_url = { ia = true, set_page = "/2-3 >169+1 >229+1", if, for example, pages 168–169 and 228–229 are repeated in the scan.
    • If the work is divided into two on the Internet Archive at the page 500:
      page_url = {
      	ia = function(data)
      		if data.page < 500 then
      			return "first_id"
      		else
      			return "second_id"
      		end
      	end,
      	set_page = "> 500 - 500",
      	-- the latter could equivalently be written as
      	set_page = function(data)
      		if data.page < 500 then
      			return data.page
      		else
      			return data.page - 500
      		end
      	end,
      }
      
      • You can also specify set_entry or set_section etc.
      • The supported values inside of data are page, volume, entry, section and id (which is the entry ID specified by {{R}}, not to be confused with source ID).
      • In this example if statemets where used for better understandability, though for faster typing I suggest mastering the logic behind ternary operators.
    • entry_url = "http://www.nayiri.com/imagedDictionaryBrowser.jsp?dictionaryId=26&query=$ENTRY$". The parameters that can be specified in dollars are the same that are supported by the data parameter of the set_... functions (see above).
  • default_pagename = true, assumes the page's name is the name of the entry in the sourced text. In other words, this will automatically populate |entry= in {{R}}. It can be overriden with |entry=.
  • entry_lang, the language code that will be used to properly format the text of the entry cited.
  • import_from, the language code of the submodule to import the source from. If this parameter is given, no other parameter should be given.

Formattable text

[සංස්කරණය]
  • As a string, this are the syntax rules:
    • The pipe | indicates a link to Wikipedia, various examples:
      • Pedia|Display → [[w:Pedia|Display]]
      • |Display → [[w:Display|Display]]
      • es:|Display → [[w:es:Display|Display]]
    • Authors in the Western naming tradition should be specified as family name, given name[, suffix] and the pipe will automatically reorder them for the pedia link:
      • |Godart, Louis → [[w:Louis Godart|Godart, Louis]]
      • es:|Melena Jiménez, José Luis → [[w:es:José Luis Melena Jiménez|Melena Jiménez, José Luis]]
      • |Bennett, Emmett L., Jr. → [[w:Emmet L. Bennet Jr.|Bennett, Emmett L., Jr.]]
    • If only the initials have to be shown, but the full name is required for the Wikipedia link, use the full stop . syntax as follows:
      • |Palmer, L.eonard R.obert → [[w:Leonard Robert Palmer|Palmer, L. R.]]
    • A language code can be specified followed by a colon form proper display and/or transliteration, e.g.
      • hy:Նոր բառգիրք հայկազեան լեզուի → {{lang|hy|Նոր բառգիրք հայկազեան լեզուի}}
      • el:|el:Παπαδόπουλος, Άνθιμος → {{lang|el|[[w:el:Παπαδόπουλος, Άνθιμος|Άνθιμος Παπαδόπουλος]]}}.
      • Note the first language code in the last example is the Wikipedia prefix, while the second one is the one for proper display.
      • Note that even if no language is specified, the module will still try its best to assume what script the text is and format it accordingly.
  • Instead of a string, it can also be a table with the following parameters:
    • text (mandatory), the original text to format. It supports all the syntax shown above.
    • lang the language code. Equivalent to specifying it at the beginning of text followed by a colon.
    • pedia the Wikipedia page to link to. Equivalent to the pipe syntax.
    • translit the transliteration. May be either true, which generated the transliteration automatically if a language is specified, or a string with the hardcoded transliteration, for languages without transliteration. It will appear after the text in the original script unless translit_only (see below) is also specified.
    • translit_only if true suppresses the text in the original script and only shows the transliteration.
    • translation adds a translation alongside the original text, e.g. title = { text = "ota:قاموس تركی", translit = "kamus-ı türki", translation = "Dictionary of Turkish" }.
    • If there is a list of multiple formattable texts, general parameters are inherited, e.g. { "hy:Գաբրիել Ավետիքյան|hy:Աւետիքեան, Գ.աբրիէլ", "hy:Խաչատուր Սյուրմելյան|hy:Սիւրմէլեան, Խ.աչատուր", translit_only = true } applies the translit_only = true to all the texts in the list.

Common configurations

[සංස්කරණය]

Automatic entry linking

[සංස්කරණය]

The following snippets automatically link to the website's entry based on the page's name. Live examples: (jbo) L:2025, (eo) RV:1997

  • Outside of a function
    ...
    entry_url = {
    	url = "https://example.com/path/to/$ENTRY$",
    },
    default_pagename = true,
    ...
    
  • Within a function (your function may work differently, depending on the needs)
    ...
    entry_url = function(data)
    	if data.id then
    		return "https://example.com/path/to/" .. data.id
    	else
    		return "https://example.com/some/other/path/".. data.entry or data.pagename
    	end
    end,
    default_pagename = true,
    ...
    
"https://si.wiktionary.org/w/index.php?title=Module:bibliography/documentation&oldid=235828" වෙතින් සම්ප්‍රවේශනය කෙරිණි