kuro223 commited on
Commit
fc37930
·
1 Parent(s): d4cb99d
Files changed (1) hide show
  1. templates/index.html +29 -15
templates/index.html CHANGED
@@ -851,14 +851,21 @@
851
  const tableData = parseMarkdownTable(currentBlock.trim());
852
  if (tableData.head.length > 0 && tableData.head[0].length > 0) {
853
  if (cursorY + 30 > pageHeight - margin) { pdf.addPage(); cursorY = margin; } // Check space before adding table
854
- pdf.autoTable({
855
- head: tableData.head, body: tableData.body, startY: cursorY,
856
- theme: 'grid', // 'striped', 'grid', 'plain'
857
- styles: { fontSize: 9, cellPadding: 5, overflow: 'linebreak', font: "Helvetica" }, // Use standard font
858
- headStyles: { fillColor: [67, 97, 238], textColor: [255, 255, 255], fontStyle: 'bold', halign: 'center' },
859
- didParseCell: function (data) { data.cell.styles.valign = 'middle'; }, // Vertically align cell content
860
- margin: { left: margin, right: margin }
861
- });
 
 
 
 
 
 
 
862
  cursorY = pdf.previousAutoTable.finalY + lineHeight; // Update cursor position
863
  } else {
864
  console.warn("Échec parsing bloc tableau ou tableau vide.");
@@ -890,13 +897,20 @@
890
  const tableData = parseMarkdownTable(currentBlock.trim());
891
  if (tableData.head.length > 0 && tableData.head[0].length > 0) {
892
  if (cursorY + 30 > pageHeight - margin) { pdf.addPage(); cursorY = margin; }
893
- pdf.autoTable({
894
- head: tableData.head, body: tableData.body, startY: cursorY,
895
- theme: 'grid', styles: { fontSize: 9, cellPadding: 5, overflow: 'linebreak', font: "Helvetica" },
896
- headStyles: { fillColor: [67, 97, 238], textColor: [255, 255, 255], fontStyle: 'bold', halign: 'center' },
897
- didParseCell: function (data) { data.cell.styles.valign = 'middle'; },
898
- margin: { left: margin, right: margin }
899
- });
 
 
 
 
 
 
 
900
  } else {
901
  console.warn("Échec parsing dernier bloc tableau ou tableau vide.");
902
  addTextToPage("(Erreur: Dernier bloc tableau non formaté ou vide)\n" + currentBlock.trim());
 
851
  const tableData = parseMarkdownTable(currentBlock.trim());
852
  if (tableData.head.length > 0 && tableData.head[0].length > 0) {
853
  if (cursorY + 30 > pageHeight - margin) { pdf.addPage(); cursorY = margin; } // Check space before adding table
854
+ pdf.autoTable({
855
+ head: tableData.head, body: tableData.body, startY: cursorY,
856
+ theme: 'grid', // 'striped', 'grid', 'plain'
857
+ styles: { fontSize: 9, cellPadding: 5, overflow: 'linebreak', font: "Helvetica" }, // Use standard font
858
+ headStyles: { fillColor: [67, 97, 238], textColor: [255, 255, 255], fontStyle: 'bold', halign: 'center' },
859
+ didParseCell: function (data) {
860
+ data.cell.styles.valign = 'middle';
861
+ // Handle bold text in table cells
862
+ if (data.cell.raw && data.cell.raw.includes('**')) {
863
+ data.cell.styles.fontStyle = 'bold';
864
+ data.cell.raw = data.cell.raw.replace(/\*\*(.*?)\*\*/g, '$1');
865
+ }
866
+ }, // Vertically align cell content
867
+ margin: { left: margin, right: margin }
868
+ });
869
  cursorY = pdf.previousAutoTable.finalY + lineHeight; // Update cursor position
870
  } else {
871
  console.warn("Échec parsing bloc tableau ou tableau vide.");
 
897
  const tableData = parseMarkdownTable(currentBlock.trim());
898
  if (tableData.head.length > 0 && tableData.head[0].length > 0) {
899
  if (cursorY + 30 > pageHeight - margin) { pdf.addPage(); cursorY = margin; }
900
+ pdf.autoTable({
901
+ head: tableData.head, body: tableData.body, startY: cursorY,
902
+ theme: 'grid', styles: { fontSize: 9, cellPadding: 5, overflow: 'linebreak', font: "Helvetica" },
903
+ headStyles: { fillColor: [67, 97, 238], textColor: [255, 255, 255], fontStyle: 'bold', halign: 'center' },
904
+ didParseCell: function (data) {
905
+ data.cell.styles.valign = 'middle';
906
+ // Handle bold text in table cells
907
+ if (data.cell.raw && data.cell.raw.includes('**')) {
908
+ data.cell.styles.fontStyle = 'bold';
909
+ data.cell.raw = data.cell.raw.replace(/\*\*(.*?)\*\*/g, '$1');
910
+ }
911
+ },
912
+ margin: { left: margin, right: margin }
913
+ });
914
  } else {
915
  console.warn("Échec parsing dernier bloc tableau ou tableau vide.");
916
  addTextToPage("(Erreur: Dernier bloc tableau non formaté ou vide)\n" + currentBlock.trim());