UNPKG

tolkien-ipsum

Version:

A whimsical Tolkien-style Lorem Ipsum generator

30 lines (29 loc) 5.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateTolkienIpsum = generateTolkienIpsum; const texts = { shire: 'It was a fair morning when Bilbo Baggins decided he’d rather not do anything of importance at all, save a bit of gardening and perhaps a scone with plum jam. Lorem ipsum elevenses sit amet, sausages turned with care over a warm hearth. Consectetur ale and honey-cakes, bibendum pipe-weedum under Party Tree shade. There was talk of mushrooms down Bywater way, and no small gossip about the new wheelbarrow Tom Cotton had fashioned from old cart wood. ' + 'Adipiscing hillward hearts, they say, are best fed and left in peace. Curabitur the kettle sings and the rooster crows, tales grow like ivy on a Took’s back door. Nulla dolor beyond the Brandywine worth crossing for, save if one must—and even then, only if packed with enough seed-cakes and a map scrawled by someone else. Pellentesque tales of dragons and far lands are fine in books, but potatoes boil more easily than adventure. ' + 'Sed est Hobbiton, a land of tilled rows and dozing cats. Elvetulien tulien, as old Bilbo once sang after a drop of Old Winyards too many, though none but Frodo knew the meaning. The world beyond may be wide and wild, but here in the Shire, lorem is gentle, and ipsum is buttered, preferably with a slice of cheddar and a second helping.', rivendell: 'Lorem lómelindë, dolor silmë arë, sit i’amar calima nai. Beneath the starlit boughs of Lothlórien, where time wavers and gold falls like rain from mallorn trees, the Elves walk. Consectetur elenya i hauta, quénar ve laire-lindalë; and the moonlight whispers of forgotten names: Nimrodel, Eärwen, Idril Celebrindal. ' + 'Adipiscing through the glades of Imladris, they sing: A Elbereth Gilthoniel, silivren penna míriel… and the air shivers with memory. Nulla mortal can dwell where the light of Valinor once touched the world, and yet the Elves remember. Their dolor is not despair, but longing—a wound wrought not by blade, but by the sea’s call and the fading of the West. ' + 'Quis silmarilli nunc rë, lost to wrath and fire. Yet the leaves still fall, and the stars still gleam. Elen sila lumenn’ omentielvo, for all meetings are fated, and even lorem shall pass into legend. The forests are dim now, the ships sail fewer, but until the last song is sung, the Elves will remember.', moria: 'Beneath the stone-rooted mountains, lorem rang like hammers in the deep. Baraz, khazâd! Durin’s folk delved halls brighter than day and deeper than fear. Sit amet fire-hewn stone and gold-wrought lintel, consectetur uzbadulûk. From Ered Luin to Erebor, the axes echoed, and greed flickered like flame on mithril veins. ' + 'Adipiscing iron-bound, nor given to idle tongue, the Dwarves speak in deeds carved upon the bones of Arda. “Khazâd ai-mênu!” they cry, and enemies flee. Nulla est worth without craft, nor honor without stone. In bar-en-narag they kept their secrets, and the names of their fathers before them. Sed lorem was not of song, but of forge, of steel drawn bright from fire. ' + 'Grundi fundînul, dolur bâr. The darkness took Moria, yet the Dwarves do not forget. Every hammer-fall a remembrance, every gem-set helm a legacy. The world may shift like sand for Men and Elves, but Khazâd remain. Ever downward they delve, and ever upward rises their pride.', gondor: 'Lorem ipsum, long have the towers of Gondor stood, but time weathers even stone. Sit the citadel of kings beneath a fading banner, dolor sung in high speech from the White Tower. Consectetur hope is kindled like a flame in the hearts of Men, flickering against the winds of shadow. Minas Anor once gleamed with glory, now it waits. ' + 'Adipiscing is the road to ruin or to renown, and none may know its end. In Edoras, horns call through the Golden Hall, and mead flows as songs recall the deeds of Eorl and Helm. Nulla strength is found in solitude, but in kin and in courage. Sed the line of Elendil bears the weight of Westernesse, and the shadow stretches long. ' + 'Quis lorem rides swift with the Rohirrim, ut dolor marches in the hearts of Númenor’s sons. But in the hour of doom, it is not despair that drives Men—it is resolve. Through ruin to glory, through darkness to dawn. The swords of Men are sharp, and though kingdoms fall, their spirit endures.', mordor: 'Ash nazg durbatulûk, ash nazg gimbatul. Lorem ipsum in the land of shadow, dolor beneath the Eye that does not sleep. Sit the stones cracked and the skies choked with smoke, consectetur fear is forged in the cracks of doom. Barad-dûr stands, tall and terrible, a finger of flame against the stars. ' + 'Adipiscing the will of one, sed dolor est domination. The tongues of the West falter, the forests burn, and nulla escape from the grasp of the Nameless. In the language not spoken, only screamed—lugbúrz, globûrz, thrakatûlûk!—the dark commands are etched in iron. The sky weeps ash, and even time seems enslaved. ' + 'Quis lorem est forgotten in the cries of the conquered. Yet the will remains. In the east, the shadow lengthens. Ut dolor est inevitable. And in the Black Speech it is written: "Bagronk thrâk ghâsh, snaga ûk!"—The pit opens, and the fire takes all.' }; function generateTolkienIpsum(flavor, wordCount = 100) { const sourceText = texts[flavor]; const words = sourceText.split(/\s+/); let resultWords = []; while (resultWords.length < wordCount) { resultWords = resultWords.concat(words); } return resultWords.slice(0, wordCount).join(' '); }