Documentation for this module may be created at Module:testing/gkm/τεκμηρίωση

--[=[
[[Module:testing]] - [[Module:testing/param]] -- [[Module:testing/functions]]  -- [[Module:testing/data]] 
Tests at [[Template:testing]]  {{#invoke:testing|main}}
[[wikt:el:Sarri.greek]] 2023.
DONE all works for:
* Διγενής (Dig)
* Μαχαιράς, Λεόντιος (Mach) Παλαμήδης, Γεώργιος (Palamid)
DONE only author -- add works manuall
* [Psell]  Ψελλός
]=]--

-- this is a param test about quotations
-- 1 2 3 4 5 6 = lang_iso, author, work, book, chapter, line

--[=[
INSTRUCTIONS for param page: Call if from the Module by placing EXACTLY where it is needed:
	require ('Module:xxx/zzz').zzz (args)
	DO NOT change anything else. DO NOT add at top of page a m_zzz = require this and that.
The name of the page 'param' or zzz is also the name of the local function zzz (args), and at the end, return {zzz = zzz}
-- USE: local for the functions of THIS module
]=]--
--------------------------------------------------------------------------
-- COPY HERE parameters or functions needed from the Module



--[=[--------------------------< I S _ S E T >------------ -- by [[w:en:User talk:Trappist the monk]]
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]=]--
--[=[ The is_set() function may be added so that tests like this:
	if args['ακε'] ~= '' and args['ακε'] ~= nil then args['ακε'] = args['ακε'] else args['ακε'] = '' end
can be reduced to:
	if not is_set (args['ακε']) then args['ακε'] = '' end 
]=]--

local function is_set (var)
	return not (var == nil or var == '');
end


--------------------------------------------------------------------------
--                                function                              --
--------------------------------------------------------------------------
local function gkm (args)


--[=[ ----------------------------- see [[Module:testing/guide]] for more
NAMED parameters:  iso-author-work-bookd-chapter-line/section - To number them: POSITIONS 1 2 3 4 5 6.
iso is always at position 1. There are 12 patterns. Data must be specified for each pattern, except default.
	-- if only 5 params (omit book) then would have 6 patterns.
The patterns are created so that editor will not have to write empty parameters. 
	(e.g. grc|Αισχ|Πέρσ|||33, author work-line/section only, omitting book and chapter
* 3) noauthor					1 X 2 3 4 5 = iso-work-book-chapter-line/section
  3a) and nobook				1 X 2 X 3 4 = iso-work-chapter-line/section
  3b) and nochapter				1 X 2 3 X 4 = iso-work-book-line/section
  3c) and nobook+nochapter		1 X 2 X X 3 = iso-work-line/section
* 2) onework authors			1 2 X 3 4 5 = iso-author-book-chapter-line/section
  2a) and nobook				1 2 X X 3 4 = iso-author-chapter-line/section
  2b) and nochapter				1 2 X 3 X 4 = iso-author-book-line/section
  2c) and nobook+nochapter		1 2 X X X 3 = iso-author-line/section
* 1) default					1 2 3 4 5 6 = iso-author-work-book-chapter-line/section
  1a) and nobook				1 2 3 X 4 5 = iso-author-work-chapter-line/section
  1b) and nochapter				1 2 3 4 X 5 = iso-author-work-book-line/section
  1c) and nobook+nochapter		1 2 3 X X 4 = iso-author-work-line/section
Otherwise, editor can use named parameters.
--------------------------------------------------------------------------------
* Abbreviations, Latin and Greek as in transligual abbreviations for classics (see out Library).
SOURCES may be
* s =  wikisource = el.wikisource for ancient greek & other greek texts / fr.wikisource for French etc.
* bg = books.googe
* pers = perseus.tufts.edu
* scaife.perseus cannot be linked, it has problems with = and quotation marks in the addresses
* lg = greek-language.gr (for ancient greek grc, with translations in Greek)
* x = any other external source. Usually with only one page parameter filled by editor (args['page'])
---------------------------------------------------------
]=]--




