Skip to content

Commit 9d0f4b5

Browse files
author
Al Manning
committed
remove dead table code
1 parent 2345853 commit 9d0f4b5

File tree

2 files changed

+0
-185
lines changed

2 files changed

+0
-185
lines changed

src/resources/extensions/quarto/confluence/overrides.lua

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -137,99 +137,11 @@ function CodeBlockConfluence(codeValue, languageValue)
137137
}
138138
end
139139

140-
-- Convert pandoc alignment to something HTML can use.
141-
-- align is AlignLeft, AlignRight, AlignCenter, or AlignDefault.
142-
local function html_align(align)
143-
if align == 'AlignLeft' then
144-
return 'left'
145-
elseif align == 'AlignRight' then
146-
return 'right'
147-
elseif align == 'AlignCenter' then
148-
return 'center'
149-
else
150-
return 'left'
151-
end
152-
end
153-
154-
-- Caption is a string, aligns is an array of strings,
155-
-- widths is an array of floats, headers is an array of
156-
-- strings, rows is an array of arrays of strings.
157-
function TableConfluence(caption, aligns, widths, headers, rows)
158-
--dump(caption, 'caption')
159-
--dump(aligns, 'aligns')
160-
--dump(widths, 'widths')
161-
--dump(headers, 'headers')
162-
--dump(rows, 'rows')
163-
164-
local buffer = {}
165-
local function add(s)
166-
table.insert(buffer, s)
167-
end
168-
add("<table>")
169-
if widths and widths[1] ~= 0 then
170-
add("<colgroup>")
171-
-- extract with test and put a colgroup here
172-
for _, w in pairs(widths) do
173-
add('<col width="' .. string.format("%.0f%%", w * 100) .. '" />')
174-
end
175-
add("</colgroup>")
176-
end
177-
local header_row = {}
178-
local empty_header = true
179-
for i, h in pairs(headers) do
180-
local align = html_align(aligns[i])
181-
table.insert(header_row,
182-
'<th align="' ..
183-
align ..
184-
'">' ..
185-
'<p style="text-align: ' ..
186-
html_align(aligns[i]) ..
187-
';">' ..
188-
h ..
189-
'</p>' ..
190-
'</th>')
191-
empty_header = empty_header and h == ""
192-
end
193-
if empty_header then
194-
head = ""
195-
else
196-
add('<tr class="header">')
197-
for _,h in pairs(header_row) do
198-
add(h)
199-
end
200-
add('</tr>')
201-
end
202-
local class = "even"
203-
for _, row in pairs(rows) do
204-
class = (class == "even" and "odd") or "even"
205-
add('<tr class="' .. class .. '">')
206-
for i,c in pairs(row) do
207-
add('<td align="' ..
208-
html_align(aligns[i]) ..
209-
'">' ..
210-
'<p style="text-align: ' ..
211-
html_align(aligns[i]) ..
212-
';">' ..
213-
c ..
214-
'</p>' ..
215-
'</td>')
216-
end
217-
add('</tr>')
218-
end
219-
add('</table>')
220-
if caption ~= "" then
221-
add("<p>" .. caption .. "</p>")
222-
end
223-
return table.concat(buffer,'\n')
224-
end
225-
226-
227140
return {
228141
CaptionedImageConfluence = CaptionedImageConfluence,
229142
CodeBlockConfluence = CodeBlockConfluence,
230143
LinkConfluence = LinkConfluence,
231144
TableConfluence = TableConfluence,
232145
escape = escape,
233-
html_align = html_align,
234146
interpolate = interpolate
235147
}

src/resources/extensions/quarto/confluence/test-suite.lua

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -143,101 +143,4 @@ function TestLinkConfluence:testAttachment()
143143
lu.assertEquals(actual, expected)
144144
end
145145

146-
TestTableConfluence = {}
147-
function TestTableConfluence:testAlign()
148-
local expected = [[<table>
149-
<colgroup>
150-
<col width="10%" />
151-
</colgroup>
152-
<tr class="odd">
153-
<td align="right"><p style="text-align: right;">12</p></td>
154-
</tr>
155-
</table>]]
156-
local caption = ''
157-
local aligns = {'AlignRight'}
158-
local widths = {0.1}
159-
local headers = {Right}
160-
local rows = {
161-
{12}
162-
}
163-
164-
local actual = confluence.TableConfluence(caption, aligns, widths, headers, rows);
165-
166-
lu.assertEquals(actual, expected)
167-
end
168-
function TestTableConfluence:testColGroup()
169-
local expected = [[<table>
170-
<colgroup>
171-
<col width="10%" />
172-
<col width="10%" />
173-
<col width="10%" />
174-
<col width="70%" />
175-
</colgroup>
176-
<tr class="odd">
177-
<td align="right"><p style="text-align: right;">12</p></td>
178-
<td align="left"><p style="text-align: left;">12</p></td>
179-
<td align="left"><p style="text-align: left;">12</p></td>
180-
<td align="center"><p style="text-align: center;">12</p></td>
181-
</tr>
182-
<tr class="even">
183-
<td align="right"><p style="text-align: right;">123</p></td>
184-
<td align="left"><p style="text-align: left;">123</p></td>
185-
<td align="left"><p style="text-align: left;">123</p></td>
186-
<td align="center"><p style="text-align: center;">123</p></td>
187-
</tr>
188-
<tr class="odd">
189-
<td align="right"><p style="text-align: right;">1</p></td>
190-
<td align="left"><p style="text-align: left;">1</p></td>
191-
<td align="left"><p style="text-align: left;">1</p></td>
192-
<td align="center"><p style="text-align: center;">1</p></td>
193-
</tr>
194-
</table>]]
195-
local caption = ''
196-
local aligns = {'AlignRight', 'AlignLeft', 'AlignDefault', 'AlignCenter'}
197-
local widths = {0.1, 0.1, 0.1, 0.7}
198-
local headers = {Right, Left, Default, Center}
199-
local rows = {
200-
{12, 12, 12, 12},
201-
{123, 123, 123, 123},
202-
{1, 1, 1, 1},
203-
}
204-
local actual = confluence.TableConfluence(caption, aligns, widths, headers, rows);
205-
206-
lu.assertEquals(actual, expected)
207-
end
208-
function TestTableConfluence:testNoColGroupNoWidth()
209-
local expected = [[<table>
210-
<tr class="odd">
211-
<td align="right"><p style="text-align: right;">12</p></td>
212-
<td align="left"><p style="text-align: left;">12</p></td>
213-
<td align="left"><p style="text-align: left;">12</p></td>
214-
<td align="center"><p style="text-align: center;">12</p></td>
215-
</tr>
216-
<tr class="even">
217-
<td align="right"><p style="text-align: right;">123</p></td>
218-
<td align="left"><p style="text-align: left;">123</p></td>
219-
<td align="left"><p style="text-align: left;">123</p></td>
220-
<td align="center"><p style="text-align: center;">123</p></td>
221-
</tr>
222-
<tr class="odd">
223-
<td align="right"><p style="text-align: right;">1</p></td>
224-
<td align="left"><p style="text-align: left;">1</p></td>
225-
<td align="left"><p style="text-align: left;">1</p></td>
226-
<td align="center"><p style="text-align: center;">1</p></td>
227-
</tr>
228-
</table>]]
229-
local caption = ''
230-
local aligns = {'AlignRight', 'AlignLeft', 'AlignDefault', 'AlignCenter'}
231-
local widths = {0.0, 0.0, 0.0, 0.0}
232-
local headers = {Right, Left, Default, Center}
233-
local rows = {
234-
{12, 12, 12, 12},
235-
{123, 123, 123, 123},
236-
{1, 1, 1, 1},
237-
}
238-
local actual = confluence.TableConfluence(caption, aligns, widths, headers, rows);
239-
240-
lu.assertEquals(actual, expected)
241-
end
242-
243146
os.exit(lu.LuaUnit.run())

0 commit comments

Comments
 (0)