bug when no table pleasant

main
Lee Hanken 2022-01-30 21:05:14 +00:00
parent 15dae35b74
commit 0ab94c807e
1 changed files with 9 additions and 7 deletions

View File

@ -92,6 +92,7 @@ function read_url(url, res) {
function format_tables(html, replacements) { function format_tables(html, replacements) {
const tables = html.match(/(<table[^>]*>(?:.|\n)*?<\/table>)/gi); const tables = html.match(/(<table[^>]*>(?:.|\n)*?<\/table>)/gi);
if (tables) {
for (let t=0;t<tables.length;t++) { for (let t=0;t<tables.length;t++) {
let table = tables[t]; let table = tables[t];
let markdown = table_to_markdown.convert(table); let markdown = table_to_markdown.convert(table);
@ -100,6 +101,7 @@ function format_tables(html, replacements) {
replacements.tables[t] = markdown; replacements.tables[t] = markdown;
html = html.replace(table, "<p>"+placeholder+"</p>"); html = html.replace(table, "<p>"+placeholder+"</p>");
} }
}
return html; return html;
} }