User:Sarri.greek/lab/test1

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Sarri.greektalk ref - audio - notes - nouns - verbs - αβγόαἴρω/αἱρῶΤ' αστέρι του βοριά (song)
CATpg.en :: @elpg.elfontstesttest1vern.labverbs.testtArT1·aT3, T4menu


Page User:Sarri.greek/test/style.css must have content model "Sanitized CSS" for TemplateStyles (current model is "CSS"). Horizontal Table of Contents for wiktionaries. Horizontal by language (for 2 to 6? languages).
Also, for toclimit2 as in wikt:en:te for 70 plus languages, just place them in a horizontal row with commata.
Headings in wiktionaries are standard and repetitive.

example

[edit]

as a wikt:el:Template:test-ol - wikt:el:Template:ol-multi/style.css - tests

  • trying not to use : for li or | for td etc. I do not know where that : is from, what height it has, etc. All colours, heights, sizes must be redone and shown for this tocwikt only.
  • as standalone as possible.

I cannot make it 'read' and produce from top to bottom a list of all headings between double, triple, quadruple (up to 6?) = = = = symbols.
Plan

Help

(example as in lemma σκληρός) - el.wikt.test wikt:el:Module:toc-test wikt:el:Template:toc-test, examples of how it looks at wikt:el:Template:test-ol

Contents          
  1. Ancient Greek
    1. Etymology
    2. Pronunciation
    3. Adjective
      1. Inflection
      2. Antonyms
      3. Derived terms
      4. Descendants
    4. Further reading
  1. Greek
    1. Etymology
    2. Pronunciation
    3. Adjective
      1. Declension
      2. Related terms
    4. Further reading
But with full numbers like: wikt:el:Template:ol-multi/style.css

tocwikt

[edit]

tried a bit at https://el.wiktionary.org/wiki/Module:toc-test

-- make hotizontal Tables of Contents for wiktionaries
	-- find section-titles
	-- formate texts and links
	-- formate table
	-- make Templates
-------------------------
local export = {}

function export.main(frame)

-- get the page we are in
	local page = mw.title.getCurrentTitle()
	page.name = page.text:match( "^%s*(.-)%s*$" )
-- read the contents of this page
	local content = "\n" .. page:getContent() -- by 'content' he means the wikitext source, not the output. 

-- get only things that are between ==(or more, up to 6======) and ==(or more, up to 6======)
-- NOOO if find the sequence ==(ormore)+xxxxanycharacter+==(ormore) then

	local match = content:gmatch("\n==([^\n]+)") -- \n = newlinestarts ^ = except what is in this [..] + = at least one or more.
	while true do
		local header = match()
		if not header then break end
		-- do work here
		return header -- it produces the first L2 eg ==Greek== like this: Greek==
-- .. match() .. match() .. match() .. match() -- it procedes to next if I write many times match() e.g. =Etymology===
-- need to sepcify how many == at beginning?
	end


--------- get sectiontext
-- find the titles of sections by the number of equal  = = = symbols
-- there is no =sectiontext= with one equal symbol (this is the actual page)
-- if find in page "=="sectiontext"==" then get "sectiontext" this is id = 'L2' 
-- Do it with the results like above
-- if match xxxx==(only2, no =) then 
-- sectiontext = xxx id=L2
-- if L2 then write class="L2" <li class="L2">

-- next
-- if find in page "==="sectiontext"===" then get "sectiontext"  id L3
-- if find in page "===="sectiontext"====" then get "sectiontext"  id L4
-- if find in page "====="sectiontext"=====" then get "sectiontext"  id L5



-- =========== Formate text, make links ============ --

--------- get titletext from sectiontext
-- get xxxx  = any character except | or {}
-- according to each case, e.g. if sectiontext = {{ετυμολογία}} then titletext = Ετυμολογία

-- for all wikts
-- if find in sectiontext [[yyyy|xxxx]] then titletext = xxxx
-- if find in sectiontext [[xxxx]] then titletext = xxxx
-- if find xxxxx (with no [ { |) then titletext = xxxx
-- for en.wikt
-- if find in sectiontext {{l|yy|xxxx}} then titletext = xxxx
-- if xxxx1 {{l|yy|xxx}} xxxx3 then titletxt =  xxx1 xxx xxx3

-- for Your wikt, add more in similar way
-- el.wikt
-- if find in sectiontext  "{{l|xxxx|yy}}" then title text = xxxx
-- if find {{-xxx-}} then titletext = require("Module:Languages").iso).link (this is at el.wikt the title of headings of languages
-- if find {{xxxxx}}
	-- if xxx = ετυμολογία then write Ετυμολογία ...etc These are heading templates at el.wikt.
-- if "{{l|zzzz|yy|xxxx}}" then titletext = xxxx
--...etc
-- are there external links??


--------- make title repeats OK
-- If a titletext is repeated add _2 _3 _4... to it e.g. Adjective, Adjective_2
-- do not start with Adjective_1
-- if find titletext more than once then
-- ignore the first one
-- start at the second and add underscore and number two _2
-- find next and add +1 
-- call it titlerepeatsOK

--------- make title fixed with underscores between the words of titletext e.g. Related terms = Related_terms
-- if find in titlerepeatsOK space then put _
-- call it titlefixed

--  =========== make list of all headings. put the titletexts li in sequence
-- start reading sectiontitles from top and place them in li /li
-- number them e.g. L2_1, L3_1, L3_2, L2_2 etc. editor will indicate which one he wants to break.column.

--------- make titlelink inner link with #
-- if titletext then titlelink is "[[#" .. titlefixed.. "|" ..  titletext .. "]]"


-- =========== general style for Table of Contents  ============ -- like a css
-- it is in a table
	-- it floats left + param float=right, center
	-- border dddddd
	-- background color f9f9f9
	-- fonx-size 92% for table, ol, li for all.
	-- line-height 1.5em, no different for ol or li
-- ol and li have same line-height (no particular padding top/bottom when an ol ends)


----------------------- functions

-- =========== for Template TOCwikt ============ --
-- function with columns
-- when no parameters, then it creates one column (like the old TOC did)
-- split the table in 2 columns // or for any number of columns // or for every L2
-------- make rules for column breaks, args for the editor
-- number all L2s L2-1
--e.g.   
--if  cols=2 the if id=L2-2  then write "</td><td style...><ol reset number -....><li>... titlelink .. </li>
--go to next L2
--if L2 == col, then </ol></td><td><ol><li style="counter-reset: item 1;">
--   if args['reset']  = L2_2 write </td><td><ol><li style="counter-reset: item 1;">
--   if args['reset']  = L2_3 write </td><td><ol><li style="counter-reset: item 2;">
-- ---------------------
-- or, it it is for all L2s
-- ... 


-- ========== ? with links to other pages========= --
-- or mixed: with links of current page
	-- plus from another page e.g. English (its L2 TOC) but Old English (L2Toc) from another page
-- for use in Appendices, with all links from other pages


-- =========== for Template TOCwikt horizontal ============ --
-- for pages with too many L2, use togeteher with  TOC limit
-- Example at page [[te]]
-- Use toclimit2.
-- Do not use ol, li or columns. Just write the titletxts in a row with comma. Just like the Contents.a-z are.

return export