teledzik 1.1.3 → 1.1.4
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.
|
@@ -19,21 +19,14 @@ function formatTableToCard(tableHtml) {
|
|
|
19
19
|
}
|
|
20
20
|
if (rows.length === 0)
|
|
21
21
|
return '';
|
|
22
|
-
// Header vs Row handling (Format sebagai Kartu Elegan
|
|
22
|
+
// Header vs Row handling (Format sebagai Kartu Elegan)
|
|
23
23
|
const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2);
|
|
24
24
|
let cardText = '';
|
|
25
25
|
if (isKeyValue) {
|
|
26
26
|
const isHeaderRow = hasHeader && rows.length > 1 && (/^(parameter|informasi|metrik|field|key|unit|format|statistik|opsi|nama|item|rincian)$/i.test(rows[0][0].replace(/<[^>]*>/g, '').trim()) ||
|
|
27
27
|
/^(status|keterangan|detail|nilai|value|jumlah|estimasi|tipe|contoh input)$/i.test(rows[0][1].replace(/<[^>]*>/g, '').trim()));
|
|
28
28
|
const dataRows = isHeaderRow ? rows.slice(1) : rows;
|
|
29
|
-
const
|
|
30
|
-
const maxLen = Math.max(...dataRows.map(r => cleanKey(r[0]).length), 0);
|
|
31
|
-
const targetLen = Math.min(Math.max(maxLen, 6), 16);
|
|
32
|
-
const lines = dataRows.map((r) => {
|
|
33
|
-
const raw = cleanKey(r[0]);
|
|
34
|
-
const pad = ' '.repeat(Math.max(0, targetLen - raw.length));
|
|
35
|
-
return `<code>${raw}${pad} :</code> ${r[1]}`;
|
|
36
|
-
});
|
|
29
|
+
const lines = dataRows.map((r) => ` <b>${r[0]}:</b> ${r[1]}`);
|
|
37
30
|
cardText = `<blockquote>\n${lines.join('\n')}\n</blockquote>\n\n`;
|
|
38
31
|
}
|
|
39
32
|
else {
|
package/package.json
CHANGED
|
@@ -14,25 +14,17 @@ function formatTableToCard(tableHtml: string): string {
|
|
|
14
14
|
}
|
|
15
15
|
if (rows.length === 0) return ''
|
|
16
16
|
|
|
17
|
-
// Header vs Row handling (Format sebagai Kartu Elegan
|
|
18
|
-
const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2)
|
|
19
|
-
let cardText = ''
|
|
17
|
+
// Header vs Row handling (Format sebagai Kartu Elegan)
|
|
18
|
+
const isKeyValue = rows.length > 0 && rows.every((r) => r.length === 2)
|
|
19
|
+
let cardText = ''
|
|
20
20
|
if (isKeyValue) {
|
|
21
21
|
const isHeaderRow = hasHeader && rows.length > 1 && (
|
|
22
22
|
/^(parameter|informasi|metrik|field|key|unit|format|statistik|opsi|nama|item|rincian)$/i.test(rows[0][0].replace(/<[^>]*>/g, '').trim()) ||
|
|
23
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
|
|
27
|
-
|
|
28
|
-
const targetLen = Math.min(Math.max(maxLen, 6), 16);
|
|
29
|
-
|
|
30
|
-
const lines = dataRows.map((r) => {
|
|
31
|
-
const raw = cleanKey(r[0]);
|
|
32
|
-
const pad = ' '.repeat(Math.max(0, targetLen - raw.length));
|
|
33
|
-
return `<code>${raw}${pad} :</code> ${r[1]}`;
|
|
34
|
-
});
|
|
35
|
-
cardText = `<blockquote>\n${lines.join('\n')}\n</blockquote>\n\n`;
|
|
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`
|
|
36
28
|
} else {
|
|
37
29
|
const lines = rows.map((r, idx) => {
|
|
38
30
|
if (idx === 0 && hasHeader) return `<b>${r.join(' │ ')}</b>`
|