Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2a920fa
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
task :default => :build | ||
|
||
task :build => :clean do | ||
system "context haiku.tex" | ||
end | ||
|
||
task :clean do | ||
rm_if_exist %w(haiku.pdf haiku.tuc haiku.log) | ||
end | ||
|
||
task :fetch do | ||
rm_if_exist "data/haiku.atom" | ||
system "curl -o data/haiku.atom http://search.twitter.com/search.atom?q=%23haiku" | ||
end | ||
|
||
|
||
def rm_if_exist(paths) | ||
Array(paths).each do |path| | ||
rm path if File.file? path | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
haiku = haiku or {} | ||
local p = tex.sprint | ||
|
||
function haiku.parse(tweet) | ||
p("MWA* " .. tweet .. " *MWA") | ||
end | ||
|
||
function haiku.author(str) | ||
_, _, name = string.find(str, "^(%a+)") | ||
p(name) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
\setuplayout | ||
[footer=0cm, | ||
header=0cm, | ||
width=middle, | ||
height=middle] | ||
|
||
\setuppagenumbering[location=] | ||
|
||
\starttext | ||
|
||
\registerctxluafile{haiku}{0.1} | ||
\def\parsehaiku #1{\ctxlua{haiku.parse("#1")}} | ||
\def\authorname #1{\ctxlua{haiku.author("#1")}} | ||
|
||
\startxmlsetups xml:atom:base | ||
\xmlsetsetup{atom}{feed}{xml:atom:feed} | ||
\stopxmlsetups | ||
|
||
\startxmlsetups xml:atom:feed | ||
\xmlcommand{#1}{/entry}{xml:atom:entry} | ||
\stopxmlsetups | ||
|
||
\startxmlsetups xml:atom:entry | ||
\def\AUTHOR{\xmlfirst{#1}{/author/name}} | ||
\def\HAIKU{\xmlfirst{#1}{/title}} | ||
\startframedtext[corner=round,align=middle,frame=none,background=screen,backgroundscreen=.9,width=\textwidth] | ||
From: \authorname{\AUTHOR}\par | ||
\parsehaiku{ /MAA } | ||
\stopframedtext | ||
\stopxmlsetups | ||
|
||
\xmlregisterdocumentsetup{atom}{xml:atom:base} | ||
|
||
\xmlprocessfile{atom}{data/haiku.atom}{} | ||
|
||
\stoptext |