Module:etymology-only languages, csv format

Hello, you have come here looking for the meaning of the word Module:etymology-only languages, csv format. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:etymology-only languages, csv format, but we will also tell you about its etymology, its characteristics and you will know how to say Module:etymology-only languages, csv format in singular and plural. Everything you need to know about the word Module:etymology-only languages, csv format you have here. The definition of the word Module:etymology-only languages, csv format will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:etymology-only languages, csv format, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

This module complements Module:list of languages, csv format to include Etymology-only languages. It generates the list at Wiktionary:Etymology-only languages, csv format.

Beta: Columns subject to change.


local languages = require("Module:languages/data/all")
local families = require("Module:families/data")
local etym_data = require('Module:etymology_languages/data')

-- based on Module:list_of_languages

local export = {}

function export.show(frame)
    local rows = {}

    local codes_list = {}
    local items = {}

    for code, data in pairs(etym_data) do
        if not codes_list then
            codes_list = {}
            table.insert(items, data)
        end
        table.insert(codes_list, code)
    end

    table.sort(items, function (apple, orange)
            return apple < orange
        end)

    local function make_parent_link(code)
        if languages then
            return (languages)
        elseif families then
            return (families)
        elseif etym_data then
            return (etym_data)
        elseif code then
            return '<code>' .. code .. '</code>'
        else
            return ''
        end
    end

    local sep = ";"
    local minor_sep = ","

    local column_names = "line" ..sep.. "code" ..sep.. "canonical name" ..sep..
        "parent" ..sep.. "other names"

    for line, data in ipairs(items) do
        local codes = codes_list

        table.sort(codes)

        local row = {}

        table.insert(row, line)
        table.insert(row, table.concat(codes, minor_sep))
        table.insert(row, data)
        table.insert(row, make_parent_link(data))
        table.insert(row, data.otherNames and table.concat(data.otherNames, minor_sep) or "")
        
        table.insert(rows, table.concat(row, sep))
    end
    return "<pre>\n" .. column_names .. "\n" .. table.concat(rows, "\n") .. "</pre>"
end

return export