Module:quoteHerodotus

Από Βικιλεξικό
Μετάβαση στην πλοήγηση Πήδηση στην αναζήτηση

Module:quoteHerodotus >> Module:quoteHerodotus   << Module:quoteHerodotus/τεκμηρίωση
Module:quoteHerodotus >> Πρότυπο:ΠΘ:Ηρ


-- [[Template:ΠΘ:Ηρ]] links to el.wikisource e.g. Ιστορίαι (Ηροδότου)/Κλειώ#2  or #3.1

local export = {}

-- Errors -- use it with writing: if blahblah then return errorhere('xxxxxx') end
errorhere = function(errstring)
    return '<div class="error">' .. errstring .. '</div>'
end

function export.herodotus (frame)
	local args = frame:getParent().args	-- for Templates

-- nocat,  Categories, cf bottom of module
no_author_work = args['000'] or ''
local output_preliminaries = '' -- symbol for quotation & author_year century or year
	if args['000'] == '-' or args['0'] == '-' then output_preliminaries = '' else
	output_preliminaries = '<span title="παράθεμα από πρωτότυπο κείμενο" style="cursor:help;">&#8251; </span> <span style="color:#006666; cursor:help;" title="προ Χριστού - προ κοινής εποχής - BC - BCE"><b>5ος</b>&uarr;</span> αιώνας &nbsp;'
	end
-- author = is always Herodotus (Ηρόδοτος, polytonic: Ἡρόδοτος]]), +author_wp link to wikipedia, plus link to our Library
local output_author = ''
	if args['000'] == '-' then output_author = '' else
	output_author = '[[Βικιλεξικό:Βιβλιοθήκη (αρχαία ελληνικά)#Hdt|&#8984;]] [[:el:w:Ηρόδοτος|<span style="background:#f7f7f7;" title="Ηρόδοτος στη Βικιπαίδεια">Ἡρόδοτος</span>]]'
	end
-- work = is always Histories (Ιστορίαι, polytonic: Ἱστορίαι), +work_wp link to wikipedia
local output_work = ''
	if args['000'] == '-' then output_work = '' else
	output_work =  ', [[:el:w:Ηροδότου Ιστορίαι|<span style="background:#f7f7f7;" title="Ηροδότου Ιστορίαι στη Βικιπαίδεια"><i>Ἱστορίαι</i></span>]]'
	end
-- work_ws link to wikisource
local output_source_comma = ''
	if args['000'] == '-' then output_source_comma = '' else
	output_source_comma = ', '
	end
local output_source = ''
local output_chapter = ''
local output_verse = ''
-- show = text for link
local output_trans = ''		-- for translations at greek-language.gr

local chapter = args['1'] or ''
local chapter_number = ''
local descr = args['subtitle'] or args['υπότιτλος'] or ''
local verse = args['2'] or ''
local show_verse = args['3'] or ''
local mypassage = args['vv'] or args['στίχοι'] or ''
-- translation params as in Module:quote
local mytrans_id = args['μτφ'] or args['p'] or ''		-- id number of page at greek-language.gr
	args['μτφ'] = args['μτφ'] or ''
local mytrans_hi = args['hi'] or args['φ'] or ''			-- highlight number φ = φωτισμένο
	args['hi'] = args['hi'] or ''
local param_trans_text = args['ram_trans_text'] or  ''
	args['ram_trans_text'] = args['ram_trans_text'] or  ''

local param_trans_address = 'Αθήνα:Γκοβόστης [https://www.greek-language.gr/digitalResources/ancient_greek/library/browse.html?text_id=30&page='
			.. mytrans_id .. '&hi=' .. mytrans_hi .. ' @greek&#8209;language.gr]</small>'
-- data checked 2023
-- Λεωνίδας Ζενάκος = https://biblionet.gr/%CF%80%CF%81%CE%BF%CF%83%CF%89%CF%80%CE%BF/?personid=10918
-- Ηλίας Σπυρόπουλος = https://biblionet.gr/%cf%80%cf%81%ce%bf%cf%83%cf%89%cf%80%ce%bf/?personid=5758

