From 284c9020d6545b0de43d96c05e72bb6d97beb8d9 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 23 Mar 2015 23:26:48 -0700 Subject: Add makefile (no tests yet) --- css/common.css | 6 ++ img/panorama-apollo11.jpg | Bin 0 -> 720983 bytes js/lozenge.js | 2 +- lua/compile-uff.lua | 208 +++++++++++++++++++++++++++++++++++++++ src/apollo11.txt | 5 + src/makefile | 24 +++++ src/words-irritable-reaching.txt | 16 +-- words-irritable-reaching.html | 2 +- 8 files changed, 253 insertions(+), 10 deletions(-) create mode 100644 img/panorama-apollo11.jpg create mode 100644 lua/compile-uff.lua create mode 100644 src/makefile 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 { .content { line-height: 1.3em; } +blockquote { + border-left: 1px solid gray; + padding-left: 2em; + margin-left: 2em; + font-style: italic; +} nav { height: 24px; width: 100%; diff --git a/img/panorama-apollo11.jpg b/img/panorama-apollo11.jpg new file mode 100644 index 0000000..c56a109 Binary files /dev/null and b/img/panorama-apollo11.jpg 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. window.onload = function () { _lozenge() -}; +}; \ 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 @@ +#!/usr/bin/env lua +-- A compiler for "Autocento of the breakfast table" by Case Duckworth +-- check it in action at: www.autocento.me +-- Usage: `lua compile.lua [options] +-- Where [options] are +-- -- -html: compiles html files +-- -- -river: compiles river files (only words, one per line) +-- -- -lozenge: updates lozenge.js file +-- vim: fdm=indent + +defaults = {} + defaults.dirs = { + root = "/d/Copy/projects/autocento/", + src = "/d/Copy/projects/autocento/src/", + lua = "/d/Copy/projects/autocento/lua/", + js = "/d/Copy/projects/autocento/js/", + css = "/d/Copy/projects/autocento/css/", + } + defaults.files = { + lozenge = defaults.dirs.js .. "lozenge.js", + } + defaults.formats = { + html = { + output_dir = defaults.dirs.root, + extension = "html", + pandoc_args = { + from = "markdown", + to = "html5", + template = ".template.html", + "smart", + "mathml", + "section-divs", + } + }, + river = { + output_dir = defaults.dirs.root .. "river/", + extension = "river", + pandoc_args = { + from = "markdown", + to = defaults.dirs.lua.."river.lua", + }, + }, + } + defaults.compile_args = { + '-html', + '-river', + '-lozenge', + } +helpers = { + -- Little helper functions + filter = function (list, filter) + -- Filter a list. + -- 1st return is list of terms that match. + -- 2nd return is list of terms that don't match. + local output_match = {} + local output_nomatch = {} + for _,v in ipairs(list) do + if string.match(v, filter) then + output_match[#output_match+1] = v + else + output_nomatch[#output_nomatch+1] = v + end + end + return output_match, output_nomatch + end, + in_table = function (table, term) + -- Search for term in table + for k,v in pairs(table) do + if v == term then + return k + end + end + return nil + end, + tsub = function (table, pattern, replace, i) + -- gsub on every term in a table + local output = {} + if i then -- 'i' option just does ipair part of table + for k,v in ipairs(table) do + output[k] = v:gsub(pattern, replace) + end + else + for k,v in pairs(table) do + output[k] = v:gsub(pattern, replace) + end + end + return output + end, + scandir = function (directory) + -- Find all files in a directory + local i, t, popen = 0, {}, io.popen + for filename in popen('ls -a "'..directory..'"'):lines() do + i = i+1 + t[i] = filename + end + return t + end +} + +function compile (files, format_args) + -- Run pandoc on , producing , with [pandoc_args]. + local errors = 0 + if not format_args then + format_args = defaults.formats[output_format] + end + print("Compiling files to "..format_args.extension.." ...") + args = format_args.pandoc_args + for _, file in pairs(files) do + local pandoc_run = { + 'pandoc', + '-f', args.from, + '-t', args.to, + '-o', + file:gsub('%.%a+$', "."..format_args.extension) + } + if args.template then + table.insert(pandoc_run, '--template="'..args.template..'"') + end + for _,a in ipairs(args) do + pandoc_run[#pandoc_run+1] = a:gsub("^", "--") + end + table.insert(pandoc_run, file) + for k,v in pairs(pandoc_run) do + print(k, v) + end + if not os.execute(table.concat(pandoc_run, " ")) then + errors = errors+1 + end + io.write(".") + end + print("Compiling "..#files.." files completed with "..errors.." errors.") +end + +function move (files, destination) + -- Move files to destination + print("Moving files to "..destination.." ...") + local errors = 0 + for _, file in pairs(files) do + if not os.execute("mv "..file.." "..destination) then + errors = errors+1 + end + end + print("Moving "..#files.." completed with "..errors.." errors.") +end + +function lozenge_list (files, blacklist) + -- Produce list for placement in lozenge.js + local output = {} + for _,file in pairs(files) do + -- table.insert(output, #output+1, file:gsub('.*', '"%0"')) + output[#output+1] = file:gsub(".*", '"%0",') + end + if blacklist then + for _,unwanted in pairs(blacklist) do + _,output = helpers.filter(files, unwanted) + end + end + output = table.concat(output, " ") + output = "var files = ["..output + output = output:gsub('"",', '') + output = output:gsub(",$", "]") + print(output) +end + +local args, files = helpers.filter(arg, "^%-") +if not files or #files == 0 then + -- Error: need files to work on! + -- TODO: don't technically need file list for -lozenge + print("ERROR: No file list.") + os.exit(1) +end +basenames = helpers.tsub(files, "^.*/", "") +basenames = helpers.tsub(files, "%.%a+$", "") +if not args or #args == 0 or args == { "-all" } then + args = defaults.compile_args +end +-- Option parsing +if helpers.in_table(args, "-html") then + compile(files, defaults.formats.html) + move(helpers.tsub(basenames, "$", "%0.html"), + defaults.formats.html.output_dir) +end +if helpers.in_table(args, "-river") then + compile(files, defaults.formats.river) + move(helpers.tsub(basenames, ".*", "%0.river"), + defaults.formats.river.output_dir) +end +if helpers.in_table(args, "-lozenge") then + -- TODO: should probably break this out into a function + print("Updating lozenge.js file list...") + local htmls = helpers.filter(helpers.scandir(defaults.dirs.root), + "html$") + local f = assert(io.open(defaults.files.lozenge, "r")) + local buffer = {} + for line in f:lines() do + if line:find("var files=") then + table.insert(buffer, lozenge_list(htmls)) + else + table.insert(buffer, line) + end + end + f:close() + -- Write the file we've just read + local F = assert(io.open(defaults.files.lozenge, "w")) + F:write(table.concat(buffer, "\n")) + F:close() + print("Done.") +end 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 @@ title: On seeing the panorama of the Apollo 11 landing site genre: verse +ekphrastic: + image: "img/panorama-apollo11.jpg" + title: "Big deal." + link: "http://apod.nasa.gov/apod/ap141220.html" + project: title: Elegies for alternate selves 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 @@ +# Produce HTML & RIVER outputs with pandoc +# Case Duckworth | autocento.me +# inspired by Lincoln Mullen | lincolnmullen.com + +# Define directories, file lists, and options +HTMLdir = .. +RIVdir = ../river +LUAdir = ../lua +HTMLs := $(patsubst %.txt,%.html,$(wildcard *.txt)) +HTMopts = --template=$(HTMLdir)/.template.html +HTMopts+= --smart --mathml --section-divs +RIVERs := $(patsubst %.txt,%.river,$(wildcard *.txt)) +RIVopts = + +# Do everything +all : $(HTMLs) $(RIVERs) + +# Generic rule for HTML targets and Markdown sources +%.html : %.txt + pandoc $< -f markdown -t html5 $(HTMLopts) -o $(HTMLdir)/$@ + +# Generic rule for RIVER targets and Markdown sources +%.river : %.txt + 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 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:" -> [...] 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 +> [...] 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. 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." 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 @@

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 “The Forgotten Dialect of the Heart,” “How astonishing it is that language can almost mean, / but frightening that it does not quite.” There is still that “irritable reaching after fact & 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.

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:”

-

[…] 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.

+

[…] 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.

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 art may do this. What sets a poem apart is its honesty about that fact.

-- cgit 1.4.1-21-gabe81