teledzik 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,9 @@ function formatTableToCard(tableHtml) {
23
23
  const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2);
24
24
  let cardText = '';
25
25
  if (isKeyValue) {
26
- const dataRows = hasHeader ? rows.slice(1) : rows;
26
+ const isHeaderRow = hasHeader && rows.length > 1 && (/^(parameter|informasi|metrik|field|key|unit|format|statistik|opsi|nama|item)$/i.test(rows[0][0].replace(/<[^>]*>/g, '').trim()) ||
27
+ /^(status|keterangan|detail|nilai|value|jumlah|estimasi|tipe|contoh input)$/i.test(rows[0][1].replace(/<[^>]*>/g, '').trim()));
28
+ const dataRows = isHeaderRow ? rows.slice(1) : rows;
27
29
  const lines = dataRows.map((r) => `• <b>${r[0]}:</b> ${r[1]}`);
28
30
  cardText = `<blockquote>\n${lines.join('\n')}\n</blockquote>\n\n`;
29
31
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "teledzik",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Modern Telegram Bot Framework",
5
5
  "keywords": [
6
6
  "telekaf",
7
7
  "teledzik",
8
8
  "telegraf",
9
- "telegram",
9
+ "telegram",
10
10
  "telegram bot api",
11
11
  "bot",
12
12
  "botapi",
@@ -15,12 +15,16 @@ function formatTableToCard(tableHtml: string): string {
15
15
  if (rows.length === 0) return ''
16
16
 
17
17
  // Header vs Row handling (Format sebagai Kartu Elegan)
18
- const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2)
19
- let cardText = ''
18
+ const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2);
19
+ let cardText = '';
20
20
  if (isKeyValue) {
21
- const dataRows = hasHeader ? rows.slice(1) : rows
22
- const lines = dataRows.map((r) => `• <b>${r[0]}:</b> ${r[1]}`)
23
- cardText = `<blockquote>\n${lines.join('\n')}\n</blockquote>\n\n`
21
+ const isHeaderRow = hasHeader && rows.length > 1 && (
22
+ /^(parameter|informasi|metrik|field|key|unit|format|statistik|opsi|nama|item)$/i.test(rows[0][0].replace(/<[^>]*>/g, '').trim()) ||
23
+ /^(status|keterangan|detail|nilai|value|jumlah|estimasi|tipe|contoh input)$/i.test(rows[0][1].replace(/<[^>]*>/g, '').trim())
24
+ );
25
+ const dataRows = isHeaderRow ? rows.slice(1) : rows;
26
+ const lines = dataRows.map((r) => `• <b>${r[0]}:</b> ${r[1]}`);
27
+ cardText = `<blockquote>\n${lines.join('\n')}\n</blockquote>\n\n`;
24
28
  } else {
25
29
  const lines = rows.map((r, idx) => {
26
30
  if (idx === 0 && hasHeader) return `<b>${r.join(' │ ')}</b>`