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

--[=[
Module:testing - [[Module:testing/param]] -- [[Module:testing/functions]]  -- [[Module:testing/data]] 
Tests at [[Template:testing]]  {{#invoke:testing|main}}
[[wikt:el:Sarri.greek]]
]=]--

-- this is a test about quotations. params 2023. Απρίλιος πρώτη δοκιμή στο [[Template:Q]]
-- [[Module:testing/guide]] -- 
-- [[Module:testing/grc]] --  check [[wikt:en:Module:Quotations/grc/data]]
-- [[Module:testing/gkm]] -- 
-- [[Module:testing/el]] -- 
-- [[Module:testing/fr]] -- 
-- check [[:Κατηγορία:Σελίδες με σφάλματα στο Πρότυπο quote]]' [[wikt:en:Module:Quotations]]
-- BUG to_cap, chapter_restrict is needed always (? see DS Διόδωρος Σικελιώτης, I have = 100)

export = {} -- DO NOT write local export. It does not work.

module_path = 'Module:testing'
--m_1 = require(module_path .."/1") 
-- cannot call all subpages directly from here. Each one will call the next:
-- here we call m_1 = require(module_path .. "/1") 
		-- m_1 calls: m_2 = require(module_path .. "/2") 
			-- m_2 calls m_3 and so forth
-- for data-only page: call it with local data = mw.loadData(module_path .."/data")
-- for parameter page, PUT IT exactly where needed: 
	-- require ('Module:..../xxx').xxx (args)
	
-- ====================== required
-- [[Module:Languages]] for the iso error
-- see PARAM & subpages

-- ====================== errors
-- Use it with writing: if blahblah then return errorhere('xxxxxx') end
errorhere = function(errstring)
    return '<div class="error">' .. errstring .. '</div>[[Κατηγορία:Σελίδες με σφάλματα στο Πρότυπο quote]]'
end

-- DATES repeated from /grc, to invoke from outside
function export.b(frame)
--	local args = frame:getParent().args	-- for Templates
	local args = frame.args				-- invoke
	x = args[1] or ''
	return '<span style="color:#002000; cursor:help;" title="προ Χριστού - προ κοινής εποχής, BC - BCE,   av. J.-C. - AEC"><b>'
	.. x .. '&uarr;</b></span>'
end
function export.c(frame)
--	local args = frame:getParent().args	-- for Templates
	local args = frame.args				-- invoke
	x = args[1] or ''
	return '<span style="color:#002000; cursor:help;" title="μετά Χριστόν - κοινή εποχή, AD - CE, ap. J.-C. - ÈC"><b>'
	.. x .. '&darr;</b></span>'
end
function export.bc(frame)
--	local args = frame:getParent().args	-- for Templates
	local args = frame.args				-- invoke
	x = args[1] or ''
	return '<span style="color:#002000; cursor:help;" title="προ Χριστού & μετά Χριστόν - προ κοινής εποχής & κοινή εποχή, BC & AD - BCE & CE"><b>'
	.. x .. '&uarr;&darr;</b></span>'
end

--------------------------------------------------------------------------
--                             MAIN FUNCTION                           --
--------------------------------------------------------------------------
function export.main(frame)
	local args = frame:getParent().args	-- for Templates
--	local args = frame.args				-- invoke

--[=[ ----------------------------- 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  - copypaste the full link
* gl = 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'])
---------------------------------------------------------
]=]--

-- PARAMETERS args =============== DO NOT MOVE under the if lang, then subpages
-- FOR EDITOR, named and numbered
mylang = args['iso'] or args['1'] or ''		args['iso'] = args['iso'] or ''
		-- it determines the Module page (not the author's specific language)
		-- see below, if mylang = ... then require subpages by language
lang = args['lang'] or ''					args['lang'] = args['lang'] or ''
		-- BUT lang is author's language. May vary by passage. check /gkm author:Μαχαιράς lang = gkm or gkm-cyp
-- see at subpages: myauthor, mywork, mybook, mychapter, myline
args['7'] = args['7'] or ''
-- other params for editor, named not numbered

-- THIS IS not good
mypage = args['page'] or args['σελ'] or ''		args['page'] = args['page'] or ''
	-- number of page for external links
	
-- and see at the BLOCKS
	-- mypretitle
	-- myposttitle
	-- myaltbook
	-- myaltchapter
	-- ? section
	-- myaltline
-- also cf OMIT at end
-- SOURCES
mywikisource = args['s'] or ''	args['s'] = args['s'] or ''
-- OTHER EXTERNAL SOURCES (cf sourceblock)
source_name = source_name or  ''

-- ----------------- EXTERNAL links, with auto address url laready written in the subpages
bg = args['bg'] or ''			args['bg'] = args['bg'] or ''			-- page number PA= for @books.google
	bg_link = bg_link or ''
	if bg ~= '' and bg ~= nil then
		source_name = "@books-google"
		bg_show = args['bg-p'] or ''	args['bg-p'] = args['bg-p'] or ''
		if args['bg-p'] == '' or args['bg-p'] == nil then mypage = bg else mypage = args['bg-p'] end
	end
pers = args['pers'] or ''			args['pers'] = args['pers'] or ''			-- @perseus.tufts.edu
	pers_link = pers_link or ''
	pers_show = pers_show or '' -- this does not workkkkkkkkkkkkkkkkkkk@#@
-- test Strabo Geographica
--	if pers ~= '' and pers ~= nil then
	if pers == '1' then
		source_name = "@perseus.tufts.edu"
		pers = pers_link .. pers_show
	end
	-- a perseus address manually written
	if args['pers-p'] == '' or args['pers-p'] == nil then mypage = pers else mypage = args['pers-p'] end
-- greek
gl = args['gl'] or args['κεγ'] or ''	args['gl'] = args['gl'] or ''	-- for greek-language.gr
	-- also see below, the same source OUTSIDE the main Q (when placed under translations, autonomously)
	gl_link = gl_link or ''
	if gl ~= '' and gl ~= nil then
		source_name = "@greek-language.gr"
	end
anemi = args['anemi'] or ''		args['anemi'] = args['anemi'] or ''		-- page @anemi repository, University of Crete
	anemi_link = anemi_link or ''
	if anemi ~= '' and anemi ~= nil then 
		source_name = "@anemi"
		anemi_show = args['anemi-p'] or ''	args['anemi-p'] = args['anemi-p'] or ''
		if args['anemi-p'] == '' or args['anemi-p'] == nil then mypage = anemi else mypage = args['anemi-p'] end
	end
-- ------------ write the whole address
scaife = args['scaife'] or ''	args['scaife'] = args['scaife'] or ''
	if scaife ~= '' and scaife ~= nil then
		-- copypaste full link
		scaife = '[' .. scaife .. ' @scaife.perseus]'
	end
x = args['x'] or ''				args['x'] = args['x'] or ''				-- write anything for any external url


-- repeat this where it is needed
mypassage = args['vv'] or args['στίχοι'] or ''	args['στίχοι'] = args['στίχοι'] or '' -- editor adds passage verse numbers e.g. (50-55)
	if mypassage ~= '' and mypassage ~= nil then 
		mypassage = '(' .. mypassage .. ')' 
		else mypassage = mypassage
	end
-- mycomment

-- to OMIT something:
mynopreliminaries = args['0'] or  ''				args['0'] = args['0'] or ''
	-- we write 0=-  to take off the symbol and time-centuries
mynocat = args['00'] or args['nocat'] or ''			args['00'] = args['00'] or ''
	-- we write 00=- or nocat=1 to take away the categories added by the symbol (is param subject=)	See quotation Section.
mynodata  = args['000'] or args['nodata'] or ''		args['000'] = args['000'] or ''
	-- we write 000=- or nocata=1 to take away everything except the chapter/line sourceblock


-- PARAMETERS for greek-language AUTO, this is SOURCE gl, but placed autonomously (e.g. under translations)
-- for grc (Ancient Greek) function translation to Κέντρο Ελληνικής Γλώσσας.
	-- param names as in [[wikt:el:Template:ΠΜ:ΚΕΓ]]
trans_id = args['μτφ'] or args['p'] or ''		args['μτφ'] = args['μτφ'] or ''
trans_id_text = args['p+t'] or ''		args['p+t'] = args['p+t'] or ''
	-- This presents BOTH Κείμενο & Μετάφραση... Can place it ABOVE quotation, if other sources are not wanted
trans_hi = args['φ'] or args['hi'] or ''			args['φ'] = args['φ'] or ''
trans_auth = args['συγγ'] or args['auth'] or ''	args['συγγ'] = args['συγγ'] or ''

-- ================== parameters only used in the module
	-- ΕΚΚΡΕΜΟΤΗΤΑ

pub = pub or '' -- at sourceblock

-- lang subject time quotation biblink
-- authorname wp_author a_monotonic author_time author_show
-- comma_work title wp_title w_monotonic work_year work_type work_show
-- comma_source source_lang source_name s s_chapter chapter_restrict chapter_link chapter_show 
-- s_anchor anchor_link anchor_show
-- x

-- PARAMETERS subpages =============== DO NOT MOVE the param subpages from here
-- BASIC CONDITION: MUST have iso for language
if mylang == '' or mylang == nil
then
	return errorhere('Πρέπει να συμπληρώσετε τον κωδικό γλώσσας στην 1η θέση.<br>Please add ISO code for language at 1st position.')
end


if require("Module:Languages")[mylang] == nil then
	return errorhere('Υπάρχει πρόβλημα στον κωδικό γλώσσας.<br>These is a problem at ISO code for language.')
end

if mylang == 'grc' then
	require(module_path .. "/grc").grc (args)
-- #? cannot do subpages?
--	require(module_path .. "/grc2").grc2 (args) -- how could I have many grc pages?

--	if mylang == 'grc' and (code == '' or code == nil) then	require(module_path .. "/grc").grc (args)
--	elseif mylang == 'grc' and code == 'grc-a' then require(module_path .. "/grca").grca (args)

elseif mylang == 'gkm' then
	require(module_path .. "/gkm").gkm (args)
elseif mylang == 'el' then
	require(module_path .. "/el").el (args)
-- other languages
elseif mylang == 'fr' then
	require(module_path .. "/fr").fr (args)
else
	return errorhere("Δεν έχουμε κατάλογο συγγραφέων γι' αυτόν τον κωδικό γλώσσας."
		.. "<br>We do not have a list of authors for this ISO language code.")
end

-- ======================= MORE CONDITIONS
-- CONDITION: cannot miss BOTH author AND work
if (myauthor == '' or myauthor == 'nil')
and (mywork == '' or mywork == 'nil')
then
	return errorhere('Συμπληρώστε και τους κωδικούς για συγγραφέα και έργο.<br>Please add codes for author and work.')
end

-- CONDITION: cannot miss authorname when myauthor
if (myauthor ~= '' and myauthor ~= nil)
and (authorname == '' or authorname == nil)
then
	return errorhere("Υπάρχει πρόβλημα με τον κωδικό συγγραφέα. [[Module:quote/εκκρεμότητες|Ζητήστε να προστεθεί στον κατάλογό μας]]."
	.. "<br>There is a problem with the author's code. [[Module:quote/εκκρεμότητες|Please contact us for adding it at our list]].")
end
-- CONDITION: cannot miss title when mywork
if (mywork ~= '' and mywork ~= nil)
and (title == '' or title == nil)
then
	return errorhere("Υπάρχει πρόβλημα με τον κωδικό έργου. [[Module:quote/εκκρεμότητες|Ζητήστε να προστεθεί στον κατάλογό μας]]."
	.. "<br>There is a problem with the work's code. [[Module:quote/εκκρεμότητες|Please contact us for adding it at our list]].")
end

--------------------------------------------------------------------------
--                        auxiliary fucntions                           --
--------------------------------------------------------------------------

-- BOOKS: rare, only if we have books-chapters-sections-lines see /grc Strabo
-- LINKS to BOOKS with capital letters
-- call it from this module with to_bookcap(paramofbookbyeditor)
	-- Homer's rhapsodies, without ΣΤ, are at [[Module:quoteHomer]]
function to_bookcap (book_capital)
-- CAREFUL: he cannot understand that ΙΑ is larger than Α, Β, Γ.. Must compare numbers	
	if mybook == '1' or mybook == 'α' or mybook == 'Α' then return '/Α'
	elseif mybook == '2' or mybook == 'β' or mybook == 'Β' then return '/Β'
	elseif mybook == '3' or mybook == 'γ' or mybook == 'Γ' then return '/Γ'
	elseif mybook == '4' or mybook == 'δ' or mybook == 'Δ' then return '/Δ'
	elseif mybook == '5' or mybook == 'ε' or mybook == 'Ε' then return '/Ε'
	elseif mybook == '6' or mybook == 'στ' or mybook == 'ΣΤ' then return '/ΣΤ'
	elseif mybook == '7' or mybook == 'ζ' or mybook == 'Ζ' then return '/Ζ'
	elseif mybook == '8' or mybook == 'η' or mybook == 'Η' then return '/Η'
	elseif mybook == '9' or mybook == 'θ' or mybook == 'Θ' then return '/Θ'
	elseif mybook == '10' or mybook == 'ι' or mybook == 'Ι' then return '/Ι'
	elseif mybook == '11' or mybook == 'ια' or mybook == 'ΙΑ' then return '/ΙΑ'
	elseif mybook == '12' or mybook == 'ιβ' or mybook == 'ΙΒ' then return '/ΙΒ'
	elseif mybook == '13' or mybook == 'ιγ' or mybook == 'ΙΓ' then return '/ΙΓ'
	-- ... etc if needed up to 24 but NOT more?
	else return 'nobook'
	end
	-- see below to_num See make_book for application
end -- close function to_bookcap	

-- call it from this module with to_bookcap(paramofchapterbyeditor)
function to_cap (chapter_capital)
	if mychapter == '1' or mychapter == 'α' or mychapter == 'Α' then return '/Α'
	elseif mychapter == '2' or mychapter == 'β' or mychapter == 'Β' then return '/Β'
	elseif mychapter == '3' or mychapter == 'γ' or mychapter == 'Γ' then return '/Γ'
	elseif mychapter == '4' or mychapter == 'δ' or mychapter == 'Δ' then return '/Δ'
	elseif mychapter == '5' or mychapter == 'ε' or mychapter == 'Ε' then return '/Ε'
	elseif mychapter == '6' or mychapter == 'στ' or mychapter == 'ΣΤ' then return '/ΣΤ'
	elseif mychapter == '7' or mychapter == 'ζ' or mychapter == 'Ζ' then return '/Ζ'
	elseif mychapter == '8' or mychapter == 'η' or mychapter == 'Η' then return '/Η'
	elseif mychapter == '9' or mychapter == 'θ' or mychapter == 'Θ' then return '/Θ'
	elseif mychapter == '10' or mychapter == 'ι' or mychapter == 'Ι' then return '/Ι'
	elseif mychapter == '11' or mychapter == 'ια' or mychapter == 'ΙΑ' then return '/ΙΑ'
	elseif mychapter == '12' or mychapter == 'ιβ' or mychapter == 'ΙΒ' then return '/ΙΒ'
	elseif mychapter == '13' or mychapter == 'ιγ' or mychapter == 'ΙΓ' then return '/ΙΓ'
	elseif mychapter == '14' or mychapter == 'ιδ' or mychapter == 'ΙΔ' then return '/ΙΔ'
	elseif mychapter == '15' or mychapter == 'ιε' or mychapter == 'ΙΕ' then return '/ΙΕ' -- [[πρατήριον]] Διόδωρος Σικελιώτης
	-- ... etc if needed up to 24 but NOT more?
	else return 'nochapter'
	end
	-- see below to_num See make_chapter for application
end -- close function to_cap

-- it works TOGETHER with function to_bookcap
function to_booknum (book_number)
	-- must inclue the number too
	if mybook == '1' or mybook == 'α' or mybook == 'Α' then return '1'
	elseif mybook == '2' or mybook == 'β' or mybook == 'Β' then return '2'
	elseif mybook == '3' or mybook == 'γ' or mybook == 'Γ' then return '3'
	elseif mybook == '4' or mybook == 'δ' or mybook == 'Δ' then return '4'
	elseif mybook == '5' or mybook == 'ε' or mybook == 'Ε' then return '5'
	elseif mybook == '6' or mybook == 'στ' or mybook == 'ΣΤ' then return '6'
	elseif mybook == '7' or mybook == 'ζ' or mybook == 'Ζ' then return '7'
	elseif mybook == '8' or mybook == 'η' or mybook == 'Η' then return '8'
	elseif mybook == '9' or mybook == 'θ' or mybook == 'Θ' then return '9'
	elseif mybook == '10' or mybook == 'ι' or mybook == 'Ι' then return '10'
	elseif mybook == '11' or mybook == 'ια' or mybook == 'ΙΑ' then return '11'
	elseif mybook == '12' or mybook == 'ιβ' or mybook == 'ΙΒ' then return '12'
	elseif mybook == '13' or mybook == 'ιγ' or mybook == 'ΙΓ' then return '13'
	-- ... etc if needed
	else return 'nobook'-- errorhere("Δεν βρίσκουμε αυτή τη σελίδα. We cannot find this book-page.")
	end

end -- close function to_booknum


-- SHOW CHAPTER numbers, not letters, because some editors, insist on writing Greek arithmesis
-- call it from this module with to_num(paramofchapterbyeditor)
-- it works TOGETHER with function to_cap
function to_num (chapter_number)
	-- must inclue the number too
	if mychapter == '1' or mychapter == 'α' or mychapter == 'Α' then return '1'
	elseif mychapter == '2' or mychapter == 'β' or mychapter == 'Β' then return '2'
	elseif mychapter == '3' or mychapter == 'γ' or mychapter == 'Γ' then return '3'
	elseif mychapter == '4' or mychapter == 'δ' or mychapter == 'Δ' then return '4'
	elseif mychapter == '5' or mychapter == 'ε' or mychapter == 'Ε' then return '5'
	elseif mychapter == '6' or mychapter == 'στ' or mychapter == 'ΣΤ' then return '6'
	elseif mychapter == '7' or mychapter == 'ζ' or mychapter == 'Ζ' then return '7'
	elseif mychapter == '8' or mychapter == 'η' or mychapter == 'Η' then return '8'
	elseif mychapter == '9' or mychapter == 'θ' or mychapter == 'Θ' then return '9'
	elseif mychapter == '10' or mychapter == 'ι' or mychapter == 'Ι' then return '10'
	elseif mychapter == '11' or mychapter == 'ια' or mychapter == 'ΙΑ' then return '11'
	elseif mychapter == '12' or mychapter == 'ιβ' or mychapter == 'ΙΒ' then return '12'
	elseif mychapter == '13' or mychapter == 'ιγ' or mychapter == 'ΙΓ' then return '13'
	elseif mychapter == '14' or mychapter == 'ιδ' or mychapter == 'ΙΔ' then return '14'
	elseif mychapter == '15' or mychapter == 'ιε' or mychapter == 'ΙΕ' then return '15'
	-- ... etc if needed
	else return 'nochapter'-- errorhere("Δεν βρίσκουμε αυτό το κεφάλαιο. We cannot find this chapter.")
	end

end -- close function to_num



-- function zero-five: link to el.wikisource anchors #v0
-- put the #v at s_anchor at subpages because Pindar has #v.1.11 (where 1 is the number of poem)
-- anchors ONLY for numbers ending to zero or five
-- call it from this module with zero_five(paramoflinebyeditor)
function zero_five (anchor_number)

	if myline == '1' or myline == '2' or myline == '3' or myline == '4'
	or myline == '' or myline == nil
	then
	return ''

		elseif mw.ustring.find(myline, '[1234]$') then
			-- $ means: at the end
		return mw.ustring.sub(mw.ustring.match(myline, myline), 1, -2) .. '0'
			-- 1 = start at 1st letter, -2 = stop at 2nd letter from the end

		elseif mw.ustring.find(myline, '[6789]$') then
		return mw.ustring.sub(mw.ustring.match(myline, myline), 1, -2) .. '5'
					
		elseif mw.ustring.find(myline, '[05]$') then
		return myline
		
		elseif mw.ustring.find(myline, '%D') then -- D means: any character except digits or dot .
return errorhere('<span style="color:#b22222; font-size:17px;">Παρακαλούμε, γράψτε έναν αριθμό στίχου. Please write a verse number.</span>')	

		end

end -- close function zero_five


-- ================ get Separately placed translation data 
-- for grc (Ancient Greek) function translation to Κέντρο Ελληνικής Γλώσσας.
	-- param names as in [[wikt:el:Template:ΠΜ:ΚΕΓ]]
		-- {{#invoke:modulename|grc|(abbreviation for author -- and work if different translators
		-- call it from this module with trans(nameofparam like trans_text)
		
function trans (translator)
-- problem: it is possible for different translators per chapter... see [[Module:quoteHerodotus]]
-- =========== place the following at main function:
-- trans_id = args['μτφ'] or args['p'] or ''		args['μτφ'] = args['μτφ'] or ''
-- trans_hi = args['φ'] or args['hi'] or ''			args['φ'] = args['φ'] or ''
-- trans_auth = args['συγγ'] or args['auth'] or ''	args['συγγ'] = args['συγγ'] or ''
-- NONEED trans_text = args['trans_text'] or ''					args['trans_text'] = args['trans_text'] or ''

		-- for noauthor works
		if (myauthor == '' or myauthor ==  nil)
		and ((args['work'] ~= '' and args['work'] ~= nil) or (args['2'] ~= '' and args['2'] ~= nil))
		and ((trans_id ~= '' and trans_id ~= nil) or (trans_id_text ~= '' and trans_id_text ~= nil))
		then
			text_for_trans = frame:preprocess(trans_text)
		end
		
		if myauthor ~= '' and myauthor ~= nil
		and ((args['work'] ~= '' and args['work'] ~= nil) or (args['2'] ~= '' and args['2'] ~= nil))
		and ((trans_id ~= '' and trans_id ~= nil) or (trans_id_text ~= '' and trans_id_text ~= nil))
		then -- check [[θάλαττα]]
			-- expand in case it contains [[Template:w]] for wikipedia
			text_for_trans = frame:preprocess(trans_text) -- cannot write output = 
		end

		if (myauthor ~= '' and myauthor ~= nil)
--		and args['συγγ'] == '1'
		and (args['συγγ'] ~= '' and args['συγγ'] ~= nil)
		or (args['auth'] ~= '' and args['auth'] ~= nil)
		then 
			text_for_trans =  frame:preprocess(trans_auth_id) -- cannot write output = 
		end

output =  text_for_trans
return output
end -- close function

--------------------------------------------------------------------------
--                               BLOCKS                                --
--------------------------------------------------------------------------


-- preliminaries ======================= 

-- ================ quotation -- expand [[wikt:el:Template:quotation]]
lang = lang or ''		-- this is not mylang = iso. This is the specific language of author or work
-- χρειάζονται και οι γενικές Κατηγορίες της γλώσσας (όχι μόνο του συγγραφέα) π.χ. 
	-- Κατηγορία:Λήμματα με παραθέματα από τον Αριστοτέλη ++Λήμματα με παραθέματα (αρχαία ελληνικά)
subject = subject or ''
-- don't show
	if args['0'] == '-' or args['000'] == '-'  or args['nodata'] == '1' then
		if args['00'] == '-' or args['nocat'] == '1' then
			quotation = '{{παράθεμα|' .. subject .. '|' .. lang .. '|0=-|00=-}}' -- no space at end, it does nothing
		else
			quotation = '{{παράθεμα|' .. subject .. '|' .. lang .. '|0=-}}' -- no space
			.. '[[Κατηγορία:Λήμματα με παραθέματα ({{' .. lang .. '|nolink=1}})]]'
		end
 -- show it
	else
		if args['00'] == '-' or args['nocat'] == '1' then
			quotation = '{{παράθεμα|' .. subject .. '|' .. lang .. '|00=-}} ' -- yes space at end
		else
			quotation = '{{παράθεμα|' .. subject .. '|' .. lang .. '}} '
			.. '[[Κατηγορία:Λήμματα με παραθέματα ({{' .. lang .. '|nolink=1}})]]'
		end
	end -- close if 0=-
quotation = frame:preprocess(quotation)

-- ================== add time at OUTPUT -- also see OMIT
-- the century -- usually for ancient or mediaeval authors
time = time or ''
time = frame:preprocess(time)

-- ================== link to [[wikt:el:Βικιλεξικό:Βιβλιοθήκη]] our Library, by ITS language
-- expand  [[wikt:el:Template:bib]]
-- repeat biblink, if not 0=-  -- either author, or works without author
biblink = frame:preprocess(biblink)


-- about author  ======================= myauthor noauthor -- see OMIT at end
author_show = author_show or ''
author_time = author_time or ''
if myauthor ~= '' and myauthor ~= nil then
	if wp_author == '' or wp_author == nil then
		author_show = authorname .. author_time
	else
		author_show =  frame:preprocess(wp_author) .. author_time
	end
end


-- workblock  =====================================

-- ========== comma before workblock
	-- place this AFTER the make_work, otherwise it is empty

-- ========== make work
work_show = work_show or ''
title = title or ''
mypretitle = args['.τίτλος'] or args['.title'] or ''		args['.τίτλος'] = args['.τίτλος'] or ''
	if mypretitle ~= '' and mypretitle ~= nil then mypretitle = mypretitle .. ' ' end -- add space at end
myposttitle = args['τίτλος+'] or args['title+'] or ''	args['τίτλος+'] = args['τίτλος+'] or ''
subtitle = subtitle or ''
work_year = work_year or ''
work_type = work_type or ''
if mywork ~= '' and mywork ~= nil then
	if wp_title == '' or wp_title == nil then
		work_show = mypretitle .. title .. subtitle .. myposttitle .. work_year .. work_type
	else
		work_show =  mypretitle .. frame:preprocess(wp_title) .. subtitle .. myposttitle .. work_year .. work_type
	end
else -- onework type is mywork = '' We show it when it is called by chapter or Line
	if title ~= '' and title ~= nil and mychapter ~= '' and  mychapter ~= nil then
		if wp_title == '' or wp_title == nil then
		work_show = mypretitle .. title .. subtitle .. myposttitle .. work_year .. work_type
		else
		work_show = mypretitle .. wp_title .. subtitle .. myposttitle .. work_year .. work_type
		end
	end -- close if title exists, although mywork = ''
end
work_show = frame:preprocess(work_show) -- sometimes, {{s or {{w at other params check [[frou-frou]]

-- ========== comma before workblock -- also see OMTI below
comma_work = comma_work or ''
	if (myauthor ~= '' and myauthor ~= nil) and (work_show ~= '' and work_show ~= nil) then
		comma_work = ', '
	else 
		comma_work = ''
end

-- sourceblock  =====================================
-- see SOURCES above
	-- s is source for el.wikisource
		-- if args['s'] == '-' then cancel the wikisource link.
	-- x is external source. Need mypage = the number of page e.g. to archive.org or books.google

-- ========== comma before sourceblock -- also see OMIT below
	-- place this AFTER the make_work, otherwise it is empty

--## PROBLEM if β μικρό στο s_book? Check also β μικρό στο s_chapter
-- ========== make book
-- ========== make chapter
book_link = book_link or ''
book_show = book_show or ''
myaltbook = args['altbook'] or args['εμφβιβ'] or '' args['altbook'] = args['altbook'] or ''
book_restrict = book_restrict or ''
	if book_restrict ~= '' and book_restrict ~= nil then book_restrict = book_restrict or '' end
chapter_link = chapter_link or ''
chapter_show = chapter_show or ''
myaltchapter = args['altchapter'] or args['εμφκεφ'] or '' args['altchapter'] = args['altchapter'] or ''
chapter_restrict = chapter_restrict or ''
	if chapter_restrict ~= '' and chapter_restrict ~= nil then chapter_restrict = chapter_restrict or '' end

-- for wikisource, cancel it if badlinks
if args['s'] == '-' then s='' s_chapter='' s_book='' s_anchor='' end

-- CAREFUL to_bookcap, to_cap Module cannot understand that ΙΑ is larger than Α, Β, Γ.. Must compare numbers

if mybook ~= '' and mybook ~= nil then
	if s_book == '' or s_book == nil then
		book_link = ''
		if myaltbook ~= '' and myaltbook ~= nil then
			book_show = myaltbook
		else
			book_show = mybook
		end
	else -- we have s_book
		--NO NEED TO TO if  to_cap
		if book_restrict ~= '' and book_restrict ~= nil then
			-- CAREFUL, (if to_bookcap) it does not understand. Convert to_num, it understands numbers or sequences
			-- otherwise gives error attempt to compare number with nil.
			if tonumber(to_booknum(mybook)) ~= '' and tonumber(to_booknum(mybook)) ~= nil then
				if tonumber(to_booknum(mybook)) > tonumber(book_restrict)
				-- or different ??
				then
					s = ''
					myline = ''
					chapter_link = ''
					book_link = ''
					book_show = errorhere("Γι' αυτό το έργο, αριθμοί βιβλίων 1 - "
					.. book_restrict .. " are the book  numbers for this work.")
				else
					if s_book == 'to_bookcap' then
						book_link = to_bookcap(mybook)
					else
						book_link = s_book .. mybook
					end
					if myaltbook ~= '' and myaltbook ~= nil then
						book_show = myaltbook
					else
						book_show = to_booknum(mybook)
					end
				end
			else -- mybook is nil, which gives nobook, also outside the book_restrict
					s = ''
					myline = ''
					mychatper = ''
					book_link = ''
					book_show = errorhere("Γι' αυτό το έργο, αριθμοί βιβλίων 1 - "
					.. book_restrict .. " are the book numbers for this work.")

			end -- close f tonumber(to_num(mybook)) > 
				
		else -- there is no book_restrict
			book_link = s_book .. mybook
			if myaltbook ~= '' and myaltbook ~= nil then
				book_show = myaltbook
			else
				book_show = mybook -- oops NOT to_booknum(mybook) (I get nobook instead of the mybook text)
			end
		end -- close book restrict for nocaps
	end -- close if s_book exists
end -- close if mybook exists

-- CHAPTERS
if mychapter ~= '' and mychapter ~= nil then
--	comma_chapter??
	if s_chapter == '' or s_chapter == nil then
		chapter_link = ''
		if myaltchapter ~= '' and myaltchapter ~= nil then
			chapter_show = myaltchapter
		else
			chapter_show = mychapter
		end
	else -- we have s_chapter
		--NO NEED TO TO if  to_cap
		if chapter_restrict ~= '' and chapter_restrict ~= nil then
			-- CAREFUL, (if to_cap) it does not understadn. Makde to_num, it understands numbers or sequences
			-- otherwise gives error attempt to compare number with nil.
			if tonumber(to_num(mychapter)) ~= '' and tonumber(to_num(mychapter)) ~= nil then
				if tonumber(to_num(mychapter)) > tonumber(chapter_restrict)
				-- or different ??
				then
					s = ''
					myline = ''
					chapter_link = ''
					chapter_show = errorhere("Γι' αυτό το έργο, αριθμοί κεφαλαίων 1 - "
					.. chapter_restrict .. " are the chapter numbers for this work.")
				else
					if s_chapter == 'to_cap' then
						chapter_link = to_cap(mychapter)
					else
						chapter_link = s_chapter .. mychapter
					end
					if myaltchapter ~= '' and myaltchapter ~= nil then
						chapter_show = myaltchapter
					else
						chapter_show = to_num(mychapter)
					end
				end
			else -- mychapter is nil, which gives nochapter, also outside the chapter_restrict
					s = ''
					myline = ''
					chapter_link = ''
					chapter_show = errorhere("Γι' αυτό το έργο, αριθμοί κεφαλαίων 1 - "
					.. chapter_restrict .. " are the chapter numbers for this work.")

			end -- close f tonumber(to_num(mychapter)) > 
				
		else -- there is no chapter_restrict
			chapter_link = s_chapter .. mychapter
			if myaltchapter ~= '' and myaltchapter ~= nil then
				chapter_show = myaltchapter
			else
				chapter_show = mychapter  -- oops NOT to_num(mychapter) (I get nochapter instead of the mychapter text)
					-- check [[ταχυδρόμος]] for Aesop
			end
		end -- close chapter restrict for nocaps
	end -- close if s_chapter exists
end -- close if mychapter exists

-- ========== make line
book_link = book_link or ''
chapter_link = chapter_link or '' -- MUST REPEAT or ERROR concatenate
anchor_link = anchor_link or ''
anchor_show = anchor_show or ''
myaltline = args['εμφ'] or args['alt'] or ''	args['εμφ'] = args['εμφ'] or '' -- editor changes myline
mypassage = args['vv'] or args['στίχοι'] or ''	args['στίχοι'] = args['στίχοι'] or '' -- editor adds passage verse numbers e.g. (50-55)
mypassage = args['vv'] or args['στίχοι'] or ''	args['στίχοι'] = args['στίχοι'] or '' -- editor adds passage verse numbers e.g. (50-55)
	if mypassage ~= '' and mypassage ~= nil then 
		mypassage = '(' .. mypassage .. ')' 
		else mypassage = mypassage
	end
if myline ~= '' and myline ~= nil then
	if s_anchor == '' or s_anchor == nil then
		if (mybook == '' or mybook == nil) or (mychapter == '' or mychapter == nil) then
			-- comma exists as comma_source
			anchor_link = ''
			if myaltline ~= '' and myaltline ~= nil then
				anchor_show = myaltline .. ' ' .. mypassage
			else
				anchor_show = myline .. ' ' .. mypassage
			end
		else
			anchor_link = ''
			if myaltline ~= '' and myaltline ~= nil then
				anchor_show = myaltline .. ' ' .. mypassage
			else
				anchor_show = myline .. ' ' .. mypassage
			end
		end
-- check [[ξόανον]]
	else -- there is #source
		if (mybook == '' or mybook == nil) or (mychapter == '' or mychapter == nil) then
			-- comma exists as comma_source
			if mw.ustring.find(s_anchor, 'every_five') then
				anchor_link = mw.ustring.gsub(s_anchor, "every_five", zero_five(myline))
--				anchor_link = s_anchor
				if myaltline ~= '' and myaltline ~= nil then
					anchor_show = myaltline .. ' ' .. mypassage
				else
					anchor_show = myline .. ' ' .. mypassage
				end
			else
				anchor_link = s_anchor .. myline
				if myaltline ~= '' and myaltline ~= nil then
					anchor_show = myaltline .. ' ' .. mypassage
				else
					anchor_show = myline .. ' ' .. mypassage
				end
			end
		else -- yes book or yes chapter
			if mw.ustring.find(s_anchor, 'every_five') then
				anchor_link = mw.ustring.gsub(s_anchor, "every_five", zero_five(myline))
--				anchor_link = s_anchor
				if myaltline ~= '' and myaltline ~= nil then
					anchor_show = myaltline .. ' ' .. mypassage
				else
					anchor_show = myline .. ' ' .. mypassage
				end
			else
				anchor_link = s_anchor .. myline
				if myaltline ~= '' and myaltline ~= nil then
					anchor_show = myaltline .. ' ' .. mypassage
				else
					anchor_show = myline .. ' ' .. mypassage
				end
			end
		end -- close if mybook or mychapter exists
	end -- close if s_anchor exists
end -- close if myline exists

-- ========== SOURCEBLOCK
sourceblock = sourceblock or ''

-- ========== fix inner commata
	comma_chapter = comma_chapter or ''
	comma_line = comma_line or ''
	if (mybook == '' or mybook == nil)
	or ((mybook ~= '' and mybook ~= nil) and (mychapter == '' or mychapter == nil) and (myline == '' or myline == nil))
	then
		comma_chapter = ''  -- comma exists at beginning of sourceblock
	elseif (mybook ~= '' and mybook ~= nil) 
	and ((mychapter ~= '' and mychapter ~= nil) or (myline ~= '' and myline ~= nil))
	then
		comma_chapter = '.'  -- separates book.chapter
	end
-- check [[ξόανον]].
	if (myline ~= '' and myline ~= nil)
	and (mybook == '' or mybook == nil) and (mychapter == '' or mychapter == nil)
	then
		if s_anchor == '#' .. 'every_five' then
			comma_line = ' στίχ. '
		else
			comma_line = ''   -- comma exists at beginning of sourceblock
		end
	elseif (myline ~= '' and myline ~= nil)
	and ((mybook ~= '' and mybook ~= nil) or (mychapter ~= '' and mychapter ~= nil))
	then
		if s_anchor == '#' .. 'every_five' then
			comma_line = ', στίχ. '
		else
			comma_line = ', '
		end
	end


-- ---------- for  wikisource
if s ~= '' and s ~= nil then
	if (mybook ~= '' and mybook ~= nil) or (mychapter ~= '' and mychapter ~= nil) or (myline ~= '' and myline ~= nil) then
	-- use [[Template:s]] for wikisource
		if mylang == 'grc' or mylang == 'gkm' or mylang == 'el' then source_lang = '' source_name = '' --  στη Βικιθήκη
		elseif mylang == 'fr' then source_lang = 'lang=fr' source_name = ' στη γαλλική Βικιθήκη'
		else source_lang = '' source_name = '' --  στη Βικιθήκη ?default for all hellenic languages
		end
		if args['+s'] == '1' then
	sourceblock = sourceblock .. '{{s|' .. source_lang .. s
	.. book_link .. chapter_link .. anchor_link
	.. '|' .. ' στη Βικιθήκη}}'
		else
	sourceblock = '{{s|' .. source_lang .. s
	.. book_link .. chapter_link .. anchor_link
	.. '|' .. book_show .. comma_chapter .. chapter_show .. comma_line .. anchor_show .. source_name .. '}}'
		end
	end
else -- NOT wikisource
	sourceblock = book_show .. comma_chapter .. chapter_show .. comma_line .. anchor_show .. args['7']
end

-- ---------- make external source with url= It can follow a wikisource link
-- url uses mypage parameter (at subpages)
	if (pub ~= '' and pub ~= nil) -- data for publisher
	or (anemi ~= '' and anemi ~= nil) -- this is @anemi repository, University of Crete
	or (bg ~= '' and bg ~= nil) -- this is @books-google
	or (pers ~= '' and pers ~= nil) -- this is @perseus.tufts.edu
	or (gl ~= '' and gl ~= nil) -- this is @greek-language.gr incorporated
	or (scaife ~= '' and scaife ~= nil) -- copypaste full link
	or (x ~= '' and x ~= nil) -- this is any other external url
	then
--		if (mychapter ~= '' and mychapter ~= nil) or (myline ~= '' and myline ~= nil) then
		sourceblock = sourceblock .. ' ' .. pub ..  ' ' .. anemi_link .. ' ' .. bg_link
		 .. ' ' .. pers_link .. ' ' .. scaife .. ' ' .. gl_link .. ' ' .. x
--		end
	end


-- ========== comma before sourceblock -- also see OMIT below
	-- place this AFTER the make_work, otherwise it is empty
comma_source = comma_source or ''
if comma_source == '-' then		-- special titles as in Alcman, Απόσπασμα Nr.
	comma_source = ' '
else
	if (sourceblock == '' or sourceblock == nil) then
		comma_source = ' '
	else
		if (work_show ~= '' and work_show ~= nil) then
			comma_source = ', '
		else -- no work
			if author_show ~= '' and author_show ~= nil then
				comma_source = ','
			else -- neither author, nor work
				comma_source = ''
			end
		end -- close no work
	end -- close no sourceblock
end -- close comma_source = -

-- and comment ==================== at end
mycomment = args['+'] or ''		args['+'] = args['+'] or ''
if mycomment ~= '' and mycomment ~= nil then mycomment = mycomment end -- do not add comma. Editor will do if necessary

-- ================================ OUTPUT -- TODO CORRECT work is needed too
-- see above PARAMETERS
-- 1) separately give translation link
if (args['συγγ'] ~= '' and args['συγγ'] ~= nil) or (args['auth'] ~= '' and args['auth'] ~= nil) then
	output = trans(translator)
	-- this is used only for reference
-- this is usually placed UNDER quotations (variation ABOVE: Κείμενο & ... small, as all at /grc)
elseif (trans_id ~= '' and trans_id ~= nil) and onework == '1' -- marked at myauthor == 'Th' or myauthor = 'Th' and similar
then
	output = trans(translator)
elseif (trans_id_text ~= '' and trans_id_text ~= nil) and onework == '1' -- marked at myauthor == 'Th' or myauthor = 'Th' and similar
then
	output = '<small>Κείμενο & </small>' .. trans(translator)
elseif (trans_id ~= '' and trans_id ~= nil)	and (mywork ~= '' and mywork ~= nil) then 
	output = trans(translator)
elseif (trans_id_text ~= '' and trans_id_text ~= nil) and (mywork ~= '' and mywork ~= nil) then 
	output = '<small>Κείμενο & </small>' .. trans(translator)
elseif (trans_id ~= '' and trans_id ~= nil) or (trans_id_text ~= '' and trans_id_text ~= nil)
	and (mywork == '' or mywork == nil) then
	return errorhere('Πρέπει να συμπληρώσετε τον κωδικό έργου στη 2η θέση.<br>Please add code for work at 2nd position.')
-- END of greek-language.gr for grc pages, go on with normal section
-- 2) or output all the quotation data
else

-- ========== OMIT (also see quotation section, above)
if mytime == '-' then time = '' end

if args['0'] == '-' then
	quotation = ''
	time = ''
end

mynocat = args['00'] or args['nocat'] or ''
	-- This is used at quotation (see above) to take away categories with 00=- or with nocat=1

if args['000'] == '-'  or args['nodata'] == '1' then
	quotation = '' time = '' biblink = '' author_show = '' 
	comma_work = '' work_show = '' comma_source = ''
end

-- omit author, when multiple works quoted -- check [[ἄρχων]]
	-- allow the  bibllink, not the comma_work
mynoauthor = args['noauthor'] or ''
-- THIS does not work args['author'] or ''  args['author'] == '-'
	if args['noauthor'] == '1' then
		author_show = ''
		comma_work = ''
	end

output = quotation .. ' ' .. time ..  '<span style="font-size:88%;">' .. biblink .. ' ' 
.. author_show .. comma_work .. work_show
.. comma_source .. frame:preprocess(sourceblock) ..  mycomment .. '</span>'


end -- close if trans


return output
end -- close function


return export