textbrowser 0.48.0 → 0.48.2

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.
package/dist/sw-helper.js CHANGED
@@ -41,6 +41,10 @@ function swHelper (self) {
41
41
  'node_modules/textbrowser-data-schemas/schemas/table.jsonschema', // Not currently using for validation or meta-data
42
42
  */
43
43
 
44
+ 'node_modules/intl-locale-textinfo-polyfill/lib/Locale.js',
45
+ 'node_modules/textbrowser/dist/assets/languages-1sAACTKG.json',
46
+ 'node_modules/textbrowser/dist/assets/index-_11XnUty.css',
47
+
44
48
  'node_modules/textbrowser/dist/index-es.js'
45
49
  ];
46
50
 
@@ -106,7 +110,7 @@ function swHelper (self) {
106
110
  * @param {DelayCallback} cb
107
111
  * @param {PositiveInteger} timeout
108
112
  * @param {string} errMessage
109
- * @param {PositiveInteger} [time=0]
113
+ * @param {PositiveInteger} [time]
110
114
  * @returns {Promise<void>}
111
115
  */
112
116
  async function tryAndRetry (cb, timeout, errMessage, time = 0) {
@@ -117,7 +121,7 @@ function swHelper (self) {
117
121
  } catch (err) {
118
122
  console.log('errrr', err);
119
123
  logError(err, err.message || errMessage);
120
- return new Promise((resolve, reject) => {
124
+ return new Promise((resolve) => {
121
125
  setTimeout(() => {
122
126
  resolve(tryAndRetry(cb, timeout, errMessage, time));
123
127
  }, timeout);
@@ -129,7 +133,7 @@ function swHelper (self) {
129
133
  *
130
134
  * @param {PlainObject} args
131
135
  * @param {"log"|"error"|"beginInstall"|"finishedInstall"|"beginActivate"|"finishedActivate"} args.type
132
- * @param {string} [args.message=type]
136
+ * @param {string} [args.message]
133
137
  * @returns {Promise<void>}
134
138
  */
135
139
  async function post ({type, message = type}) {
@@ -202,11 +206,11 @@ function swHelper (self) {
202
206
  ...userDataFiles,
203
207
  ...stylesheets
204
208
  ];
205
- // .map((url) => url === 'index.html' ? new Request(url, {cache: 'reload'}) : url)
209
+ // .map((url) => url === 'index.html' ? new Request(url, {cache: 'reload'}) : url)
206
210
  try {
207
211
  const cachePromises = urlsToPrefetch.map(async (urlToPrefetch) => {
208
- // This constructs a new URL object using the service worker's script location as the base
209
- // for relative URLs.
212
+ // This constructs a new URL object using the service worker's script
213
+ // location as the base for relative URLs.
210
214
  const url = new URL(urlToPrefetch, location.href);
211
215
  url.search += (url.search ? '&' : '?') + 'cache-bust=' + now;
212
216
  const request = new Request(url, {mode: 'no-cors'});
package/index.html CHANGED
@@ -4,6 +4,8 @@
4
4
  <title></title>
5
5
  <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
6
6
 
7
+ <!-- Browser polyfills -->
8
+ <script type="module" src="node_modules/intl-locale-textinfo-polyfill/lib/polyfill.js"></script>
7
9
  <!-- Site-specific customization -->
8
10
  <script type="module" src="resources/user.js"></script>
9
11
  </head><body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textbrowser",
3
- "version": "0.48.0",
3
+ "version": "0.48.2",
4
4
  "description": "Multilinear text browser",
5
5
  "type": "module",
6
6
  "main": "dist/index-es.min.js",
@@ -30,59 +30,59 @@
30
30
  "text"
31
31
  ],
32
32
  "dependencies": {
33
- "@babel/core": "^7.20.2",
33
+ "@babel/core": "^7.23.3",
34
34
  "@brettz9/node-static": "^0.1.1",
35
35
  "command-line-args": "^5.2.1",
36
- "dom-parser": "^0.1.6",
36
+ "dom-parser": "^1.1.5",
37
37
  "form-serialization": "^0.11.0",
38
- "indexeddbshim": "^10.0.0",
39
- "intl-dom": "^0.17.0",
40
- "jamilih": "0.54.0",
41
- "jsdom": "^20.0.3",
38
+ "indexeddbshim": "^12.0.0",
39
+ "intl-dom": "^0.19.0",
40
+ "intl-locale-textinfo-polyfill": "^2.1.1",
41
+ "jamilih": "0.58.2",
42
+ "jsdom": "^22.1.0",
42
43
  "json-refs": "^3.0.15",
43
44
  "load-stylesheets": "0.10.0",
44
45
  "node-fetch": "^2.6.6",
45
- "rtl-detect": "1.0.4",
46
46
  "simple-get-json": "^9.0.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/eslint-parser": "^7.19.1",
49
+ "@babel/eslint-parser": "^7.23.3",
50
50
  "@babel/plugin-proposal-object-rest-spread": "^7.20.2",
51
51
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
52
- "@babel/preset-env": "^7.20.2",
52
+ "@babel/preset-env": "^7.23.3",
53
53
  "@brettz9/eslint-plugin": "^1.0.4",
54
- "@rollup/plugin-babel": "^6.0.2",
55
- "@rollup/plugin-commonjs": "^23.0.2",
56
- "@rollup/plugin-json": "^5.0.1",
57
- "@rollup/plugin-node-resolve": "^15.0.1",
58
- "@rollup/plugin-terser": "^0.1.0",
54
+ "@rollup/plugin-babel": "^6.0.4",
55
+ "@rollup/plugin-commonjs": "^25.0.7",
56
+ "@rollup/plugin-json": "^6.0.1",
57
+ "@rollup/plugin-node-resolve": "^15.2.3",
58
+ "@rollup/plugin-terser": "^0.4.4",
59
59
  "@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
60
- "@web/rollup-plugin-import-meta-assets": "^1.0.7",
61
- "ajv": "8.11.2",
60
+ "@web/rollup-plugin-import-meta-assets": "^2.2.0",
61
+ "ajv": "8.12.0",
62
62
  "babel-plugin-dynamic-import-node": "^2.3.3",
63
- "chai": "^4.3.7",
64
- "eslint": "^8.28.0",
65
- "eslint-config-ash-nazg": "^34.4.0",
66
- "eslint-config-standard": "^17.0.0",
67
- "eslint-plugin-array-func": "^3.1.7",
68
- "eslint-plugin-compat": "^4.0.2",
63
+ "chai": "^4.3.10",
64
+ "eslint": "^8.53.0",
65
+ "eslint-config-ash-nazg": "^35.1.0",
66
+ "eslint-config-standard": "^17.1.0",
67
+ "eslint-plugin-array-func": "^4.0.0",
68
+ "eslint-plugin-compat": "^4.2.0",
69
69
  "eslint-plugin-eslint-comments": "^3.2.0",
70
70
  "eslint-plugin-html": "^7.1.0",
71
- "eslint-plugin-import": "^2.26.0",
72
- "eslint-plugin-jsdoc": "^39.6.2",
73
- "eslint-plugin-markdown": "^3.0.0",
74
- "eslint-plugin-n": "^15.5.1",
75
- "eslint-plugin-no-unsanitized": "^4.0.1",
71
+ "eslint-plugin-import": "^2.29.0",
72
+ "eslint-plugin-jsdoc": "^46.9.0",
73
+ "eslint-plugin-markdown": "^3.0.1",
74
+ "eslint-plugin-n": "^16.3.1",
75
+ "eslint-plugin-no-unsanitized": "^4.0.2",
76
76
  "eslint-plugin-no-use-extend-native": "^0.5.0",
77
77
  "eslint-plugin-promise": "^6.1.1",
78
- "eslint-plugin-sonarjs": "^0.16.0",
78
+ "eslint-plugin-sonarjs": "^0.23.0",
79
79
  "eslint-plugin-standard": "^4.1.0",
80
- "eslint-plugin-unicorn": "^44.0.2",
80
+ "eslint-plugin-unicorn": "^49.0.0",
81
81
  "json-metaschema": "1.3.0",
82
- "mocha": "^10.1.0",
82
+ "mocha": "^10.2.0",
83
83
  "npm-run-all": "^4.1.5",
84
- "open-cli": "^7.1.0",
85
- "rollup": "^3.4.0",
84
+ "open-cli": "^7.2.0",
85
+ "rollup": "^4.4.0",
86
86
  "rollup-plugin-re": "^1.0.7",
87
87
  "textbrowser-data-schemas": "^0.2.0"
88
88
  },
@@ -6,7 +6,7 @@
6
6
 
7
7
  const {ceil} = Math;
8
8
  const arrayChunk = (arr, size) => {
9
- return [...Array.from({length: ceil(arr.length / size)})].map((_, i) => {
9
+ return Array.from({length: ceil(arr.length / size)}, (_, i) => {
10
10
  const offset = i * size;
11
11
  return arr.slice(offset, offset + size);
12
12
  });
@@ -29,7 +29,7 @@ const arrayChunk = (arr, size) => {
29
29
  * @param {string} cfg.namespace
30
30
  * @param {string[]} cfg.files
31
31
  * @param {Logger} cfg.log
32
- * @param {string} [cfg.basePath=""]
32
+ * @param {string} [cfg.basePath]
33
33
  * @returns {Promise<void>}
34
34
  */
35
35
  export default async function activateCallback ({
@@ -22,14 +22,14 @@ import workSelect from './workSelect.js';
22
22
  import workDisplay from './workDisplay.js';
23
23
  import {resultsDisplayClient} from './resultsDisplay.js';
24
24
 
25
- /* eslint-disable no-unused-vars */
25
+ /* eslint-disable no-unused-vars, @stylistic/brace-style */
26
26
  /**
27
27
  *
28
28
  * @param {null|number|string|PlainObject|GenericArray} obj
29
29
  * @returns {void}
30
30
  */
31
31
  function s (obj) { dialogs.alert(JSON.stringify(obj)); } // lgtm [js/unused-local-variable]
32
- /* eslint-enable no-unused-vars */
32
+ /* eslint-enable no-unused-vars, @stylistic/brace-style */
33
33
 
34
34
  /**
35
35
  *
@@ -85,7 +85,7 @@ async function prepareForServiceWorker () {
85
85
  * @returns {Promise<void>}
86
86
  */
87
87
  async function requestPermissions (langs, l) {
88
- return await new Promise((resolve, reject) => {
88
+ return await new Promise((resolve) => {
89
89
  // Todo: We could run the dialog code below for every page if
90
90
  // `Notification.permission === 'default'` (i.e., not choice
91
91
  // yet made by user), but user may avoid denying with intent
@@ -235,7 +235,7 @@ class TextBrowser {
235
235
 
236
236
  // Need for directionality even if language specified (and we don't want
237
237
  // to require it as a param)
238
- // Todo: Use rtl-detect (already included)
238
+ // Todo: Use intl-locale-textinfo-polyfill (already included)
239
239
  getDirectionForLanguageCode (code) {
240
240
  const langs = this.langData.languages;
241
241
  const exactMatch = langs.find((lang) => {
@@ -1,5 +1,5 @@
1
1
  /* eslint-env browser */
2
- import rtlDetect from 'rtl-detect';
2
+ import Locale from 'intl-locale-textinfo-polyfill';
3
3
  import JsonRefs from 'json-refs';
4
4
  import {jml} from 'jamilih';
5
5
 
@@ -11,7 +11,11 @@ import {
11
11
  import {Languages} from './utils/Languages.js';
12
12
  import {getWorkData} from './utils/WorkInfo.js';
13
13
 
14
- const {getLangDir} = rtlDetect;
14
+ const getLangDir = (locale) => {
15
+ const {direction} = new Locale(locale).textInfo;
16
+ return direction;
17
+ };
18
+
15
19
  const fieldValueAliasRegex = /^.* \((.*?)\)$/;
16
20
 
17
21
  const getRawFieldValue = (v) => {
@@ -61,7 +65,7 @@ const setAnchor = ({
61
65
  }
62
66
  }
63
67
  if (anchors.length) {
64
- const escapeSelectorAttValue = (str) => (str || '').replace(/["\\]/g, '\\$&');
68
+ const escapeSelectorAttValue = (str) => (str || '').replaceAll(/["\\]/g, '\\$&');
65
69
  const escapedRow = escapeSelectorAttValue(anchors.join('-'));
66
70
  const escapedCol = anchorField
67
71
  ? escapeSelectorAttValue(anchorField)
@@ -172,7 +176,7 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
172
176
  fieldValueAliasMap, fieldValueAliasMapPreferred, localizedFieldNames,
173
177
  canonicalBrowseFieldNames
174
178
  }) => ({
175
- tr, foundState
179
+ tr // , foundState
176
180
  }) => {
177
181
  return canonicalBrowseFieldNames.map((fieldName) => {
178
182
  const idx = localizedFieldNames.indexOf(fieldName);
@@ -263,13 +267,13 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
263
267
  } while (field);
264
268
  checkedFields = checkedFields.filter((cf) => localizedFieldNames.includes(cf));
265
269
  const checkedFieldIndexes = checkedFields.map((cf) => localizedFieldNames.indexOf(cf));
266
- const allInterlinearColIndexes = checkedFieldIndexes.map((cfi, i) => {
270
+ const allInterlinearColIndexes = checkedFieldIndexes.map((cfi) => {
267
271
  const interlin = $p.get('interlin' + (cfi + 1), true);
268
- return interlin && interlin.split(/\s*,\s*/).map((col) =>
272
+ return interlin && interlin.split(/\s*,\s*/).map((col) => {
269
273
  // Todo: Avoid this when known to be integer or if string, though allow
270
274
  // string to be treated as number if config is set.
271
- Number.parseInt(col) - 1
272
- ).filter((n) => !Number.isNaN(n));
275
+ return Number.parseInt(col) - 1;
276
+ }).filter((n) => !Number.isNaN(n));
273
277
  });
274
278
  return [checkedFields, checkedFieldIndexes, allInterlinearColIndexes];
275
279
  };
@@ -298,8 +302,8 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
298
302
  );
299
303
  */
300
304
  const startSep = Templates.resultsDisplayServerOrClient.startSeparator({l});
301
- const innerBrowseFieldSeparator = Templates.resultsDisplayServerOrClient
302
- .innerBrowseFieldSeparator({l});
305
+ const innerBrowseFieldSeparator = Templates.resultsDisplayServerOrClient.
306
+ innerBrowseFieldSeparator({l});
303
307
 
304
308
  const buildRanges = () => {
305
309
  const endVals = [];
@@ -358,9 +362,9 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
358
362
  if (fieldValueAliasMap) {
359
363
  Object.entries(fieldValueAliasMap).forEach(([key, val]) => {
360
364
  if (Array.isArray(val)) {
361
- fieldValueAliasMap[key] = val.map((value) =>
362
- Templates.resultsDisplayServerOrClient.fieldValueAlias({key, value})
363
- );
365
+ fieldValueAliasMap[key] = val.map((value) => {
366
+ return Templates.resultsDisplayServerOrClient.fieldValueAlias({key, value});
367
+ });
364
368
  return;
365
369
  }
366
370
  if (val && typeof val === 'object') {
@@ -424,7 +428,7 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
424
428
  const $pEscArbitrary = (param) => escapeHTML($p.get(param, true));
425
429
 
426
430
  // Not currently in use
427
- const escapeQuotedCSS = (s) => s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
431
+ const escapeQuotedCSS = (s) => s.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
428
432
 
429
433
  const {
430
434
  fileData, workI18n, getFieldAliasOrName, schemaObj, metadataObj,
@@ -468,7 +472,7 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
468
472
  console.log('pluginsForWork', pluginsForWork);
469
473
  const {lang} = this; // array with first item as preferred
470
474
  pluginsForWork.iterateMappings(({
471
- plugin,
475
+ // plugin,
472
476
  pluginName, pluginLang,
473
477
  onByDefaultDefault,
474
478
  placement, applicableFields, meta
@@ -568,11 +572,11 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
568
572
  prefI18n !== 'false' && this.localizeParamNames
569
573
  );
570
574
  const lParam = localizeParamNames
571
- ? key => l(['params', key])
572
- : key => key;
575
+ ? (key) => l(['params', key])
576
+ : (key) => key;
573
577
  const lIndexedParam = localizeParamNames
574
- ? key => l(['params', 'indexed', key])
575
- : key => key;
578
+ ? (key) => l(['params', 'indexed', key])
579
+ : (key) => key;
576
580
  const lParamRaw = localizeParamNames
577
581
  ? (key, suffix = '') => $p.get(lParam(key) + suffix, true)
578
582
  : (key, suffix = '') => $p.get(key + suffix, true);
@@ -581,9 +585,9 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
581
585
  : (key, suffix = '') => $p.get($p.get('work') + '-' + key + suffix, true);
582
586
 
583
587
  // Now that we know `browseFieldSets`, we can parse `startEnd`
584
- const browseFieldSetStartEndIdx = browseFieldSets.findIndex((item, i) =>
585
- lIndexedParamRaw('startEnd', (i + 1))
586
- );
588
+ const browseFieldSetStartEndIdx = browseFieldSets.findIndex((item, i) => {
589
+ return lIndexedParamRaw('startEnd', (i + 1));
590
+ });
587
591
  if (browseFieldSetStartEndIdx !== -1) {
588
592
  // Todo: i18nize (by work and/or by whole app?)
589
593
  const rangeSep = '-';
@@ -618,29 +622,30 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
618
622
  }
619
623
  }
620
624
 
621
- const browseFieldSetIdx = browseFieldSets.findIndex((item, i) =>
622
- lIndexedParamRaw('start', (i + 1) + '-1')
623
- );
625
+ const browseFieldSetIdx = browseFieldSets.findIndex((item, i) => {
626
+ return lIndexedParamRaw('start', (i + 1) + '-1');
627
+ });
624
628
  const applicableBrowseFieldSet = browseFieldSets[browseFieldSetIdx];
625
629
  const applicableBrowseFieldSetName = setNames[browseFieldSetIdx];
626
- const applicableBrowseFieldNames = applicableBrowseFieldSet.map((abfs) =>
627
- abfs.fieldName
628
- );
630
+ const applicableBrowseFieldNames = applicableBrowseFieldSet.map((abfs) => {
631
+ return abfs.fieldName;
632
+ });
629
633
 
630
634
  const canonicalBrowseFieldSet = browseFieldSets[0];
631
635
  const canonicalBrowseFieldSetName = setNames[0];
632
- const canonicalBrowseFieldNames = canonicalBrowseFieldSet.map((abfs) =>
633
- abfs.fieldName
634
- );
636
+ const canonicalBrowseFieldNames = canonicalBrowseFieldSet.map((abfs) => {
637
+ return abfs.fieldName;
638
+ });
635
639
 
636
640
  const fieldSchemaTypes = applicableBrowseFieldSet.map((abfs) => abfs.fieldSchema.type);
637
- const buildRangePoint = (startOrEnd) =>
638
- applicableBrowseFieldNames.map((bfn, j) =>
639
- $p.get(
641
+ const buildRangePoint = (startOrEnd) => {
642
+ return applicableBrowseFieldNames.map((bfn, j) => {
643
+ return $p.get(
640
644
  $p.get('work') + '-' + startOrEnd + (browseFieldSetIdx + 1) + '-' + (j + 1),
641
645
  true
642
- )
643
- );
646
+ );
647
+ });
648
+ };
644
649
  const starts = buildRangePoint('start');
645
650
  const ends = buildRangePoint('end');
646
651
 
@@ -700,7 +705,7 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
700
705
  // through notifications (or however)
701
706
  !noIndexedDB
702
707
  ) {
703
- tableData = await new Promise((resolve, reject) => {
708
+ tableData = await new Promise((resolve) => {
704
709
  // Todo: Fetch the work in code based on the non-localized `datafileName`
705
710
  const dbName = this.namespace + '-textbrowser-cache-data';
706
711
  const req = indexedDB.open(dbName);
@@ -751,11 +756,11 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
751
756
  }
752
757
  }
753
758
  if (!usingServerData && pluginsForWork) {
754
- fieldInfo.forEach(({plugin, placement}, j) => {
759
+ fieldInfo.forEach(({plugin, placement}) => {
755
760
  if (!plugin) {
756
761
  return;
757
762
  }
758
- tableData.forEach((tr, i) => {
763
+ tableData.forEach((tr) => {
759
764
  // Todo: We should pass on other arguments (like `meta` but on `applicableFields`)
760
765
  tr.splice(
761
766
  placement,
@@ -19,9 +19,9 @@ export default {
19
19
  });
20
20
  }
21
21
  }
22
- }, langs.map(({code}) =>
23
- ['option', {value: code}, [languages.getLanguageFromCode(code)]]
24
- )]
22
+ }, langs.map(({code}) => {
23
+ return ['option', {value: code}, [languages.getLanguageFromCode(code)]];
24
+ })]
25
25
  ], $('#main'));
26
26
  if (history.state && typeof history.state === 'object') {
27
27
  formDeserialize(document.querySelector('#languageSelectionContainer'), history.state);
@@ -1,4 +1,3 @@
1
- /* globals console, DOMParser */
2
1
  import Templates from './index.js';
3
2
 
4
3
  export default {
@@ -34,7 +33,8 @@ export default {
34
33
  return `<span class="interlintitle">${val}</span>${colonSpace}`;
35
34
  },
36
35
  styles ({
37
- $p, $pRaw, $pRawEsc, $pEscArbitrary, escapeQuotedCSS, escapeCSS,
36
+ $p, $pRaw, $pRawEsc, $pEscArbitrary, // escapeQuotedCSS,
37
+ escapeCSS,
38
38
  tableWithFixedHeaderAndFooter, checkedFieldIndexes, hasCaption
39
39
  }) {
40
40
  const colorEsc = !$p.has('color', true) || $p.get('color', true) === '#'
@@ -141,8 +141,8 @@ div.inner-caption {
141
141
  }
142
142
  ${escapeCSS($pEscArbitrary('pagecss') || '')}
143
143
  ` +
144
- checkedFieldIndexes.map((idx, i) =>
145
- ($pRaw('header') === 'y'
144
+ checkedFieldIndexes.map((idx, i) => {
145
+ return ($pRaw('header') === 'y'
146
146
  ? (tableWithFixedHeaderAndFooter
147
147
  ? `.thead .th:nth-child(${i + 1}) div.th-inner, `
148
148
  : `.thead .th:nth-child(${i + 1}), `)
@@ -156,14 +156,17 @@ ${escapeCSS($pEscArbitrary('pagecss') || '')}
156
156
  `{
157
157
  ${$pEscArbitrary('css' + (idx + 1))}
158
158
  }
159
- `).join('') +
159
+ `;
160
+ }).join('') +
160
161
 
161
- ($pEscArbitrary('interlintitle_css') ? `
162
- /* http://salzerdesign.com/test/fixedTable.html */
163
- .interlintitle {
164
- ${escapeCSS($pEscArbitrary('interlintitle_css'))}
165
- }
166
- ` : '') +
162
+ ($pEscArbitrary('interlintitle_css')
163
+ ? `
164
+ /* http://salzerdesign.com/test/fixedTable.html */
165
+ .interlintitle {
166
+ ${escapeCSS($pEscArbitrary('interlintitle_css'))}
167
+ }
168
+ `
169
+ : '') +
167
170
  (bgcolorEsc
168
171
  ? `
169
172
  body {
@@ -357,16 +360,18 @@ body {
357
360
  }),
358
361
  tableWrap([
359
362
  addChildren(tableElem, [
360
- (caption ? addChildren(captionElem, [
361
- caption,
362
- tableWithFixedHeaderAndFooter
363
- ? ['div', {class: 'zupa1'}, [
364
- ['div', {class: 'inner-caption'}, [
365
- ['span', [caption]]
363
+ (caption
364
+ ? addChildren(captionElem, [
365
+ caption,
366
+ tableWithFixedHeaderAndFooter
367
+ ? ['div', {class: 'zupa1'}, [
368
+ ['div', {class: 'inner-caption'}, [
369
+ ['span', [caption]]
370
+ ]]
366
371
  ]]
367
- ]]
368
- : ''
369
- ]) : ''),
372
+ : ''
373
+ ])
374
+ : ''),
370
375
  /*
371
376
  // Works but quirky, e.g., `color` doesn't work (as also
372
377
  // confirmed per https://quirksmode.org/css/css2/columns.html)
@@ -376,54 +381,60 @@ body {
376
381
  )
377
382
  ),
378
383
  */
379
- ($pRaw('header') !== '0' ? addChildren(theadElem, [
380
- addChildren(trElem,
381
- checkedFields.map((cf, i) => {
382
- const interlinearColIndexes = allInterlinearColIndexes[i];
383
- cf = escapeHTML(cf) + (interlinearColIndexes
384
- ? l('comma-space') + interlinearColIndexes.map((idx) =>
385
- localizedFieldNames[idx]
386
- ).join(l('comma-space'))
387
- : ''
388
- );
389
- return addChildren(thElem, [
390
- cf,
391
- (tableWithFixedHeaderAndFooter
392
- ? ['div', {class: 'zupa1'}, [
393
- ['div', {class: 'th-inner'}, [
394
- ['span', [cf]]
395
- ]]
396
- ]]
384
+ ($pRaw('header') !== '0'
385
+ ? addChildren(theadElem, [
386
+ addChildren(
387
+ trElem,
388
+ checkedFields.map((cf, i) => {
389
+ const interlinearColIndexes = allInterlinearColIndexes[i];
390
+ cf = escapeHTML(cf) + (interlinearColIndexes
391
+ ? l('comma-space') + interlinearColIndexes.map((idx) => {
392
+ return localizedFieldNames[idx];
393
+ }).join(l('comma-space'))
397
394
  : ''
398
- )
399
- ]);
400
- })
401
- )
402
- ]) : ''),
403
- ($pRaw('footer') && $pRaw('footer') !== '0' ? addChildren(tfootElem, [
404
- addChildren(trElem,
405
- checkedFields.map((cf, i) => {
406
- const interlinearColIndexes = allInterlinearColIndexes[i];
407
- cf = escapeHTML(cf) + (interlinearColIndexes
408
- ? l('comma-space') + interlinearColIndexes.map((idx) =>
409
- localizedFieldNames[idx]
410
- ).join(l('comma-space'))
411
- : ''
412
- );
413
- return addChildren(thElem, [
414
- cf,
415
- (tableWithFixedHeaderAndFooter
416
- ? ['div', {class: 'zupa1'}, [
417
- ['div', {class: 'th-inner'}, [
418
- ['span', [cf]]
395
+ );
396
+ return addChildren(thElem, [
397
+ cf,
398
+ (tableWithFixedHeaderAndFooter
399
+ ? ['div', {class: 'zupa1'}, [
400
+ ['div', {class: 'th-inner'}, [
401
+ ['span', [cf]]
402
+ ]]
419
403
  ]]
420
- ]]
404
+ : ''
405
+ )
406
+ ]);
407
+ })
408
+ )
409
+ ])
410
+ : ''),
411
+ ($pRaw('footer') && $pRaw('footer') !== '0'
412
+ ? addChildren(tfootElem, [
413
+ addChildren(
414
+ trElem,
415
+ checkedFields.map((cf, i) => {
416
+ const interlinearColIndexes = allInterlinearColIndexes[i];
417
+ cf = escapeHTML(cf) + (interlinearColIndexes
418
+ ? l('comma-space') + interlinearColIndexes.map((idx) => {
419
+ return localizedFieldNames[idx];
420
+ }).join(l('comma-space'))
421
421
  : ''
422
- )
423
- ]);
424
- })
425
- )
426
- ]) : ''),
422
+ );
423
+ return addChildren(thElem, [
424
+ cf,
425
+ (tableWithFixedHeaderAndFooter
426
+ ? ['div', {class: 'zupa1'}, [
427
+ ['div', {class: 'th-inner'}, [
428
+ ['span', [cf]]
429
+ ]]
430
+ ]]
431
+ : ''
432
+ )
433
+ ]);
434
+ })
435
+ )
436
+ ])
437
+ : ''),
427
438
  addChildren(tbodyElem, outArr)
428
439
  ])
429
440
  ])