-- THIS IS DECLARATION test 3 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

-- ================== numbering PATTERNS =======================
-- THIS IS IN MAIN PAGE mylang = args['iso'] or args['1'] or ''		args['iso'] = args['iso'] or ''
-- For each pattern COPYPASTE the args at EVERY WORK
-- ======================= noauthor
-- 1 X 2 X X 3 = iso-work-line/section
if -- need to name the work
args['2'] == 'nameit' or args['2'] == 'nameit2'
-- or ...
then -- COPY the FOLLOWING under the work
	myauthor = ''
	mywork = args['work'] or args['2'] or ''			args['work'] = args['work'] or ''
	mybook = ''		mychapter = ''
	myline = args['line'] or args['3'] or ''			args['line'] = args['line'] or ''
-- 1 X 2 3 X 4 = iso-work-book-line/section
elseif args['2'] == 'Dig' or args['2'] == 'Διγ' or args['2'] == 'Διγενής'
-- or ...
-- pattern == 'threeb' -- this does not work
then -- COPY the FOLLOWING under the work
	myauthor = ''
	mywork = args['work'] or args['2'] or ''			args['work'] = args['work'] or ''
	mybook = args['book'] or args['3'] or ''			args['book'] = args['book'] or ''
	mychapter = ''
	myline = args['line'] or args['4'] or ''			args['line'] = args['line'] or ''