-- chapters: convert numbers of chapters to wikisource titles of pages like Ιστορίαι (Ηροδότου)/Κλειώ
	if args['1'] == '1' or args['1'] == 'α' or args['1'] == 'Α'  or args['1'] == 'Κλειώ' then chapter = 'Κλειώ' chapter_number = '1'
		if descr == '-' then descr = '' else descr=' (Κλειώ)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1964): ' 
			.. '[[:el:w:Δημήτρης Μαρωνίτης|<span style="background:#f7f7f7;" title="Δημήτρης Μαρωνίτης στη Βικιπαίδεια">Δημήτρης Ν. Μαρωνίτης]] '
			.. param_trans_address end
	end
	if args['1'] == '2' or args['1'] == 'β' or args['1'] == 'Β'  or args['1'] == 'Ευτέρπη' then chapter = 'Ευτέρπη' chapter_number = '2'
		if descr == '-' then descr = '' else descr=' (Εὐτέρπη)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1992): Λεωνίδας Ζενάκος ' .. param_trans_address  end
	end
	if args['1'] == '3' or args['1'] == 'γ' or args['1'] == 'Γ'  or args['1'] == 'Θάλεια' then chapter = 'Θάλεια' chapter_number = '3'
		if descr == '-' then descr = '' else descr=' (Θάλεια)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1992): Λεωνίδας Ζενάκος. ' .. param_trans_address end
	end
	if args['1'] == '4' or args['1'] == 'δ' or args['1'] == 'Δ'  or args['1'] == 'Μελπομένη' then chapter = 'Μελπομένη' chapter_number = '4'
		if descr == '-' then descr = '' else descr=' (Μελπομένη)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1992): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end
	if args['1'] == '5' or args['1'] == 'ε' or args['1'] == 'Ε'  or args['1'] == 'Τερψιχόρη' then chapter = 'Τερψιχόρη' chapter_number = '5'
		if descr == '-' then descr = '' else descr=' (Τερψιχόρη)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1992): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end
	if args['1'] == '6' or args['1'] == 'στ' or args['1'] == 'ΣΤ'  or args['1'] == 'Ερατώ' then chapter = 'Ερατώ' chapter_number = '6'
		if descr == '-' then descr = '' else descr=' (Ἐρατώ)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1993): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end
	if args['1'] == '7' or args['1'] == 'ζ' or args['1'] == 'Ζ'  or args['1'] == 'Πολύμνια' then chapter = 'Πολύμνια' chapter_number = '7'
		if descr == '-' then descr = '' else descr=' (Πολύμνια)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1993): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end
	if args['1'] == '8' or args['1'] == 'η' or args['1'] == 'Η'  or args['1'] == 'Ουρανία' then chapter = 'Ουρανία' chapter_number = '8'
		if descr == '-' then descr = '' else descr=' (Οὐρανία)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1995): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end
	if args['1'] == '9' or args['1'] == 'θ' or args['1'] == 'Θ'  or args['1'] == 'Καλλιόπη' then chapter = 'Καλλιόπη' chapter_number = '9'
		if descr == '-' then descr = '' else descr=' (Καλλιόπη)' end
		if ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil)) then args['ram_trans_text'] = '<small>Μετάφραση (1995): Ηλίας Σπυρόπουλος. ' .. param_trans_address end
	end


-- make verse (precise, passage verse numbers) e.g. στίχ.9 (5-10)
	if verse ~= '' and verse ~= nil then
					
		if show_verse ~= '' and show_verse ~= nil then
			show_verse = ' ' .. show_verse
-- mypassage
			if (args['vv'] ~= '' and args['vv'] ~= nil) or (args['στίχοι'] ~= '' and args['στίχοι'] ~= nil) then
				show_verse = show_verse .. ' (' .. mypassage .. ')'
			end	
			show = chapter_number .. descr .. ', ' .. show_verse
		else
			show_verse = ' ' .. verse
-- mypassage
			if (args['vv'] ~= '' and args['vv'] ~= nil) or (args['στίχοι'] ~= '' and args['στίχοι'] ~= nil) then
				show_verse = show_verse .. ' (' .. mypassage .. ')'
			end		
			show = chapter_number .. descr .. ', ' .. show_verse
		end
	else -- if no verselink
		verse_link = ''
		show = chapter_number .. descr
	end -- close verse

-- make link to source of text at el.wikisource
	output_source =  '[[:el:s:Ιστορίαι (Ηροδότου)'
		if chapter ~= '' and chapter ~= nil then
			if chapter_number ~= mw.ustring.match(chapter_number, '[123456789]') then
				output_chapter = ''
				verse_link = ''
				return errorhere('<span style="color:#b22222; font-size:17px;">Επιλέξτε έναν αριθμό για τα κεφάλαια 1 έως 9.</span> [[Κατηγορία:Σελίδες με σφάλματα στο πρότυπο για τον Ηρόδοτο]]')

			elseif chapter_number == mw.ustring.upper(chapter_number, '[123456789]') then
				output_chapter =  '/' .. chapter
-- make verse_link for verse e.g. #3  or #3.1
				if args['2'] ~= '' and args['2'] ~= nil then
					verse_link = '#' .. verse
				else
					verse_link = ''
				end -- close verse link

		
			end -- close if chapter is NOT 1234...	
		else -- if there is no chapter
				output_chapter = ''
				verse_link = ''
				show = ' στη Βικιθήκη'
		end -- close if chapter

-- make output for translations
		if args['1'] ~= '' and args['1'] ~= nil
		and ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil))
		then
output = args['ram_trans_text']
		elseif (args['1'] == '' or args['1'] == nil)
		and ((args['μτφ'] ~= '' and args['μτφ'] ~= nil) or (args['p'] ~= '' and args['p'] ~= nil))
		then 
		return errorhere('<span style="color:#b22222; font-size:17px;">Επιλέξτε έναν αριθμό για τα κεφάλαια 1 έως 9.</span> [[Κατηγορία:Σελίδες με σφάλματα στο πρότυπο για τον Ηρόδοτο]]')

else
-- LINK & text -- DO NOT use font-size:small, it does not work.
output = output_preliminaries .. '<span style="font-size:88%;">' .. output_author .. output_work
.. output_source_comma .. output_source .. output_chapter .. verse_link
.. '|<span title="αρχαίο κείμενο στη Βικιθήκη" style="background:#f7ffff;" border-bottom: 1px dotted #ddd;">' .. show .. '</span>]]</span>'

-- ΚΑΤΗΓΟΡΙΑ
	local page = mw.title.getCurrentTitle()
	page.name = page.text:match( "^%s*(.-)%s*$" )
	if page.namespace == 0 then	-- Categories work only in MAIN namespace (code 0)
		-- nocat= 1
		if args['nocat'] == '1' or args['00'] == '-' then
		output = output
		else
		output = output .. '[[Κατηγορία:Λήμματα με παραθέματα από τον Ηρόδοτο (αρχαία ελληνικά)]]'
		.. '[[Κατηγορία:Λήμματα με παραθέματα (αρχαία ελληνικά)]]'
		end
	end -- close if mainspace
end -- close if trans
return output
end

return export