about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compile.lua34
-rw-r--r--index.html2
-rw-r--r--js/lozenge.js4
-rw-r--r--lappel-du-vide.html4
-rw-r--r--src/lappel-du-vide.txt4
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 @@
5-- ((OR WHATEVER YOU CALL IT, GAHD)) 5-- ((OR WHATEVER YOU CALL IT, GAHD))
6-- vim: fdm=indent 6-- vim: fdm=indent
7 7
8dir = "/d/Copy/writing/autocento/"
9
10function filterout (list, filter) 8function filterout (list, filter)
9 -- Remove elements that match filter
11 local output = {} 10 local output = {}
12 for _,v in ipairs(list) do 11 for _,v in ipairs(list) do
13 if not string.match(v, filter) then 12 if not string.match(v, filter) then
@@ -18,12 +17,14 @@ function filterout (list, filter)
18 return output 17 return output
19end 18end
20function intable (table, item) 19function intable (table, item)
20 -- Find out if an element's in a table
21 for k,v in pairs(table) do 21 for k,v in pairs(table) do
22 if v == item then return k end 22 if v == item then return k end
23 end 23 end
24 return false 24 return false
25end 25end
26function tabsub (table, pattern, replace) 26function tabsub (table, pattern, replace)
27 -- Replace a pattern in all table values
27 local output = {} 28 local output = {}
28 for k,v in pairs(table) do 29 for k,v in pairs(table) do
29 output[k] = v:gsub(pattern, replace) 30 output[k] = v:gsub(pattern, replace)
@@ -32,6 +33,7 @@ function tabsub (table, pattern, replace)
32end 33end
33 34
34function compile (files, output_fmt, extension, template, args) 35function compile (files, output_fmt, extension, template, args)
36 -- Run pandoc on file list
35 local errors = {} 37 local errors = {}
36 if template then table.insert(args, 'template="'..template..'"') end 38 if template then table.insert(args, 'template="'..template..'"') end
37 for _, file in pairs(files) do 39 for _, file in pairs(files) do
@@ -50,6 +52,7 @@ function compile (files, output_fmt, extension, template, args)
50end 52end
51 53
52function move (files, new_dir) 54function move (files, new_dir)
55 -- Move files to destinations
53 local exe = {} 56 local exe = {}
54 for _,file in pairs(files) do 57 for _,file in pairs(files) do
55 print("Moving "..file.." to "..new_dir.."/ ..") 58 print("Moving "..file.." to "..new_dir.."/ ..")
@@ -60,16 +63,20 @@ function move (files, new_dir)
60end 63end
61 64
62function lozenge (files) 65function lozenge (files)
66 -- Update lozenge.js file list
63 local output = 'var files=[' 67 local output = 'var files=['
64 for _,file in pairs(files) do 68 for _,file in pairs(files) do
65 output = output .. file:gsub('.*', '"%0",') 69 output = output .. file:gsub('.*', '"%0",')
66 end 70 end
71 output = output:gsub('"",','')
67 output = output:gsub(',$', ']') 72 output = output:gsub(',$', ']')
68 return output 73 return output
69end 74end
70 75-- BEGIN MAIN STUFF HERE
71local files = filterout(arg, '^%-') 76local files = filterout(arg, '^%-')
72if not files or #files == 0 then 77if not files or #files == 0 then
78 -- Error: need files to work on!
79 -- TODO: don't need files if only arg is -lozenge
73 print("> No file list. WUT?") 80 print("> No file list. WUT?")
74 os.exit(1) 81 os.exit(1)
75end 82end
@@ -98,5 +105,24 @@ if intable(args, '-river') then
98end 105end
99if intable(args, '-lozenge') then 106if intable(args, '-lozenge') then
100 print("Updating lozenge.js with file list ... ") 107 print("Updating lozenge.js with file list ... ")
101 -- TODO 108 local f = assert(io.open("js/lozenge.js", "r"))
109 local tloz = {}
110 local HTMLs = io.popen("ls *.html")
111 local lozfs = {}
112 for line in HTMLs:lines() do
113 table.insert(lozfs, line)
114 end
115 for line in f:lines() do
116 if line:find("var files=") then
117 table.insert(tloz, lozenge(lozfs))
118 else
119 table.insert(tloz, line)
120 end
121 end
122 f:close()
123 -- And write the file we've just read
124 local _f = assert(io.open("js/lozenge.js", "w"))
125 _f:write(table.concat(tloz, "\n"))
126 _f:close()
127 print("Done.")
102end 128end
diff --git a/index.html b/index.html index b6cbbbf..3ebba39 100644 --- a/index.html +++ b/index.html
@@ -20,7 +20,7 @@
20 about.setAttribute("href", files[which]); 20 about.setAttribute("href", files[which]);
21 about.setAttribute("title", "About the author"); 21 about.setAttribute("title", "About the author");
22 } 22 }
23 window.onload = function () { _about() } 23 window.onload = function () { _about(); _lozenge() }
24 </script> 24 </script>
25 25
26 <!--[if lt IE 9]> 26 <!--[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 @@
6function _lozenge() { 6function _lozenge() {
7 var lozenge = document.getElementById('lozenge'); 7 var lozenge = document.getElementById('lozenge');
8 // array with all files {{{ 8 // array with all files {{{
9 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"] 9var 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"]
10 // }}} 10 // }}}
11 11
12 var index = Math.floor(Math.random() * files.length); 12 var index = Math.floor(Math.random() * files.length);
@@ -25,5 +25,3 @@ function _lozenge() {
25window.onload = function () { 25window.onload = function () {
26 _lozenge() 26 _lozenge()
27}; 27};
28
29
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 @@
38 38
39 <!-- epigraph --> 39 <!-- epigraph -->
40 <div class="epigraph"> 40 <div class="epigraph">
41 <a href="http://books.google.com/books?id=yybDMC0TRIwC&amp;pg=PR12&amp;lpg=PR12#v=onepage&amp;q&amp;f=false">You can never go home again.</a> 41 <a href="http://books.google.com/books?id=yybDMC0TRIwC&amp;pg=PR12&amp;lpg=PR12#v=onepage&amp;q&amp;f=false">Don’t you know you can’t go home again?</a>
42 42
43 <div class="attrib">Thomas Wolfe</div> 43 <div class="attrib">Ella Winter</div>
44 </div> 44 </div>
45 </div> 45 </div>
46 </header> 46 </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
3genre: prose 3genre: prose
4 4
5epigraph: 5epigraph:
6 content: You can never go home again. 6 content: Don't you know you can't go home again?
7 attrib: Thomas Wolfe 7 attrib: Ella Winter
8 link: 'http://books.google.com/books?id=yybDMC0TRIwC&pg=PR12&lpg=PR12#v=onepage&q&f=false' 8 link: 'http://books.google.com/books?id=yybDMC0TRIwC&pg=PR12&lpg=PR12#v=onepage&q&f=false'
9 9
10project: 10project: