From 999121f44710151c8ac8a9c0a223e76ed6859ede Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 19 Mar 2015 19:48:53 -0700 Subject: Compile 3/19 --- compile.lua | 34 ++++++++++++++++++++++++++++++---- index.html | 2 +- js/lozenge.js | 4 +--- lappel-du-vide.html | 4 ++-- src/lappel-du-vide.txt | 4 ++-- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/compile.lua b/compile.lua index 765f348..c02566e 100644 --- a/compile.lua +++ b/compile.lua @@ -5,9 +5,8 @@ -- ((OR WHATEVER YOU CALL IT, GAHD)) -- vim: fdm=indent -dir = "/d/Copy/writing/autocento/" - function filterout (list, filter) + -- Remove elements that match filter local output = {} for _,v in ipairs(list) do if not string.match(v, filter) then @@ -18,12 +17,14 @@ function filterout (list, filter) return output end function intable (table, item) + -- Find out if an element's in a table for k,v in pairs(table) do if v == item then return k end end return false end function tabsub (table, pattern, replace) + -- Replace a pattern in all table values local output = {} for k,v in pairs(table) do output[k] = v:gsub(pattern, replace) @@ -32,6 +33,7 @@ function tabsub (table, pattern, replace) end function compile (files, output_fmt, extension, template, args) + -- Run pandoc on file list local errors = {} if template then table.insert(args, 'template="'..template..'"') end for _, file in pairs(files) do @@ -50,6 +52,7 @@ function compile (files, output_fmt, extension, template, args) end function move (files, new_dir) + -- Move files to destinations local exe = {} for _,file in pairs(files) do print("Moving "..file.." to "..new_dir.."/ ..") @@ -60,16 +63,20 @@ function move (files, new_dir) end function lozenge (files) + -- Update lozenge.js file list local output = 'var files=[' for _,file in pairs(files) do output = output .. file:gsub('.*', '"%0",') end + output = output:gsub('"",','') output = output:gsub(',$', ']') return output end - +-- BEGIN MAIN STUFF HERE local files = filterout(arg, '^%-') if not files or #files == 0 then + -- Error: need files to work on! + -- TODO: don't need files if only arg is -lozenge print("> No file list. WUT?") os.exit(1) end @@ -98,5 +105,24 @@ if intable(args, '-river') then end if intable(args, '-lozenge') then print("Updating lozenge.js with file list ... ") - -- TODO + local f = assert(io.open("js/lozenge.js", "r")) + local tloz = {} + local HTMLs = io.popen("ls *.html") + local lozfs = {} + for line in HTMLs:lines() do + table.insert(lozfs, line) + end + for line in f:lines() do + if line:find("var files=") then + table.insert(tloz, lozenge(lozfs)) + else + table.insert(tloz, line) + end + end + f:close() + -- And write the file we've just read + local _f = assert(io.open("js/lozenge.js", "w")) + _f:write(table.concat(tloz, "\n")) + _f:close() + print("Done.") end diff --git a/index.html b/index.html index b6cbbbf..3ebba39 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ about.setAttribute("href", files[which]); about.setAttribute("title", "About the author"); } - window.onload = function () { _about() } + window.onload = function () { _about(); _lozenge() } </script> <!--[if lt IE 9]> diff --git a/js/lozenge.js b/js/lozenge.js index d600d24..389d392 100644 --- a/js/lozenge.js +++ b/js/lozenge.js @@ -6,7 +6,7 @@ function _lozenge() { var lozenge = document.getElementById('lozenge'); // array with all files {{{ - var files=["100-lines.html", "about-the-author.html", "amber-alert.html", "and.html", "angeltoabraham.html", "apollo11.html", "arspoetica.html", "art.html", "axe.html", "big-dipper.html", "boar.html", "boy_bus.html", "building.html", "call-me-aural-pleasure.html", "cereal.html", "cold-wind.html", "creation-myth.html", "deadman.html", "death-zone.html", "deathstrumpet.html", "dream.html", "early.html", "elegyforanalternateself.html", "epigraph.html", "ex-machina.html", "exasperated.html", "father.html", "feedingtheraven.html", "finding-the-lion.html", "fire.html", "found-typewriter-poem.html", "hands.html", "hard-game.html", "hardware.html", "howithappened.html", "howtoread.html", "hymnal.html", "i-am.html", "i-think-its-you.html", "i-wanted-to-tell-you-something.html", "in-bed.html", "index.html", "initial-conditions.html", "january.html", "joke.html", "lappel-du-vide.html", "largest-asteroid.html", "last-bastion.html", "last-passenger.html", "leaf.html", "leg.html", "likingthings.html", "listen.html", "love-as-god.html", "lovesong.html", "man.html", "moon-drowning.html", "moongone.html", "mountain.html", "movingsideways.html", "music-433.html", "no-nothing.html", "notes.html", "nothing-is-ever-over.html", "onformalpoetry.html", "options.html", "ouroboros_memory.html", "paul.html", "philosophy.html", "phone.html", "planks.html", "plant.html", "poetry-time.html", "prelude.html", "problems.html", "proverbs.html", "punch.html", "purpose-dogs.html", "question.html", "real-writer.html", "reports.html", "riptide_memory.html", "ronaldmcdonald.html", "roughgloves.html", "sapling.html", "seasonal-affective-disorder.html", "sense-of-it.html", "serengeti.html", "shed.html", "shipwright.html", "sixteenth-chapel.html", "snow.html", "something-simple.html", "spittle.html", "squirrel.html", "stagnant.html", "statements-frag.html", "stayed-on-the-bus.html", "stump.html", "swansong-alt.html", "swansong.html", "swear.html", "table_contents.html", "tapestry.html", "telemarketer.html", "the-night-we-met.html", "the-sea_the-beach.html", "theoceanoverflowswithcamels.html", "time-looks-up-to-the-sky.html", "todaniel.html", "toilet.html", "toothpaste.html", "treatise.html", "underwear.html", "wallpaper.html", "weplayedthosegamestoo.html", "when-im-sorry-i.html", "window.html", "words-meaning.html", "worse-looking-over.html", "writing.html", "x-ray.html", "yellow.html"] +var files=["100-lines.html","README.html","about-the-author.html","about_author.html","amber-alert.html","and.html","angeltoabraham.html","apollo11.html","arspoetica.html","art.html","axe.html","big-dipper.html","boar.html","boy_bus.html","building.html","call-me-aural-pleasure.html","cereal.html","cold-wind.html","collage-instrument.html","common-titles.html","creation-myth.html","deadman.html","death-zone.html","deathstrumpet.html","dollywood.html","dream.html","early.html","elegyforanalternateself.html","epigraph.html","ex-machina.html","exasperated.html","father.html","feedingtheraven.html","finding-the-lion.html","fire.html","first-lines.html","found-typewriter-poem.html","hands.html","hard-game.html","hardware.html","howithappened.html","howtoread.html","hymnal.html","i-am.html","i-think-its-you.html","i-want-to-say.html","i-wanted-to-tell-you-something.html","in-bed.html","index.html","initial-conditions.html","january.html","joke.html","lappel-du-vide.html","largest-asteroid.html","last-bastion.html","last-passenger.html","leaf.html","leg.html","likingthings.html","listen.html","love-as-god.html","lovesong.html","man.html","manifesto_poetics.html","moon-drowning.html","moongone.html","mountain.html","movingsideways.html","music-433.html","no-nothing.html","notes.html","nothing-is-ever-over.html","on-genre-dimension.html","onformalpoetry.html","options.html","ouroboros_memory.html","paul.html","peaches.html","philosophy.html","phone.html","planks.html","plant.html","poetry-time.html","prelude.html","problems.html","proverbs.html","punch.html","purpose-dogs.html","question.html","real-writer.html","reports.html","riptide_memory.html","ronaldmcdonald.html","roughgloves.html","sapling.html","seasonal-affective-disorder.html","sense-of-it.html","serengeti.html","shed.html","shipwright.html","sixteenth-chapel.html","snow.html","something-simple.html","spittle.html","squirrel.html","stagnant.html","statements-frag.html","stayed-on-the-bus.html","stump.html","swansong-alt.html","swansong.html","swear.html","table_contents.html","tapestry.html","telemarketer.html","the-night-we-met.html","the-sea_the-beach.html","theoceanoverflowswithcamels.html","time-looks-up-to-the-sky.html","todaniel.html","toilet.html","toothpaste.html","treatise.html","underwear.html","walking-in-the-rain.html","wallpaper.html","weplayedthosegamestoo.html","what-we-are-made-of.html","when-im-sorry-i.html","window.html","words-irritable-reaching.html","words-meaning.html","worse-looking-over.html","writing.html","x-ray.html","yellow.html"] // }}} var index = Math.floor(Math.random() * files.length); @@ -25,5 +25,3 @@ function _lozenge() { window.onload = function () { _lozenge() }; - - diff --git a/lappel-du-vide.html b/lappel-du-vide.html index dec8b37..56e3912 100644 --- a/lappel-du-vide.html +++ b/lappel-du-vide.html @@ -38,9 +38,9 @@ <!-- epigraph --> <div class="epigraph"> - <a href="http://books.google.com/books?id=yybDMC0TRIwC&pg=PR12&lpg=PR12#v=onepage&q&f=false">You can never go home again.</a> + <a href="http://books.google.com/books?id=yybDMC0TRIwC&pg=PR12&lpg=PR12#v=onepage&q&f=false">Don’t you know you can’t go home again?</a> - <div class="attrib">Thomas Wolfe</div> + <div class="attrib">Ella Winter</div> </div> </div> </header> diff --git a/src/lappel-du-vide.txt b/src/lappel-du-vide.txt index 7630b4c..49c7f2d 100644 --- a/src/lappel-du-vide.txt +++ b/src/lappel-du-vide.txt @@ -3,8 +3,8 @@ title: L'appel du vide genre: prose epigraph: - content: You can never go home again. - attrib: Thomas Wolfe + content: Don't you know you can't go home again? + attrib: Ella Winter link: 'http://books.google.com/books?id=yybDMC0TRIwC&pg=PR12&lpg=PR12#v=onepage&q&f=false' project: -- cgit 1.4.1-21-gabe81