Difference between pages "HPB-SB-2-34" and "Module:SB"

From Teopedia library
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
{{HPB-SB-header
+
local sb = {} -- functions package for HPB Scrapbooks
| volume = 2
 
| page = 34
 
| image = SB-02-034.jpg
 
| notes =
 
| prev = 33
 
| next = 35
 
}}
 
  
{{HPB-SB-item
+
function sb.item_id2( frame )
| volume = 2
+
local id = frame.args['volume'] .. '-' .. frame.args['page'] .. '-' .. frame.args['item']
| page = 34
+
    return id
| item = 1
+
end
| type = notice
 
| status = wanted
 
| continues =
 
| author =
 
| title = J. W. Bouton, bookseller
 
| subtitle =
 
| untitled = yes
 
| source title = Commercial Advertiser
 
| source details =
 
| publication date = 1877-06-23
 
| original date =
 
| notes =
 
| categories = About Isis Unveiled
 
}}
 
  
...
+
-- Create unique ID for the item, which consist of: Volume-Page-Item_on_page
 +
-- ID example: 01-017-03
 +
-- Call example: {{#invoke: SB | item_id | volume=1 | page=17 | item=3 }}
 +
-- Values: volume=1..99, page=1..999, item=1..99
 +
function sb.item_id( frame )
 +
local vNum = string.format("%.2d", frame.args['volume'])
 +
local iNum = string.format("%.2d", frame.args['item'])
 +
local p_int, p_frac = math.modf(frame.args['page'])
 +
local pNum = string.format("%.3d", p_int) 
  
 +
--mw.log('int= '.. p_int .. ', frac= ' .. p_frac)
 +
if p_frac > 0 then
 +
str = tostring(p_frac)
 +
pNum = pNum .. '.' .. string.sub(str,3,5)
 +
end
  
{{HPB-SB-item
+
local id = vNum .. '-' .. pNum .. '-' .. iNum
| volume = 2
+
return id
| page = 34
+
end
| item = 2
 
| type = notice
 
| status = wanted
 
| continues =
 
| author =
 
| title = The corresponding secretary
 
| subtitle =
 
| untitled = yes
 
| source title = Independent, The
 
| source details =
 
| publication date = 1877-09-21
 
| original date =
 
| notes =
 
| categories = About Isis Unveiled
 
}}
 
  
...
+
function sb.int2roman( arabic_number )
 +
local roman_number = mathroman.int2roman(arabic_number)
 +
    return roman_number
 +
end
  
 
+
return sb
{{HPB-SB-item
 
| volume = 2
 
| page = 34
 
| item = 3
 
| type = notice
 
| status = wanted
 
| continues =
 
| author =
 
| title = Madame Blavatsky's work
 
| subtitle =
 
| untitled = yes
 
| source title = Religio-Philosophical Journal
 
| source details =
 
| publication date =
 
| original date =
 
| notes =
 
| categories = About Isis Unveiled
 
}}
 
{{Style S-HPB SB. HPB note|The Rel. Phil. Journal Chicago|center}}
 
 
 
...
 
 
 
 
 
{{HPB-SB-item
 
| volume = 2
 
| page = 34
 
| item = 4
 
| type = notice
 
| status = wanted
 
| continues =
 
| author =
 
| title = J. W. Boughton (706 Broadway N. Y.)
 
| subtitle =
 
| untitled = yes
 
| source title = Plain Dealer, The
 
| source details =
 
| publication date = 1877-06-30
 
| original date =
 
| notes =
 
| categories = About Isis Unveiled
 
}}
 
 
 
...
 
 
 
 
 
{{HPB-SB-item
 
| volume = 2
 
| page = 34
 
| item = 5
 
| type = notice
 
| status = wanted
 
| continues =
 
| author =
 
| title = J. W. Bouton, of Broadway, New York
 
| subtitle =
 
| untitled = yes
 
| source title = Courier Journal
 
| source details = (Louisville)
 
| publication date = 1877-07-01
 
| original date =
 
| notes =
 
| categories = About Isis Unveiled
 
}}
 
{{Style S-HPB SB. HPB note|LOUISVILLE|center}}
 
 
 
...
 

Revision as of 18:33, 8 June 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_id2( frame )
	local id = frame.args['volume'] .. '-' .. frame.args['page'] .. '-' .. frame.args['item']
    return id
end

-- Create unique ID for the item, which consist of: Volume-Page-Item_on_page
-- ID example: 01-017-03
-- Call example: {{#invoke: SB | item_id | volume=1 | page=17 | item=3 }}
-- Values: volume=1..99, page=1..999, item=1..99
function sb.item_id( frame )
	local vNum = string.format("%.2d", frame.args['volume'])
	local iNum = string.format("%.2d", frame.args['item'])
	local p_int, p_frac = math.modf(frame.args['page'])
	local pNum = string.format("%.3d", p_int)  

	--mw.log('int= '.. p_int .. ', frac= ' .. p_frac)
	if p_frac > 0 then
		str = tostring(p_frac)
		pNum = pNum .. '.' .. string.sub(str,3,5)
	end

	local id = vNum .. '-' .. pNum .. '-' .. iNum
	return id
end

function sb.int2roman( arabic_number )
	local roman_number = mathroman.int2roman(arabic_number)
    return roman_number
end

return sb