diff options
author | Case Duckworth | 2015-03-12 10:51:48 -0700 |
---|---|---|
committer | Case Duckworth | 2015-03-12 10:51:48 -0700 |
commit | 2e15be1fdcaaf5a6eb8bb676ada8d8440336e323 (patch) | |
tree | c159258d2fa3dd8ec1d4cf118bdf8de838c47895 /lua/jttm.lua | |
parent | Add 'Find the moon' APOD image to moongone.txt (diff) | |
download | autocento-2e15be1fdcaaf5a6eb8bb676ada8d8440336e323.tar.gz autocento-2e15be1fdcaaf5a6eb8bb676ada8d8440336e323.zip |
Remove lua cruft
Diffstat (limited to 'lua/jttm.lua')
-rw-r--r-- | lua/jttm.lua | 193 |
1 files changed, 0 insertions, 193 deletions
diff --git a/lua/jttm.lua b/lua/jttm.lua deleted file mode 100644 index 2ba101a..0000000 --- a/lua/jttm.lua +++ /dev/null | |||
@@ -1,193 +0,0 @@ | |||
1 | -- Pandoc "Just the text, Ma'am" | ||
2 | -- (JTTM): a custom writer that | ||
3 | -- strips everything except for | ||
4 | -- the TEXT from a pandoc source | ||
5 | -- vim: fdm=marker | ||
6 | -- invoke with: pandoc -t jttm/jttm.lua | ||
7 | |||
8 | -- Table to store footnotes so they are at the END of the document | ||
9 | local notes = {} | ||
10 | |||
11 | -- This function is called once for the whole document. Parameters: | ||
12 | -- body is a string, metadata is a table, variables is a table. | ||
13 | -- One could use some kind of templating | ||
14 | -- system here; this just gives you a simple standalone HTML file. | ||
15 | function Doc(body, metadata, variables) | ||
16 | local buffer = {} | ||
17 | local function add(s) | ||
18 | table.insert(buffer, s) | ||
19 | end | ||
20 | if metadata['title'] and metadata['title'] ~= "" then | ||
21 | add(string.upper(metadata['title'])) | ||
22 | end | ||
23 | if metadata['subtitle'] and metadata['subtitle'] ~= "" then | ||
24 | add(": " .. metadata['subtitle']) | ||
25 | end | ||
26 | add("\n") | ||
27 | -- TODO: epigraph.content, epigraph.attrib, dedication, other metadata? | ||
28 | add(body) | ||
29 | -- TODO: add notes at the end. | ||
30 | return table.concat(buffer, '\n') | ||
31 | end | ||
32 | |||
33 | -- TODOs {{{ | ||
34 | function align(align) | ||
35 | -- TODO: is this necessary? | ||
36 | end | ||
37 | |||
38 | function Note(s) | ||
39 | -- TODO | ||
40 | end | ||
41 | |||
42 | -- convert Tables to csv? or tab-separated? | ||
43 | function Table(caption, aligns, widths, headers, rows) | ||
44 | local buffer = {} | ||
45 | local function add(s) | ||
46 | table.insert(buffer, s) | ||
47 | end | ||
48 | add("\n\n") | ||
49 | if caption ~= "" then | ||
50 | add("[" .. caption .. "]") | ||
51 | end | ||
52 | -- TODO: finish | ||
53 | end | ||
54 | |||
55 | -- }}} | ||
56 | -- Remove all formatting {{{ | ||
57 | function Blocksep() | ||
58 | return "\n\n" | ||
59 | end | ||
60 | function Emph(s) | ||
61 | return s | ||
62 | end | ||
63 | |||
64 | function Strong(s) | ||
65 | return s | ||
66 | end | ||
67 | |||
68 | function Subscript(s) | ||
69 | return s | ||
70 | end | ||
71 | |||
72 | function Superscript(s) | ||
73 | return s | ||
74 | end | ||
75 | |||
76 | function SmallCaps(s) | ||
77 | return s | ||
78 | end | ||
79 | |||
80 | function Strikeout(s) | ||
81 | return s | ||
82 | end | ||
83 | |||
84 | function Code(s, attr) | ||
85 | return s | ||
86 | end | ||
87 | |||
88 | function CodeBlock(s, attr) | ||
89 | return s | ||
90 | end | ||
91 | |||
92 | function InlineMath(s) | ||
93 | return s | ||
94 | end | ||
95 | |||
96 | function DisplayMath(s) | ||
97 | return s | ||
98 | end | ||
99 | |||
100 | function Span(s, attr) | ||
101 | return s | ||
102 | end | ||
103 | |||
104 | function Cite(s) | ||
105 | return s | ||
106 | end | ||
107 | |||
108 | function Plain(s) | ||
109 | return s | ||
110 | end | ||
111 | |||
112 | -- Links only include the link text | ||
113 | function Link(s, src, tit) | ||
114 | return s | ||
115 | end | ||
116 | |||
117 | -- Images have nothing to give us | ||
118 | -- (but add a space just in case) | ||
119 | function Image(s, src, tit) | ||
120 | return " " | ||
121 | end | ||
122 | |||
123 | function Str(s) | ||
124 | return s | ||
125 | end | ||
126 | |||
127 | function Div(s, attr) | ||
128 | return s | ||
129 | end | ||
130 | |||
131 | function Space(s) | ||
132 | return " " | ||
133 | end | ||
134 | |||
135 | function LineBreak() | ||
136 | return "\n" | ||
137 | end | ||
138 | |||
139 | function Para(s) | ||
140 | -- add paragraphing | ||
141 | return s .. "\n\n" | ||
142 | end | ||
143 | -- }}} | ||
144 | -- Leave just a little formatting {{{ | ||
145 | function Header(lev, s, attr) | ||
146 | if lev == 1 then | ||
147 | return "\n\n " .. string.upper(s) .. "\n\n" | ||
148 | elseif lev == 2 then | ||
149 | return "\n " .. string.upper(s) .. "\n" | ||
150 | else | ||
151 | return s | ||
152 | end | ||
153 | end | ||
154 | |||
155 | function Blockquote(s) | ||
156 | return "\n\n" .. string.gsub(s, "*\n", " %0") | ||
157 | end | ||
158 | |||
159 | function HorizontalRule(s) | ||
160 | return "\n\n\n" | ||
161 | end | ||
162 | |||
163 | function BulletList(items) | ||
164 | local buffer = {} | ||
165 | for _, item in pairs(items) do | ||
166 | table.insert(buffer, "- " .. item .. "\n") | ||
167 | end | ||
168 | return "\n\n" .. table.concat(buffer, "\n") .. "\n\n" | ||
169 | end | ||
170 | |||
171 | function DefinitionList(items) | ||
172 | local buffer = {} | ||
173 | for _, item in pairs(items) do | ||
174 | for k, v in pairs(item) do | ||
175 | table.insert(buffer, "\n" .. k .. ":\n " .. | ||
176 | table.concat(v, "\n ")) | ||
177 | end | ||
178 | end | ||
179 | return "\n\n" .. table.concat(buffer, "\n") .. "\n\n" | ||
180 | end | ||
181 | -- }}} | ||
182 | |||
183 | -- The following code will produce runtime warnings when you haven't defined | ||
184 | -- all of the functions you need for the custom writer, so it's useful | ||
185 | -- to include when you're working on a writer. | ||
186 | local meta = {} | ||
187 | meta.__index = | ||
188 | function(_, key) | ||
189 | io.stderr:write(string.format("WARNING: Undefined function '%s'\n",key)) | ||
190 | return function() return "" end | ||
191 | end | ||
192 | setmetatable(_G, meta) | ||
193 | |||