Difference between pages "Template:CTD article" and "Module:SB"

From Teopedia library
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
<noinclude>This template is used by form {{f|ETG article}} to create or edit an article of ''[[Enlarged Theosophical Glossary]]''.
+
local sb = {} -- functions package for HPB Scrapbooks
  
* To create a new article use form {{f|ETG article}}.  
+
function sb.item_id( frame )
* Pages that use this template are placed in category {{c|ETG article}} and other categories, named in "categories" parameter.
+
local id = frame.args['volume'] .. '-' .. frame.args['page'] .. '-' .. frame.args['item']
 +
    return id
 +
end
  
{| class=wikitable
+
function sb.item_id2( frame )
|-
+
local vNum = string.format("%.2d", frame.args['volume'])
! width=230px | To copy
+
local iNum = string.format("%.2d", frame.args['item'])
! Description
+
--print(vNum)
|-valign=top
+
local p_int, p_frac = math.modf(frame.args['page'])
| <pre>
+
local pNum = string.format("%.3d", p_int) 
{{ETG article
+
if p_frac > 0 then
| term =
+
pNum = pNum .. '.' .. p_frac
| variations =
+
end
| transliteration SD =
+
| transliteration IAST =
+
--local id = string.format("%.2d", frame.args['volume']) .. '-' .. pNum .. '-' .. iNum
| origin =
+
local id = vNum .. '--' .. pNum .. '--' .. iNum
| description =
+
return id
| categories =
+
end
| related terms =
 
}}
 
</pre>
 
|
 
* '''term''' -- word or term, {{p|ETG term}}
 
* '''variations''' -- different spellings (list separated by ";"), {{p|ETG term variations}}
 
* '''transliteration SD''' -- how it is used in ''The Secret Doctrine'' (if used), {{p|ETG term SD}}
 
* '''transliteration IAST''' -- how it is spelled acording to [[wp:International Alphabet of Sanskrit Transliteration|International Alphabet of Sanskrit Transliteration]], {{p|ETG term IAST}}
 
* '''origin''' -- spelling on the original language and original meaning, {{p|ETG term origin}}
 
* '''description''' -- description of a term, the article itself, {{p|ETG term description}}
 
* '''categories''' -- list of categories where this term belongs or could be applied to (list separated by ";")
 
* '''related terms''' -- some terms the one is connected with (list separated by ";"), {{p|ETG term}}
 
|}
 
  
[[Category: Templates with forms]]
 
[[Category: Templates]]
 
</noinclude><includeonly><!--
 
 
    Links to the Form and Template -->
 
<div style="float: right; font-size: 80%; margin-right: 15px; margin-top: -5px;">[[Form:ETG article|F]] • [[Template:ETG article|T]]</div><!--
 
  
  CARD -->
+
return sb
<span style="font-variant: small-caps; font-weight: bold; ">[[ETG term::{{{term|}}}]]</span><!--
 
-->{{#if: {{{variations|}}}| {{#arraymap:{{{variations|}}}|;|@@|[[ETG term variations::@@]]|•}} |}}<!--
 
-->{{#if: {{{transliteration SD|}}}| • [[ETG term SD::{{{transliteration SD|}}}]][[Category: Terms from SD]] |}}<!--
 
-->{{#if: {{{transliteration IAST|}}}| • [[ETG term IAST::{{{transliteration IAST|}}}]] |}}<!--
 
--> ([[ETG term origin::{{{origin|}}}]]). [[ETG term description::{{{description|}}}]]
 
{{#if: {{{related terms|}}}| Related terms: {{#arraymap:{{{related terms|}}}|;|@@|[[ETG term::@@}}]] |}}<!--
 
 
 
    CATEGORIES -->
 
{{#arraymap:{{{categories|}}}|;|@@| [[Category:@@]] | }}
 
[[Category: ETG article]]
 
</includeonly>
 

Revision as of 12:20, 22 April 2021


Lua functions for HPB Scrapbooks.

Functions

item_id

Called from {{HPB-SB-item}} for setting semantic property [[HPB SB item ID]].

{{#invoke: SB | item_id | volume=1 | page=17 | item=4 }}

footnote

Called from {{HPB-SB-item}}.

{{#invoke: SB | footnote 
 | title=
 | author=
 | author_signed=
 | type= 
 | source_title=
 | source_details=
 | notes=
 | archivist_notes=
 | language = 
 | translator = 
}}


Debug example

=p.item_id{args={["volume"]="1",["page"]="17.2",["item"]="3"}}

Module code


local sb = {} -- functions package for HPB Scrapbooks

function sb.item_id( frame )
	local id = frame.args['volume'] .. '-' .. frame.args['page'] .. '-' .. frame.args['item']
    return id
end

function sb.item_id2( frame )
	local vNum = string.format("%.2d", frame.args['volume'])
	local iNum = string.format("%.2d", frame.args['item'])
	--print(vNum)
	local p_int, p_frac = math.modf(frame.args['page'])
	local pNum = string.format("%.3d", p_int)  
	if p_frac > 0 then
		pNum = pNum .. '.' .. p_frac
	end
	
	--local id = string.format("%.2d", frame.args['volume']) .. '-' .. pNum .. '-' .. iNum
	local id = vNum .. '--' .. pNum .. '--' .. iNum
	return id
end


return sb