Module:Books/referenceData

local references = { --Missing the extra names of WxS/SxW, as it's unclear to whom the names should be redirected. --Additionally missing a few specific names for Hours which are hard to disambiguate, "Coil", "Wolf", etc.   {["Hours"] = {"hour", "hours"}}, {["The Lithomachy"] = {"extirpation", "the destruction of the Axe's loved ones", "the destruction of the gods-who-were-stone"}}, {["Sovereigns of the Leashed Flame"] = {"Sovereigns of the Leashed Flame", "Children of the Leashed Flame"}}, {["The Moth"] = {"the Moth", "Dapple-King"}}, {["The Witch-and-Sister"] = {"Witch-and-Sister"}}, {["The Sister-and-Witch"] = {"Sister-and-Witch"}}, {["The Twins"] = {"The Twins", "Two-One"}}, {["The Door in the Eye"] = {"The Door-in-the-Eye", "The Watchman"}}, {["The Velvet"] = {"Velvet", "the Black-Flax", "Moldywarp", "burrowing secret-keeper"}}, {["The Malachite"] = {"the Malachite", "Ring-Yew", "the Yew", "a great yew", "Honey-Tree"}}, {["The Thunderskin"] = {"Thunderskin", "Heart Relentless", "Vigilant Storm", "Empty-Handed Hunter", "Marsyas", "a great musician", "a rash musician"}}, {["The Mother of Ants"] = {"Mother of Ants", "Daughter of Venoms", "Key-Serpent", "She who Opens", "a seven-titled goddess", "a serpent-goddess", "his priestess-patron"}}, {["The Colonel"] = {"Colonel", "Cartographer of Scars", "Chiliarch", "Scarred Captain", "The Captain", "Tribune of Scars", "The Tribune", "The Scarred Tribune", "Scarred Man", "a warrior", "a blind God"}}, {["The Lionsmith"] = {"The Lionsmith", "Golden General"}}, {["The Elegiast"] = {"Elegiast", "Ivory Dove", "The Dove"}}, {["The Beachcomber"] = {"Beachcomber", "The Beach-Crow", "Beachcrow", "masked Crow"}}, {["The Meniscate"] = {"Meniscate", "the Mirror-Queen"}}, {["The Sun-in-Rags"] = {"Sun-in-Rags", "Sun in Rags"}}, {["The Horned-Axe"] = {"Horned-Axe", "Horned Axe", "the Axe", "the Horned"}}, {["The Madrugad"] = {"Madrugad", "the chilly winter dawn", "Chione"}}, {["The Red Grail"] = {"Red Grail", "The Grail", "The Great Mother", "The Red Mother", "The Mountain-Mother", "The Lion-Throned One", "She who Bleeds and Bears", "The Red Cup", "broken cups, every one painted red"}}, {["The Vagabond"] = {"Vagabond", "The Centipede", "The Laughingthrush", "The Sight-Thief", "The Pilgrim"}}, {["The Forge of Days"] = {"Forge of Days", "The Forge", "The Forge of Dayes", "The Unburnt God", "The Burning Queen", "The Leashed Flame"}}, {["The Egg Unhatching"] = {"Egg Unhatching", "The First Egg"}}, {["The Seven-Coils"] = {"Seven-Coiled", "Seven-Coils"}}, {["The Sun-in-Splendour"] = {"Sun-in-Splendour", "The Sun", "The True Sun", "The Sunne"}}, {["The Wheel"] = {"Wheel", "thunder-king", "protector of the world"}}, {["The Tide"] = {"Tide"}}, {["The Flint"] = {"Flint"}}, {["The Wolf Divided"] = {"Wolf Divided", "Wolf-Divided"}}, {["The Flowermaker"] = {"Flowermaker"}}, {["Sisterhood of the Knot"] = {"Sisterhood of the Knot", "Knot Sisterhood", "Triple Sisterhood"}}, {["Church of the Unconquered Sun"] = {"Church of the Unconquered Sun", "Church Solar", "Enactors of Solar Law"}}, {["Obliviates"] = {"Obliviates", "Ordo Limiae", "House of Lethe"}}, {["Alukites"] = {"Alukites", "Crime of the Sky", "Alukite", "Empousai", "Empousa", "Soucouyants", "Soucouyant"}}, {["The Intercalate"] = {"Intercalate", "Division"}}, {["Shadowless Empire"] = {"Shadowless Empire", "Shadowless Kings", "Shadowless King", "Achaemenids"}}, {["Great Hooded Princes"] = {"Great Hooded Princes", "Hooded Princes", "hooded serpents"}}, {["Julian Coseley"] = {"Julian Coseley", "Coseley", "JC"}}, {["Worm"] = {"Worms", "Worm"}}, {["Claude Hersault"] = {"Claude Hersault", "Hersault"}}, {["Christopher Illopoly"] = {"Christopher Illopoly", "Illopoly"}}, {["Teresa"] = {"Teresa Galmier", "Galmier", "Baldomera"}}, {["The Glory"] = {"Glory"}}, {["Mansus"] = {"Mansus", "House of the Sun", "temple behind the world", "House without Walls", "House above the Forest"}}, {["Way: The Wood"] = {"a Wood", "the Wood", "its Wood", "Temple of the Wheel"}}, {["Way: The White Door"] = {"White Door", "Orchard of Lights", "Lodge of the Sage Knight"}}, {["Way: Through the Stag Door"] = {"Stag Door", "Ascent of Knives", "Painted River", "painted the river"}}, {["Way: The Spider's Door"] = {"Spider's Door", "Serpent's Gate", "Concursum", "Chamber of Ways", "Malleary"}}, {["Way: The Peacock's Door"] = {"Peacock Door", "Red Church", "Worm Museum"}}, {["wikipedia:Elagabalus"] = {"Emperor Elagabalus", "Elagabalus"}}, {["wikipedia:Didius Julianus"] = {"Didius Julianus"}} }

local function generateReferenceTable(t) local result = {}

for _, t2 in ipairs(t) do       for link, texts in pairs(t2) do            for _, text in ipairs(texts) do                table.insert(result, {                    reference = text:lower,                    link = link                }) end end end

return result end

return generateReferenceTable(references)