summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2015-03-23 23:26:48 -0700
committerCase Duckworth2015-03-23 23:26:48 -0700
commit284c9020d6545b0de43d96c05e72bb6d97beb8d9 (patch)
treedc705091676ad480760320b433e3463bc514ab9d
parentCompile 3/19 (diff)
downloadautocento-284c9020d6545b0de43d96c05e72bb6d97beb8d9.tar.gz
autocento-284c9020d6545b0de43d96c05e72bb6d97beb8d9.zip
Add makefile (no tests yet)
-rw-r--r--css/common.css6
-rw-r--r--img/panorama-apollo11.jpgbin0 -> 720983 bytes
-rw-r--r--js/lozenge.js2
-rw-r--r--lua/compile-uff.lua208
-rw-r--r--src/apollo11.txt5
-rw-r--r--src/makefile24
-rw-r--r--src/words-irritable-reaching.txt16
-rw-r--r--words-irritable-reaching.html2
8 files changed, 253 insertions, 10 deletions
diff --git a/css/common.css b/css/common.css index 3212c67..8ae3f8b 100644 --- a/css/common.css +++ b/css/common.css
@@ -57,6 +57,12 @@ header {
57.content { 57.content {
58 line-height: 1.3em; 58 line-height: 1.3em;
59} 59}
60blockquote {
61 border-left: 1px solid gray;
62 padding-left: 2em;
63 margin-left: 2em;
64 font-style: italic;
65}
60nav { 66nav {
61 height: 24px; 67 height: 24px;
62 width: 100%; 68 width: 100%;
diff --git a/img/panorama-apollo11.jpg b/img/panorama-apollo11.jpg new file mode 100644 index 0000000..c56a109 --- /dev/null +++ b/img/panorama-apollo11.jpg
Binary files differ
diff --git a/js/lozenge.js b/js/lozenge.js index 389d392..6c4a27b 100644 --- a/js/lozenge.js +++ b/js/lozenge.js
@@ -24,4 +24,4 @@ var files=["100-lines.html","README.html","about-the-author.html","about_author.
24 24
25window.onload = function () { 25window.onload = function () {
26 _lozenge() 26 _lozenge()
27}; 27}; \ No newline at end of file
diff --git a/lua/compile-uff.lua b/lua/compile-uff.lua new file mode 100644 index 0000000..9da70b8 --- /dev/null +++ b/lua/compile-uff.lua
@@ -0,0 +1,208 @@
1#!/usr/bin/env lua
2-- A compiler for "Autocento of the breakfast table" by Case Duckworth
3-- check it in action at: www.autocento.me
4-- Usage: `lua compile.lua [options] <files>
5-- Where [options] are
6-- -- -html: compiles html files
7-- -- -river: compiles river files (only words, one per line)
8-- -- -lozenge: updates lozenge.js file
9-- vim: fdm=indent
10
11defaults = {}
12 defaults.dirs = {
13 root = "/d/Copy/projects/autocento/",
14 src = "/d/Copy/projects/autocento/src/",
15 lua = "/d/Copy/projects/autocento/lua/",
16 js = "/d/Copy/projects/autocento/js/",
17 css = "/d/Copy/projects/autocento/css/",
18 }
19 defaults.files = {
20 lozenge = defaults.dirs.js .. "lozenge.js",
21 }
22 defaults.formats = {
23 html = {
24 output_dir = defaults.dirs.root,
25 extension = "html",
26 pandoc_args = {
27 from = "markdown",
28 to = "html5",
29 template = ".template.html",
30 "smart",
31 "mathml",
32 "section-divs",
33 }
34 },
35 river = {
36 output_dir = defaults.dirs.root .. "river/",
37 extension = "river",
38 pandoc_args = {
39 from = "markdown",
40 to = defaults.dirs.lua.."river.lua",
41 },
42 },
43 }
44 defaults.compile_args = {
45 '-html',
46 '-river',
47 '-lozenge',
48 }
49helpers = {
50 -- Little helper functions
51 filter = function (list, filter)
52 -- Filter a list.
53 -- 1st return is list of terms that match.
54 -- 2nd return is list of terms that don't match.
55 local output_match = {}
56 local output_nomatch = {}
57 for _,v in ipairs(list) do
58 if string.match(v, filter) then
59 output_match[#output_match+1] = v
60 else
61 output_nomatch[#output_nomatch+1] = v
62 end
63 end
64 return output_match, output_nomatch
65 end,
66 in_table = function (table, term)
67 -- Search for term in table
68 for k,v in pairs(table) do
69 if v == term then
70 return k
71 end
72 end
73 return nil
74 end,
75 tsub = function (table, pattern, replace, i)
76 -- gsub on every term in a table
77 local output = {}
78 if i then -- 'i' option just does ipair part of table
79 for k,v in ipairs(table) do
80 output[k] = v:gsub(pattern, replace)
81 end
82 else
83 for k,v in pairs(table) do
84 output[k] = v:gsub(pattern, replace)
85 end
86 end
87 return output
88 end,
89 scandir = function (directory)
90 -- Find all files in a directory
91 local i, t, popen = 0, {}, io.popen
92 for filename in popen('ls -a "'..directory..'"'):lines() do
93 i = i+1
94 t[i] = filename
95 end
96 return t
97 end
98}
99
100function compile (files, format_args)
101 -- Run pandoc on <files>, producing <output_format>, with [pandoc_args].
102 local errors = 0
103 if not format_args then
104 format_args = defaults.formats[output_format]
105 end
106 print("Compiling files to "..format_args.extension.." ...")
107 args = format_args.pandoc_args
108 for _, file in pairs(files) do
109 local pandoc_run = {
110 'pandoc',
111 '-f', args.from,
112 '-t', args.to,
113 '-o',
114 file:gsub('%.%a+$', "."..format_args.extension)
115 }
116 if args.template then
117 table.insert(pandoc_run, '--template="'..args.template..'"')
118 end
119 for _,a in ipairs(args) do
120 pandoc_run[#pandoc_run+1] = a:gsub("^", "--")
121 end
122 table.insert(pandoc_run, file)
123 for k,v in pairs(pandoc_run) do
124 print(k, v)
125 end
126 if not os.execute(table.concat(pandoc_run, " ")) then
127 errors = errors+1
128 end
129 io.write(".")
130 end
131 print("Compiling "..#files.." files completed with "..errors.." errors.")
132end
133
134function move (files, destination)
135 -- Move files to destination
136 print("Moving files to "..destination.." ...")
137 local errors = 0
138 for _, file in pairs(files) do
139 if not os.execute("mv "..file.." "..destination) then
140 errors = errors+1
141 end
142 end
143 print("Moving "..#files.." completed with "..errors.." errors.")
144end
145
146function lozenge_list (files, blacklist)
147 -- Produce list for placement in lozenge.js
148 local output = {}
149 for _,file in pairs(files) do
150 -- table.insert(output, #output+1, file:gsub('.*', '"%0"'))
151 output[#output+1] = file:gsub(".*", '"%0",')
152 end
153 if blacklist then
154 for _,unwanted in pairs(blacklist) do
155 _,output = helpers.filter(files, unwanted)
156 end
157 end
158 output = table.concat(output, " ")
159 output = "var files = ["..output
160 output = output:gsub('"",', '')
161 output = output:gsub(",$", "]")
162 print(output)
163end
164
165local args, files = helpers.filter(arg, "^%-")
166if not files or #files == 0 then
167 -- Error: need files to work on!
168 -- TODO: don't technically need file list for -lozenge
169 print("ERROR: No file list.")
170 os.exit(1)
171end
172basenames = helpers.tsub(files, "^.*/", "")
173basenames = helpers.tsub(files, "%.%a+$", "")
174if not args or #args == 0 or args == { "-all" } then
175 args = defaults.compile_args
176end
177-- Option parsing
178if helpers.in_table(args, "-html") then
179 compile(files, defaults.formats.html)
180 move(helpers.tsub(basenames, "$", "%0.html"),
181 defaults.formats.html.output_dir)
182end
183if helpers.in_table(args, "-river") then
184 compile(files, defaults.formats.river)
185 move(helpers.tsub(basenames, ".*", "%0.river"),
186 defaults.formats.river.output_dir)
187end
188if helpers.in_table(args, "-lozenge") then
189 -- TODO: should probably break this out into a function
190 print("Updating lozenge.js file list...")
191 local htmls = helpers.filter(helpers.scandir(defaults.dirs.root),
192 "html$")
193 local f = assert(io.open(defaults.files.lozenge, "r"))
194 local buffer = {}
195 for line in f:lines() do
196 if line:find("var files=") then
197 table.insert(buffer, lozenge_list(htmls))
198 else
199 table.insert(buffer, line)
200 end
201 end
202 f:close()
203 -- Write the file we've just read
204 local F = assert(io.open(defaults.files.lozenge, "w"))
205 F:write(table.concat(buffer, "\n"))
206 F:close()
207 print("Done.")
208end
diff --git a/src/apollo11.txt b/src/apollo11.txt index 78e150b..8e4b522 100644 --- a/src/apollo11.txt +++ b/src/apollo11.txt
@@ -2,6 +2,11 @@
2title: On seeing the panorama of the Apollo 11 landing site 2title: On seeing the panorama of the Apollo 11 landing site
3genre: verse 3genre: verse
4 4
5ekphrastic:
6 image: "img/panorama-apollo11.jpg"
7 title: "Big deal."
8 link: "http://apod.nasa.gov/apod/ap141220.html"
9
5project: 10project:
6 title: Elegies for alternate selves 11 title: Elegies for alternate selves
7 css: elegies 12 css: elegies
diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..eefa4a3 --- /dev/null +++ b/src/makefile
@@ -0,0 +1,24 @@
1# Produce HTML & RIVER outputs with pandoc
2# Case Duckworth | autocento.me
3# inspired by Lincoln Mullen | lincolnmullen.com
4
5# Define directories, file lists, and options
6HTMLdir = ..
7RIVdir = ../river
8LUAdir = ../lua
9HTMLs := $(patsubst %.txt,%.html,$(wildcard *.txt))
10HTMopts = --template=$(HTMLdir)/.template.html
11HTMopts+= --smart --mathml --section-divs
12RIVERs := $(patsubst %.txt,%.river,$(wildcard *.txt))
13RIVopts =
14
15# Do everything
16all : $(HTMLs) $(RIVERs)
17
18# Generic rule for HTML targets and Markdown sources
19%.html : %.txt
20 pandoc $< -f markdown -t html5 $(HTMLopts) -o $(HTMLdir)/$@
21
22# Generic rule for RIVER targets and Markdown sources
23%.river : %.txt
24 pandoc $< -f markdown -t $(LUAdir)/river.lua $(RIVopts) -o $(RIVdir)/$@
diff --git a/src/words-irritable-reaching.txt b/src/words-irritable-reaching.txt index c616c95..97d3e8c 100644 --- a/src/words-irritable-reaching.txt +++ b/src/words-irritable-reaching.txt
@@ -29,14 +29,14 @@ Gilbert furthers Keats in asserting that no matter what we write, "the words / G
29In Gilbert's poem, though, he does reach after something. 29In Gilbert's poem, though, he does reach after something.
30In the second half of the poem he begins to imagine what the "mysterious Sumerian tablets" could be as poetry, instead of just "business records:" 30In the second half of the poem he begins to imagine what the "mysterious Sumerian tablets" could be as poetry, instead of just "business records:"
31 31
32> [...] My joy is the same as twelve 32> [...] My joy is the same as twelve \
33> Ethiopian goats standing in the morning light. 33> Ethiopian goats standing in the morning light. \
34> O Lord, thou art slabs of salt and ingots of copper, 34> O Lord, thou art slabs of salt and ingots of copper, \
35> as grand as ripe barley under the wind's labor. 35> as grand as ripe barley under the wind's labor. \
36> Her breasts are six white oxen loaded with bolts 36> Her breasts are six white oxen loaded with bolts \
37> of long-fibered Egyptian cotton. My love is a hundred 37> of long-fibered Egyptian cotton. My love is a hundred \
38> pitchers of honey. Shiploads of thuya are what 38> pitchers of honey. Shiploads of thuya are what \
39> my body wants to say to your body. Giraffes are this 39> my body wants to say to your body. Giraffes are this \
40> desire in the dark. 40> desire in the dark.
41 41
42This is my favorite part of the poem, and I think it's because Gilbert, like Hass, reaches for the specific in the general; he brings huge ideas like the Lord or Love or Joy into the specific images of salt, copper, or honey, or like he says at the end of his poem: "What we feel most has / no name but amber, archers, cinnamon, horses and birds." 42This is my favorite part of the poem, and I think it's because Gilbert, like Hass, reaches for the specific in the general; he brings huge ideas like the Lord or Love or Joy into the specific images of salt, copper, or honey, or like he says at the end of his poem: "What we feel most has / no name but amber, archers, cinnamon, horses and birds."
diff --git a/words-irritable-reaching.html b/words-irritable-reaching.html index 5657bd9..100c601 100644 --- a/words-irritable-reaching.html +++ b/words-irritable-reaching.html
@@ -46,7 +46,7 @@
46<p>There’s still a problem with language, however, to which Hass speaks by the end of his poem, with those repetitions of “blackberry, blackberry, blackberry,” in that, as Jack Gilbert says in his poem “<a href="http://www.smith.edu/poetrycenter/poets/theforgottendialect.html">The Forgotten Dialect of the Heart</a>,” “How astonishing it is that language can almost mean, / but frightening that it does not quite.” There is still that “<a href="http://www.mrbauld.com/negcap.html">irritable reaching</a> after fact &amp; reason” that language, as communication, requires—I think Keats would agree that he wrote about a near-unattainable ideal in his letter that only Shakespeare and maybe Coleridge and a few others could achieve, this “Negative Capability.” Gilbert furthers Keats in asserting that no matter what we write, “the words / Get it wrong,” that utterance is itself that irritable reaching.</p> 46<p>There’s still a problem with language, however, to which Hass speaks by the end of his poem, with those repetitions of “blackberry, blackberry, blackberry,” in that, as Jack Gilbert says in his poem “<a href="http://www.smith.edu/poetrycenter/poets/theforgottendialect.html">The Forgotten Dialect of the Heart</a>,” “How astonishing it is that language can almost mean, / but frightening that it does not quite.” There is still that “<a href="http://www.mrbauld.com/negcap.html">irritable reaching</a> after fact &amp; reason” that language, as communication, requires—I think Keats would agree that he wrote about a near-unattainable ideal in his letter that only Shakespeare and maybe Coleridge and a few others could achieve, this “Negative Capability.” Gilbert furthers Keats in asserting that no matter what we write, “the words / Get it wrong,” that utterance is itself that irritable reaching.</p>
47<p>In Gilbert’s poem, though, he does reach after something. In the second half of the poem he begins to imagine what the “mysterious Sumerian tablets” could be as poetry, instead of just “business records:”</p> 47<p>In Gilbert’s poem, though, he does reach after something. In the second half of the poem he begins to imagine what the “mysterious Sumerian tablets” could be as poetry, instead of just “business records:”</p>
48<blockquote> 48<blockquote>
49<p>[…] My joy is the same as twelve Ethiopian goats standing in the morning light. O Lord, thou art slabs of salt and ingots of copper, as grand as ripe barley under the wind’s labor. Her breasts are six white oxen loaded with bolts of long-fibered Egyptian cotton. My love is a hundred pitchers of honey. Shiploads of thuya are what my body wants to say to your body. Giraffes are this desire in the dark.</p> 49<p>[…] My joy is the same as twelve<br />Ethiopian goats standing in the morning light.<br />O Lord, thou art slabs of salt and ingots of copper,<br />as grand as ripe barley under the wind’s labor.<br />Her breasts are six white oxen loaded with bolts<br />of long-fibered Egyptian cotton. My love is a hundred<br />pitchers of honey. Shiploads of thuya are what<br />my body wants to say to your body. Giraffes are this<br />desire in the dark.</p>
50</blockquote> 50</blockquote>
51<p>This is my favorite part of the poem, and I think it’s because Gilbert, like Hass, reaches for the specific in the general; he brings huge ideas like the Lord or Love or Joy into the specific images of salt, copper, or honey, or like he says at the end of his poem: “What we feel most has / no name but amber, archers, cinnamon, horses and birds.” This, ultimately, is what Keats was getting at, and Hugo, too: that the real subject of any poetry is not capturable in the words of the poem, but that rather a poem speaks around its subject. To be honest, all <a href="art.html">art</a> may do this. What sets a poem apart is its honesty about that fact.</p></section> 51<p>This is my favorite part of the poem, and I think it’s because Gilbert, like Hass, reaches for the specific in the general; he brings huge ideas like the Lord or Love or Joy into the specific images of salt, copper, or honey, or like he says at the end of his poem: “What we feel most has / no name but amber, archers, cinnamon, horses and birds.” This, ultimately, is what Keats was getting at, and Hugo, too: that the real subject of any poetry is not capturable in the words of the poem, but that rather a poem speaks around its subject. To be honest, all <a href="art.html">art</a> may do this. What sets a poem apart is its honesty about that fact.</p></section>
52 </article> 52 </article>