<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.martinuswiki.dk/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wikiboteng%40Wikiboteng</id>
	<title>MartinusWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.martinuswiki.dk/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wikiboteng%40Wikiboteng"/>
	<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/wiki/Special:Contributions/Wikiboteng@Wikiboteng"/>
	<updated>2026-08-12T15:11:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://en.martinuswiki.dk/w/index.php?title=User:Lasse&amp;diff=74</id>
		<title>User:Lasse</title>
		<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/w/index.php?title=User:Lasse&amp;diff=74"/>
		<updated>2026-08-11T09:26:14Z</updated>

		<summary type="html">&lt;p&gt;Wikiboteng@Wikiboteng: Add test reference on User:Lasse&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi, I am Lasse :-)&lt;br /&gt;
&lt;br /&gt;
Check out my Youtube channel https://www.youtube.com/@theeternalworldpicture&lt;br /&gt;
&lt;br /&gt;
Test&lt;br /&gt;
&lt;br /&gt;
== Reference system test ==&lt;br /&gt;
&lt;br /&gt;
This is a test reference to Livets Bog, section 100.{{ref|100}}&lt;br /&gt;
&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Wikiboteng@Wikiboteng</name></author>
	</entry>
	<entry>
		<id>https://en.martinuswiki.dk/w/index.php?title=Help:References_to_Martinus_works&amp;diff=73</id>
		<title>Help:References to Martinus works</title>
		<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/w/index.php?title=Help:References_to_Martinus_works&amp;diff=73"/>
		<updated>2026-08-11T06:12:52Z</updated>

		<summary type="html">&lt;p&gt;Wikiboteng@Wikiboteng: Add English Martinus reference system (Stage 4)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains the English Martinus Wiki reference system. It uses the standard MediaWiki Cite extension: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; creates one numbered footnote, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{reflist}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; prints the notes.&lt;br /&gt;
&lt;br /&gt;
== Quick start ==&lt;br /&gt;
&lt;br /&gt;
Put a reference immediately after the claim it supports:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Livets Bog section 100{{ref|100}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the end of the article add:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;== References ==&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{reflist}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The template is only a wrapper. The validation and URL routing are in [[Module:Reference]]. Invalid references show a concise error and add [[:Category:Pages with Martinus reference errors]]; they must be fixed before saving.&lt;br /&gt;
&lt;br /&gt;
== Livets Bog (The Book of Life) ==&lt;br /&gt;
&lt;br /&gt;
An unqualified number uses the official section ranges to select a volume:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|100}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Livets Bog 1, section 100.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|2658|1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Livets Bog 7, section 2658, subsection 1. Livets Bog 7 is currently linked to the Danish original because an English text is not confirmed.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|e}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — the Livets Bog 7 epilogue, with the same explicit Danish fallback.&lt;br /&gt;
&lt;br /&gt;
Use an explicit volume when that is clearer. The aliases &amp;lt;code&amp;gt;LB1&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;LB7&amp;lt;/code&amp;gt; are accepted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|LB1|100}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|work=LB2|section=607}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Livets Bog 1–5 link to the English online-library text. LB6–7 are retained for compatibility and say “Danish original; no English translation confirmed” in the note.&lt;br /&gt;
&lt;br /&gt;
== The Eternal World Picture (symbol books) ==&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;TEWP&amp;lt;/code&amp;gt; (English) or the Danish-compatible alias &amp;lt;code&amp;gt;DEV&amp;lt;/code&amp;gt;, followed by the volume and section:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|TEWP 2|17.11}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|DEV 2|17.11}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The English online library currently provides volumes 1–4. Volumes 5–6 are accepted but use an explicit Danish fallback.&lt;br /&gt;
&lt;br /&gt;
== Short books ==&lt;br /&gt;
&lt;br /&gt;
The English alias &amp;lt;code&amp;gt;short book&amp;lt;/code&amp;gt; and Danish-compatible aliases &amp;lt;code&amp;gt;småbog&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;smabog&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;pamphlet&amp;lt;/code&amp;gt; are accepted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|short book 22|1.3}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The note links to the precise passage in the official Danish online library and says that an English translation is not confirmed. This is intentional: no English short-book URL is assumed.&lt;br /&gt;
&lt;br /&gt;
== Symbols, articles, lectures, and Kosmos ==&lt;br /&gt;
&lt;br /&gt;
Use a named source kind for these families:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|kind=symbol|1}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|kind=article|0010}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|kind=lecture|67}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|kind=kosmos|2021-2 &amp;quot;Article title&amp;quot;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Symbols link to the official English symbol page. Articles link to the English online library with the four-digit ID; the note says “English online text if available” because availability varies. Lectures have an explicit Danish fallback. Kosmos notes preserve the supplied bibliographic text and explicitly state that no direct online-library link is confirmed.&lt;br /&gt;
&lt;br /&gt;
The long-standing positional forms are also accepted: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|symbol|1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|article|0010}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|lecture|67}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ref|kosmos|2021-2 &amp;quot;Article title&amp;quot;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Invalid references ==&lt;br /&gt;
&lt;br /&gt;
Malformed or incomplete input is never silently discarded. For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|TEWP 2}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|article|10}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{ref|100|unexpected|third|fourth}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These display a deterministic “Reference error: …” message in preview and add the maintenance category. Correct the citation rather than replacing it with an invented URL.&lt;br /&gt;
&lt;br /&gt;
== Other sources ==&lt;br /&gt;
&lt;br /&gt;
For a source that is not a Martinus work, use Cite directly rather than `{{ref}}`:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;ref&amp;gt;E. Miller, &#039;&#039;The Sun&#039;&#039;, Academic Press, 2005, pp. 23–25.&amp;lt;/ref&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This keeps generic references independent of the Martinus routing table. The system requires the Cite extension before it can be published; Stage 2 will validate every example with MediaWiki `action=parse`.&lt;/div&gt;</summary>
		<author><name>Wikiboteng@Wikiboteng</name></author>
	</entry>
	<entry>
		<id>https://en.martinuswiki.dk/w/index.php?title=Template:Reflist&amp;diff=72</id>
		<title>Template:Reflist</title>
		<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/w/index.php?title=Template:Reflist&amp;diff=72"/>
		<updated>2026-08-11T06:12:49Z</updated>

		<summary type="html">&lt;p&gt;Wikiboteng@Wikiboteng: Add English Martinus reference system (Stage 4)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikiboteng@Wikiboteng</name></author>
	</entry>
	<entry>
		<id>https://en.martinuswiki.dk/w/index.php?title=Template:Ref&amp;diff=71</id>
		<title>Template:Ref</title>
		<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/w/index.php?title=Template:Ref&amp;diff=71"/>
		<updated>2026-08-11T06:12:47Z</updated>

		<summary type="html">&lt;p&gt;Wikiboteng@Wikiboteng: Add English Martinus reference system (Stage 4)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- p.ref reads this template frame directly and creates the Cite extension&lt;br /&gt;
     tag through frame:extensionTag, so nested parser markup cannot lose args. --&amp;gt;&lt;br /&gt;
{{#invoke:Reference|ref}}&lt;/div&gt;</summary>
		<author><name>Wikiboteng@Wikiboteng</name></author>
	</entry>
	<entry>
		<id>https://en.martinuswiki.dk/w/index.php?title=Module:Reference&amp;diff=70</id>
		<title>Module:Reference</title>
		<link rel="alternate" type="text/html" href="https://en.martinuswiki.dk/w/index.php?title=Module:Reference&amp;diff=70"/>
		<updated>2026-08-11T06:12:44Z</updated>

		<summary type="html">&lt;p&gt;Wikiboteng@Wikiboteng: Add English Martinus reference system (Stage 4)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-- English Martinus Wiki reference renderer.&lt;br /&gt;
--&lt;br /&gt;
-- Stage 1 source artifact.  This module deliberately contains the routing and&lt;br /&gt;
-- validation policy in one small, data-driven module so it can be copied to&lt;br /&gt;
-- Module:Reference after Scribunto is enabled.  It does not call ParserFunctions.&lt;br /&gt;
-- The public entry points are p.ref (the template wrapper) and p.render (a&lt;br /&gt;
-- direct module entry point); all state is local to an invocation.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local EN_TTT = &amp;quot;https://www.martinus.dk/en/online-library/ttt/index.php&amp;quot;&lt;br /&gt;
local DA_TTT = &amp;quot;https://www.martinus.dk/da/onlinebibliotek/dtt/index.php&amp;quot;&lt;br /&gt;
local EN_SYMBOLS = &amp;quot;https://www.martinus.dk/en/online-library/symbols/index.php&amp;quot;&lt;br /&gt;
local DA_LECTURES = &amp;quot;https://www.martinus.dk/da/onlinebibliotek/foredrag/index.php&amp;quot;&lt;br /&gt;
local ERROR_CATEGORY = &amp;quot;[[Category:Pages with Martinus reference errors]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-- The section ranges are the ranges shown by the official online library.  LB6&lt;br /&gt;
-- and LB7 are retained for compatibility, but their English flag is false until&lt;br /&gt;
-- an English text is confirmed by the Institute.&lt;br /&gt;
local BOOKS = {&lt;br /&gt;
    LB1 = { id = 51, title = &amp;quot;Livets Bog 1&amp;quot;, first = 1, last = 288, english = true },&lt;br /&gt;
    LB2 = { id = 52, title = &amp;quot;Livets Bog 2&amp;quot;, first = 289, last = 638, english = true },&lt;br /&gt;
    LB3 = { id = 53, title = &amp;quot;Livets Bog 3&amp;quot;, first = 639, last = 1052, english = true },&lt;br /&gt;
    LB4 = { id = 54, title = &amp;quot;Livets Bog 4&amp;quot;, first = 1053, last = 1590, english = true },&lt;br /&gt;
    LB5 = { id = 55, title = &amp;quot;Livets Bog 5&amp;quot;, first = 1591, last = 1938, english = true },&lt;br /&gt;
    LB6 = { id = 56, title = &amp;quot;Livets Bog 6&amp;quot;, first = 1939, last = 2395, english = false },&lt;br /&gt;
    LB7 = { id = 57, title = &amp;quot;Livets Bog 7&amp;quot;, first = 2396, last = 2664, english = false },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local TEWP = {&lt;br /&gt;
    [1] = { id = 61, title = &amp;quot;The Eternal World Picture 1&amp;quot;, english = true },&lt;br /&gt;
    [2] = { id = 62, title = &amp;quot;The Eternal World Picture 2&amp;quot;, english = true },&lt;br /&gt;
    [3] = { id = 63, title = &amp;quot;The Eternal World Picture 3&amp;quot;, english = true },&lt;br /&gt;
    [4] = { id = 64, title = &amp;quot;The Eternal World Picture 4&amp;quot;, english = true },&lt;br /&gt;
    [5] = { id = 65, title = &amp;quot;The Eternal World Picture 5&amp;quot;, english = false },&lt;br /&gt;
    [6] = { id = 66, title = &amp;quot;The Eternal World Picture 6&amp;quot;, english = false },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local ALLOWED = {&lt;br /&gt;
    [&amp;quot;1&amp;quot;] = true, [&amp;quot;2&amp;quot;] = true, [&amp;quot;3&amp;quot;] = true, [&amp;quot;4&amp;quot;] = true,&lt;br /&gt;
    [&amp;quot;5&amp;quot;] = true, [&amp;quot;6&amp;quot;] = true, [&amp;quot;7&amp;quot;] = true, [&amp;quot;8&amp;quot;] = true,&lt;br /&gt;
    [&amp;quot;9&amp;quot;] = true, [&amp;quot;10&amp;quot;] = true,&lt;br /&gt;
    work = true, source = true, section = true, subsection = true,&lt;br /&gt;
    kind = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function trim(value)&lt;br /&gt;
    if value == nil then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    value = tostring(value):gsub(&amp;quot;^%s+&amp;quot;, &amp;quot;&amp;quot;):gsub(&amp;quot;%s+$&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    if value == &amp;quot;&amp;quot; then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function text(value)&lt;br /&gt;
    -- All values that reach this helper have already passed a strict grammar,&lt;br /&gt;
    -- except Kosmos text.  mw.text.encode prevents that free text becoming HTML.&lt;br /&gt;
    return mw.text.encode(tostring(value))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function error_message(code, detail)&lt;br /&gt;
    local suffix = detail and (&amp;quot; (&amp;quot; .. text(detail) .. &amp;quot;)&amp;quot;) or &amp;quot;&amp;quot;&lt;br /&gt;
    return &#039;&amp;lt;span class=&amp;quot;error reference-error&amp;quot;&amp;gt;Reference error: &#039; .. code .. suffix .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot; .. ERROR_CATEGORY&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function link(url, label)&lt;br /&gt;
    return &amp;quot;[&amp;quot; .. url .. &amp;quot; &amp;quot; .. text(label) .. &amp;quot;]&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function is_integer(value)&lt;br /&gt;
    return value ~= nil and value:match(&amp;quot;^[1-9]%d*$&amp;quot;) ~= nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function is_decimal_section(value)&lt;br /&gt;
    return value ~= nil and value:match(&amp;quot;^[1-9]%d*%.[1-9]%d*$&amp;quot;) ~= nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function source_suffix(book)&lt;br /&gt;
    if book.english then&lt;br /&gt;
        return &amp;quot;English online text&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    return &amp;quot;Danish original; no English translation confirmed&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function book_url(book, section, subsection)&lt;br /&gt;
    local base = book.english and EN_TTT or DA_TTT&lt;br /&gt;
    local mode = section and (book.english and &amp;quot;opslag&amp;quot; or &amp;quot;forside&amp;quot;) or &amp;quot;forside&amp;quot;&lt;br /&gt;
    local url = base .. &amp;quot;?bog=&amp;quot; .. book.id .. &amp;quot;&amp;amp;mode=&amp;quot; .. mode&lt;br /&gt;
    if section then&lt;br /&gt;
        url = url .. &amp;quot;&amp;amp;stk=&amp;quot; .. section&lt;br /&gt;
    end&lt;br /&gt;
    if subsection then&lt;br /&gt;
        url = url .. &amp;quot;&amp;amp;pkt=&amp;quot; .. subsection&lt;br /&gt;
    end&lt;br /&gt;
    return url&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function book_reference(book, section, subsection)&lt;br /&gt;
    if not book then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    if section and not is_integer(section) then&lt;br /&gt;
        return nil, &amp;quot;INVALID_SECTION&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if subsection and not is_integer(subsection) then&lt;br /&gt;
        return nil, &amp;quot;INVALID_SUBSECTION&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if subsection and not section then&lt;br /&gt;
        return nil, &amp;quot;MISSING_SECTION&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if section then&lt;br /&gt;
        local number = tonumber(section)&lt;br /&gt;
        if number &amp;lt; book.first or number &amp;gt; book.last then&lt;br /&gt;
            return nil, &amp;quot;SECTION_OUT_OF_RANGE&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    local label = book.title&lt;br /&gt;
    if section then&lt;br /&gt;
        label = label .. &amp;quot;, section &amp;quot; .. section&lt;br /&gt;
        if subsection then&lt;br /&gt;
            label = label .. &amp;quot;, subsection &amp;quot; .. subsection&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        label = label .. &amp;quot; (book)&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    local url = book_url(book, section, subsection)&lt;br /&gt;
    return link(url, label .. &amp;quot; — &amp;quot; .. source_suffix(book))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function find_book_for_section(section)&lt;br /&gt;
    local number = tonumber(section)&lt;br /&gt;
    for _, key in ipairs({ &amp;quot;LB1&amp;quot;, &amp;quot;LB2&amp;quot;, &amp;quot;LB3&amp;quot;, &amp;quot;LB4&amp;quot;, &amp;quot;LB5&amp;quot;, &amp;quot;LB6&amp;quot;, &amp;quot;LB7&amp;quot; }) do&lt;br /&gt;
        local book = BOOKS[key]&lt;br /&gt;
        if number &amp;gt;= book.first and number &amp;lt;= book.last then&lt;br /&gt;
            return book&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function normalise_work(value)&lt;br /&gt;
    local upper = value:upper():gsub(&amp;quot;%s+&amp;quot;, &amp;quot; &amp;quot;)&lt;br /&gt;
    local lb = upper:match(&amp;quot;^(LB[1-7])$&amp;quot;)&lt;br /&gt;
    if lb then&lt;br /&gt;
        return &amp;quot;LB&amp;quot;, tonumber(lb:sub(3))&lt;br /&gt;
    end&lt;br /&gt;
    local tewp = upper:match(&amp;quot;^TEWP%s+([1-6])$&amp;quot;)&lt;br /&gt;
        or upper:match(&amp;quot;^DEV%s+([1-6])$&amp;quot;)&lt;br /&gt;
        or upper:match(&amp;quot;^THE ETERNAL WORLD PICTURE%s+([1-6])$&amp;quot;)&lt;br /&gt;
    if tewp then&lt;br /&gt;
        return &amp;quot;TEWP&amp;quot;, tonumber(tewp)&lt;br /&gt;
    end&lt;br /&gt;
    local short = upper:match(&amp;quot;^SHORT BOOK%s+([1-9]%d*)$&amp;quot;)&lt;br /&gt;
        or upper:match(&amp;quot;^SMÅBOG%s+([1-9]%d*)$&amp;quot;)&lt;br /&gt;
        or upper:match(&amp;quot;^SMABOG%s+([1-9]%d*)$&amp;quot;)&lt;br /&gt;
        or upper:match(&amp;quot;^PAMPHLET%s+([1-9]%d*)$&amp;quot;)&lt;br /&gt;
    if short then&lt;br /&gt;
        return &amp;quot;SHORT&amp;quot;, tonumber(short)&lt;br /&gt;
    end&lt;br /&gt;
    return upper&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function collect_args(argument_frame)&lt;br /&gt;
    local values = {}&lt;br /&gt;
    -- p.ref passes the Template:Ref frame explicitly. This is important:&lt;br /&gt;
    -- putting #invoke inside literal &amp;lt;ref&amp;gt; markup creates another parser frame&lt;br /&gt;
    -- and loses the template arguments. Reading this exact frame also keeps&lt;br /&gt;
    -- every argument visible to validation, including unknown names.&lt;br /&gt;
    if not argument_frame then&lt;br /&gt;
        return nil, &amp;quot;MISSING_PRIMARY_ARGUMENT&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    for key, raw in pairs(argument_frame.args or {}) do&lt;br /&gt;
        local name = tostring(key)&lt;br /&gt;
        local value = trim(raw)&lt;br /&gt;
        if value ~= nil then&lt;br /&gt;
            if not ALLOWED[name] then&lt;br /&gt;
                return nil, &amp;quot;UNSUPPORTED_ARGUMENT&amp;quot;, name&lt;br /&gt;
            end&lt;br /&gt;
            values[name] = value&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return values&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function positional(values)&lt;br /&gt;
    local result = {}&lt;br /&gt;
    for index = 1, 10 do&lt;br /&gt;
        if values[tostring(index)] ~= nil then&lt;br /&gt;
            result[index] = values[tostring(index)]&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    for index = 2, 10 do&lt;br /&gt;
        if result[index] ~= nil and result[index - 1] == nil then&lt;br /&gt;
            return nil, &amp;quot;MISSING_PRIMARY_ARGUMENT&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    for index = 4, 10 do&lt;br /&gt;
        if result[index] ~= nil then&lt;br /&gt;
            return nil, &amp;quot;TOO_MANY_POSITIONAL_ARGUMENTS&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function render_book(work, section, subsection)&lt;br /&gt;
    local family, volume = normalise_work(work)&lt;br /&gt;
    if family == &amp;quot;LB&amp;quot; then&lt;br /&gt;
        local book = BOOKS[&amp;quot;LB&amp;quot; .. volume]&lt;br /&gt;
        if not book then&lt;br /&gt;
            return nil, &amp;quot;UNKNOWN_VOLUME&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        return book_reference(book, section, subsection)&lt;br /&gt;
    end&lt;br /&gt;
    if family == &amp;quot;TEWP&amp;quot; then&lt;br /&gt;
        local book = TEWP[volume]&lt;br /&gt;
        if not book then&lt;br /&gt;
            return nil, &amp;quot;UNKNOWN_VOLUME&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if subsection then&lt;br /&gt;
            return nil, &amp;quot;TOO_MANY_SOURCE_ARGUMENTS&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if not section or not is_decimal_section(section) then&lt;br /&gt;
            return nil, &amp;quot;INVALID_SYMBOL_SECTION&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        local base = book.english and EN_TTT or DA_TTT&lt;br /&gt;
        local url = base .. &amp;quot;?bog=&amp;quot; .. book.id .. &amp;quot;&amp;amp;mode=opslag&amp;amp;pkt=&amp;quot; .. section:match(&amp;quot;%d+$&amp;quot;) .. &amp;quot;&amp;amp;stk=&amp;quot; .. section:match(&amp;quot;^%d+&amp;quot;)&lt;br /&gt;
        return link(url, book.title .. &amp;quot;, section &amp;quot; .. section .. &amp;quot; — &amp;quot; .. source_suffix(book))&lt;br /&gt;
    end&lt;br /&gt;
    if family == &amp;quot;SHORT&amp;quot; then&lt;br /&gt;
        if subsection then&lt;br /&gt;
            return nil, &amp;quot;TOO_MANY_SOURCE_ARGUMENTS&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        if not section or not is_decimal_section(section) then&lt;br /&gt;
            return nil, &amp;quot;INVALID_SHORT_BOOK_SECTION&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        local chapter, passage = section:match(&amp;quot;^(%d+)%.(%d+)$&amp;quot;)&lt;br /&gt;
        local url = DA_TTT .. &amp;quot;?bog=&amp;quot; .. volume .. &amp;quot;&amp;amp;art=&amp;quot; .. chapter .. &amp;quot;&amp;amp;stk=&amp;quot; .. passage&lt;br /&gt;
        return link(url, &amp;quot;Short book &amp;quot; .. volume .. &amp;quot;, section &amp;quot; .. section .. &amp;quot; — Danish original; English translation not confirmed&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    return nil, &amp;quot;UNKNOWN_WORK&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function render_special(kind, value)&lt;br /&gt;
    local lowered = kind:lower()&lt;br /&gt;
    if lowered == &amp;quot;symbol&amp;quot; or lowered == &amp;quot;symbols&amp;quot; then&lt;br /&gt;
        if not is_integer(value) or tonumber(value) &amp;gt; 100 then&lt;br /&gt;
            return nil, &amp;quot;INVALID_SYMBOL_ID&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        return link(EN_SYMBOLS .. &amp;quot;?symbol=&amp;quot; .. value, &amp;quot;Symbol &amp;quot; .. value .. &amp;quot; — English symbol page&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if lowered == &amp;quot;article&amp;quot; or lowered == &amp;quot;articles&amp;quot; then&lt;br /&gt;
        if not value or value:match(&amp;quot;^%d%d%d%d$&amp;quot;) == nil then&lt;br /&gt;
            return nil, &amp;quot;INVALID_ARTICLE_ID&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        return link(EN_TTT .. &amp;quot;?art=&amp;quot; .. value .. &amp;quot;&amp;amp;mode=artikelopslag&amp;quot;, &amp;quot;Article &amp;quot; .. value .. &amp;quot; — English online text if available&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if lowered == &amp;quot;lecture&amp;quot; or lowered == &amp;quot;lectures&amp;quot; or lowered == &amp;quot;foredrag&amp;quot; then&lt;br /&gt;
        if not is_integer(value) then&lt;br /&gt;
            return nil, &amp;quot;INVALID_LECTURE_ID&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        return link(DA_LECTURES .. &amp;quot;?nr=&amp;quot; .. value, &amp;quot;Lecture &amp;quot; .. value .. &amp;quot; — Danish original; English translation not confirmed&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if lowered == &amp;quot;kosmos&amp;quot; then&lt;br /&gt;
        if not value then&lt;br /&gt;
            return nil, &amp;quot;MISSING_KOSMOS_DESCRIPTION&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        return text(&amp;quot;Kosmos: &amp;quot; .. value .. &amp;quot; — Danish original; no direct online-library link confirmed&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    return nil, &amp;quot;UNKNOWN_SOURCE_KIND&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function render_reference(argument_frame)&lt;br /&gt;
    local values, collect_error, collect_detail = collect_args(argument_frame)&lt;br /&gt;
    if not values then&lt;br /&gt;
        return error_message(collect_error, collect_detail)&lt;br /&gt;
    end&lt;br /&gt;
    local pos, positional_error = positional(values)&lt;br /&gt;
    if not pos then&lt;br /&gt;
        return error_message(positional_error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local work = values.work or values.source&lt;br /&gt;
    local section = values.section&lt;br /&gt;
    local subsection = values.subsection&lt;br /&gt;
    local kind = values.kind&lt;br /&gt;
&lt;br /&gt;
    if values.work and values.source then&lt;br /&gt;
        return error_message(&amp;quot;DUPLICATE_WORK_ARGUMENTS&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if values.section and pos[2] then&lt;br /&gt;
        return error_message(&amp;quot;DUPLICATE_SECTION_ARGUMENT&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    if values.subsection and pos[3] then&lt;br /&gt;
        return error_message(&amp;quot;DUPLICATE_SUBSECTION_ARGUMENT&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if kind then&lt;br /&gt;
        if pos[2] or pos[3] or work or section or subsection then&lt;br /&gt;
            return error_message(&amp;quot;MIXED_REFERENCE_FORMS&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        local special_result, special_error = render_special(kind, pos[1] or values[&amp;quot;1&amp;quot;])&lt;br /&gt;
        if not special_result then&lt;br /&gt;
            return error_message(special_error)&lt;br /&gt;
        end&lt;br /&gt;
        return special_result&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if work and pos[1] then&lt;br /&gt;
        return error_message(&amp;quot;MIXED_REFERENCE_FORMS&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if work then&lt;br /&gt;
        section = section or pos[2]&lt;br /&gt;
        subsection = subsection or pos[3]&lt;br /&gt;
    else&lt;br /&gt;
        work = pos[1]&lt;br /&gt;
        section = section or pos[2]&lt;br /&gt;
        subsection = subsection or pos[3]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if not work then&lt;br /&gt;
        return error_message(&amp;quot;MISSING_PRIMARY_ARGUMENT&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if is_integer(work) then&lt;br /&gt;
        if section and subsection then&lt;br /&gt;
            return error_message(&amp;quot;DUPLICATE_SUBSECTION_ARGUMENT&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        if section and not is_integer(section) then&lt;br /&gt;
            return error_message(&amp;quot;INVALID_SUBSECTION&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        local book = find_book_for_section(work)&lt;br /&gt;
        if not book then&lt;br /&gt;
            return error_message(&amp;quot;SECTION_OUT_OF_RANGE&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        -- For numeric shorthand the second value is the subsection.  Accept&lt;br /&gt;
        -- either positional 2 or the named subsection form, but never discard&lt;br /&gt;
        -- a third positional value.&lt;br /&gt;
        local numeric_subsection = subsection or section&lt;br /&gt;
        local result, render_error = book_reference(book, work, numeric_subsection)&lt;br /&gt;
        if not result then&lt;br /&gt;
            return error_message(render_error)&lt;br /&gt;
        end&lt;br /&gt;
        return result&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if work:lower() == &amp;quot;e&amp;quot; or work:lower() == &amp;quot;epilogue&amp;quot; then&lt;br /&gt;
        if section or subsection then&lt;br /&gt;
            return error_message(&amp;quot;UNEXPECTED_EPILOGUE_ARGUMENT&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        local book = BOOKS.LB7&lt;br /&gt;
        return link(book_url(book, &amp;quot;2665&amp;quot;), &amp;quot;Livets Bog 7, epilogue (section 2665) — Danish original; no English translation confirmed&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local special_kind = work:lower()&lt;br /&gt;
    if special_kind == &amp;quot;symbol&amp;quot; or special_kind == &amp;quot;symbols&amp;quot;&lt;br /&gt;
        or special_kind == &amp;quot;article&amp;quot; or special_kind == &amp;quot;articles&amp;quot;&lt;br /&gt;
        or special_kind == &amp;quot;lecture&amp;quot; or special_kind == &amp;quot;lectures&amp;quot;&lt;br /&gt;
        or special_kind == &amp;quot;foredrag&amp;quot; or special_kind == &amp;quot;kosmos&amp;quot; then&lt;br /&gt;
        if subsection then&lt;br /&gt;
            return error_message(&amp;quot;TOO_MANY_SOURCE_ARGUMENTS&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
        local special_result, special_error = render_special(work, section)&lt;br /&gt;
        if not special_result then&lt;br /&gt;
            return error_message(special_error)&lt;br /&gt;
        end&lt;br /&gt;
        return special_result&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local result, render_error = render_book(work, section, subsection)&lt;br /&gt;
    if not result then&lt;br /&gt;
        return error_message(render_error)&lt;br /&gt;
    end&lt;br /&gt;
    return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.render(frame)&lt;br /&gt;
    return render_reference(frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.ref(frame)&lt;br /&gt;
    local parent = frame and frame:getParent()&lt;br /&gt;
    local content = render_reference(parent)&lt;br /&gt;
    local has_error_category = content:sub(-#ERROR_CATEGORY) == ERROR_CATEGORY&lt;br /&gt;
    if has_error_category then&lt;br /&gt;
        -- Category links inside a Cite extension tag are not reliably attached&lt;br /&gt;
        -- to the page. Keep the error text in the note, but emit the marker&lt;br /&gt;
        -- outside the tag so the maintenance category is authoritative.&lt;br /&gt;
        content = content:sub(1, -#ERROR_CATEGORY - 1)&lt;br /&gt;
    end&lt;br /&gt;
    local reference = frame:extensionTag(&amp;quot;ref&amp;quot;, content)&lt;br /&gt;
    if has_error_category then&lt;br /&gt;
        reference = reference .. ERROR_CATEGORY&lt;br /&gt;
    end&lt;br /&gt;
    return reference&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikiboteng@Wikiboteng</name></author>
	</entry>
</feed>