-- 1 X 2 X 3 4 = iso-work-chapter-line/section
elseif args['2'] == 'nameit'
-- or ...
-- pattern == 'threeb' -- this does not work
then -- COPY the FOLLOWING under the work
	myauthor = ''
	mywork = args['work'] or args['2'] or ''			args['work'] = args['work'] or ''
	mybook = ''
	mychapter = args['chapter'] or args['4'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['5'] or ''			args['line'] = args['line'] or ''
-- 1 X 2 3 4 5 = iso-work-book-chapter-line/section
elseif args['2'] == 'nameit'
-- or ...
or pattern == 'three' -- this does not work
then -- COPY the FOLLOWING under the work
	myauthor = ''
	mywork = args['work'] or args['2'] or ''			args['work'] = args['work'] or ''
	mybook = args['book'] or args['3'] or ''			args['book'] = args['book'] or ''
	mychapter = args['chapter'] or args['4'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['5'] or ''			args['line'] = args['line'] or ''
-- ======================= onework authors
-- 1 2 X X X 3 = iso-author-line/section
elseif pattern == 'twoc' and onework == '1'
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = '' mybook = '' mychapter = ''
	myline = args['line'] or args['3'] or ''			args['line'] = args['line'] or ''
-- 	1 2 X 3 X 4 = iso-author-book-line/section
elseif pattern == 'twob' and onework == '1'
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = ''
	mybook = args['book'] or args['3'] or ''			args['book'] = args['book'] or ''
	mychapter = ''
	myline = args['line'] or args['4'] or ''			args['line'] = args['line'] or ''
-- 1 2 X X 3 4 = iso-author-chapter-line/section -- example: Thucydides
elseif pattern == 'twoa' and onework == '1'
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = ''
	mybook = ''
	mychapter = args['chapter'] or args['3'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['4'] or ''			args['line'] = args['line'] or ''
-- 1 2 X 3 4 5 = iso-author-book-chapter-line/section
elseif pattern == 'two' and onework == '1'
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = ''
	mybook = args['book'] or args['3'] or ''			args['book'] = args['book'] or ''
	mychapter = args['chapter'] or args['4'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['5'] or ''			args['line'] = args['line'] or ''

-- ======================= 
-- 1 2 3 X X 4 = iso-author-work-line/section
elseif pattern == "onec"
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = args['work'] or args['3'] or ''			args['work'] = args['work'] or ''
	mybook = '' mychapter = ''
	myline = args['line'] or args['4'] or ''			args['line'] = args['line'] or ''
-- 	1 2 3 4 X 5 = iso-author-work-book-line/section
elseif pattern == "oneb"
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = args['work'] or args['3'] or ''			args['work'] = args['work'] or ''
	mybook = args['book'] or args['4'] or ''			args['book'] = args['book'] or ''
	mychapter = ''
	myline = args['line'] or args['5'] or ''			args['line'] = args['line'] or ''
-- 1 2 3 X 4 5 = iso-author-work-chapter-line/section
elseif pattern == "onea"
then -- COPY the FOLLOWING under the author
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = args['work'] or args['3'] or ''			args['work'] = args['work'] or ''
	mybook = ''
	mychapter = args['chapter'] or args['4'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['5'] or ''			args['line'] = args['line'] or ''
-- 1 2 3 4 5 6 = iso-author-work-book-chapter-line/section
else
-- this is default, pattenr one
	myauthor = args['author'] or args['2'] or ''		args['author'] = args['author'] or ''
	mywork = args['work'] or args['3'] or ''			args['work'] = args['work'] or ''
	mybook = args['book'] or args['4'] or ''			args['book'] = args['book'] or ''
	mychapter = args['chapter'] or args['5'] or ''		args['chapter'] = args['chapter'] or ''
	myline = args['line'] or args['6'] or ''			args['line'] = args['line'] or ''

end -- close patterns

---------------------------------------------------------



--------------------------------------------------------------------------
--            gkm μεσαιωνικά ελληνικά  Mediaeval Greek                  --
--              συγγραφείς α...ω authors α...ω                          --
--------------------------------------------------------------------------

-- Διγενής -- author = anon. example threeb 1 X 2 X 4 ADDED ABOVE (noauthor, nochpater) -- e.g. [[ἀκούεις]]
if args['work'] == 'Dig' or args['work'] == 'Διγ' or args['work'] == 'Διγενής' 
or args['2'] == 'Dig' or args['2'] == 'Διγ' or args['2'] == 'Διγενής'
then
	pattern = 'threeb' -- ALSO COPY  above, at PATTERNS
	-- ?# PERHAPS, chapter = name the manuscript?
	myauthor='' mybook='' mychapter='' myline = args['3'] or args['line'] or ''
	mylang = 'gkm' lang = 'gkm' subject = 'από τον Διγενή' time = '<b>12ος</b> αιώνας '
	biblink = '{{bib|gkm|Dig}} ' authorname = ''
	title = '<i>Διγενής Ακρίτης</i>' wp_title = 'Ανωνύμου, {{w|Διγενής Ακρίτας|<i>Διγενής Ακρίτης</i>}}'
	if bg ~= '' and bg ~= nil then
	bg_link = "[https://books.google.gr/books?id=Gd4ifVQxKtwC&pg=PA" .. bg ..  ' ' .. mypage 
	.. "] Jeffreys, Elizabeth, Digenis Akritis: The Grottaferrata and Escorial Versions - Cambridge Medieval Classics, vol.7, Cambridge University Press, 1998" 
	end
end -- close Digenis

-- Μαχαιράς, Λεόντιος Machairas, Leontios -- only onework  1 2 X 3 4 -- e.g. [[ἤτζου]]
	-- !! author's language is lang = 'gkm-cyp' BUT the passage may be gkm (χωρίς κυπριακά στοιχεία)
if myauthor == 'Mach' or myauthor == 'Μαχ' or myauthor == 'Μαχαιράς'
or args['2'] == 'Mach' or args['2'] == 'Μαχ' or args['2'] == 'Μαχαιράς'
then
	onework = '1' 	--mywork=  is default
	mywork = ''
	mybook='' mychapter = args['3'] or args['chapter'] or ''
	myline = args['4'] or args['line'] or ''
	mylang = 'gkm' 
	lang = args['lang'] or '' args['lang'] = args['lang'] or ''
		if args['lang'] == '' or  args['lang'] == nil then lang = 'gkm-cyp' end
	subject = 'από τον Μαχαιρά' time = '<b>15ος</b> αιώνας ' 
	biblink = '{{bib|gkm|Mach}} ' authorname = 'Μαχαιράς, Λεόντιος' wp_author = '{{w|Λεόντιος Μαχαιράς|Λεόντιος Μαχαιράς}}, '
	.. '<i>Εξήγησις της γλυκείας χώρας Κύπρου, η ποία λέγεται Κρόνικα, τουτέστιν Χρονικόν</i>' .. pub
	if (anemi ~= '' and anemi ~= nil) or (bg ~= '' and bg ~= nil) then
		pub = ' Σάθας, <i>Μεσαιωνική Βιβλιοθήκη</i>, Τόμος&nbsp;2'
		else pub = ''
	end
	title = '<i>Εξήγησις της γλυκείας χώρας Κύπρου, η ποία λέγεται Κρόνικα, τουτέστιν Χρονικόν</i>' 
	wp_title = ''
	w_monotonic='Χρονικόν Κύπρου'
	if anemi ~= '' and anemi ~= nil then
	anemi_link = "[https://anemi.lib.uoc.gr/php/pdf_pager.php?filename=%2Fvar%2Fwww%2Fanemi-portal%2Fmetadata%2F9%2Fb%2F0%2Fattached-metadata-181-0000011%2F71268_02.pdf&rec=%2Fmetadata%2F9%2Fb%2F0%2Fmetadata-181-0000011.tkl&do=71268_02.pdf&width=364&height=580&pagestart=1&maxpage=821&lang=en&pageno="
		.. anemi .. "&pagenotop=328&pagenobottom=188" .. ' σελ.' .. mypage .. source_name .. "]"
	end
	if bg ~= '' and bg ~= nil then
	bg_link = "[https://books.google.gr/books?id=zm1oAAAAcAAJ&pg=PA" .. bg .. ' σελ.' .. mypage .. source_name .. "]"
	end
end -- close Μαχαιράς


-- Παλαμήδης, Γεώργιος  Palamidis, Georgios -- nochapter  1 2 3 X 4 -- e.g. [[ξαναγράφω]]
if myauthor == 'Palamid' or myauthor == 'Παλαμήδ' or myauthor == 'Παλαμήδης'
then
	mylang = 'gkm' lang = 'gkm' subject = 'από τον Παλαμήδη' time = '<b>17ος</b> αιώνας ' 
	biblink = '{{bib|gkm|Palamid}} ' authorname = 'Γεώργιος Παλαμήδης' wp_author = '' a_monotonic=''
	if mywork == 'Boeb' or mywork == 'Βοηβ' or mywork == 'Βοηβόδας' then
		mybook='' mychapter='' myline = args['4'] or args['line'] or ''
		if myline ~= '' and myline ~= nil then myline = 'στίχ.&nbsp;' .. myline end
		title = '<i>Iστορία περιέχουσα πάσας τας πράξεις και ανδραγαθίας … του εκλαμπροτάτου Mιχαήλ βοηβόδα</i>' wp_title = ''
		pub = " Legrand, <i>BGV</i>, τόμος&nbsp;2"
		bg_link = "[https://books.google.gr/books?id=1IkvAAAAYAAJ&pg=PA" .. args['bg'] .. ' σελ.' .. mypage .. source_name .. "]"
	-- Ψαλμ. ...
	end -- close works
end -- close Palamidis

--===== Ψελλός Psellos
if myauthor == 'Psellos' or myauthor == 'Psell' or myauthor == 'Ψελλ' or myauthor == 'Ψελλός' then
	mylang = 'gkm' lang = 'gkm' subject = 'από τον Ψελλό'  time = '<b>11ος</b> αιώνας ' 
	biblink = '{{bib|gkm|Psellos}} ' .. '[[Κατηγορία:Λήμματα με παραθέματα λόγιας μεσαιωνικής (μεσαιωνικά ελληνικά)]]' 
	authorname = 'Μιχαήλ Ψελλός' wp_author = '{{w|Μιχαήλ Ψελλός|Μιχαὴλ Ψελλός}}' a_monotonic='Μιχαήλ Ψελλός'
	-- works, manually
		title = mywork
end -- close Psellos

-- ---------------------------------
end -- close  function

return {gkm = gkm}