Module:qlu-pron: Difference between revisions

No edit summary
No edit summary
Line 268: Line 268:
function merge_tables(foo, bar)
function merge_tables(foo, bar)
     local merged = {}
     local merged = {}
    -- Preserve the 'dialectal' field from the first table
    if foo.dialectal and not bar.dialectal then
        merged.dialectal = foo.dialectal
    end


     for key, value in pairs(foo) do
     for key, value in pairs(foo) do
Line 284: Line 279:
     end
     end


    -- Merge anything that bar has that foo does not
     for key, value in pairs(bar) do
     for key, value in pairs(bar) do
         if merged[key] == nil then
         if merged[key] == nil then
Line 319: Line 313:


     local ret = separate_word(term)
     local ret = separate_word(term)
    if not ret then return "oops" end
      
      
     local IPA_args = {{pron = '/' .. (ret.phonemic or "test") .. '/', a = "Standard Ravennese"}, {pron = '[' .. (ret.phonetic or "test") .. ']'}}
     local IPA_args = {{pron = '/' .. (ret.phonemic or "test") .. '/', a = "Standard Ravennese"}, {pron = '[' .. (ret.phonetic or "test") .. ']'}}
Line 327: Line 322:
end
end


    if ret and ret.phonemic then
return "* " .. m_IPA.format_IPA_full({ lang = lang, items = IPA_args })
    return "* " .. m_IPA.format_IPA_full({ lang = lang, items = IPA_args })
else
    return "Oops, something went wrong."
end
end
end


return export
return export