confluence-cli 1.21.1 → 1.22.0
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/lib/confluence-client.js +25 -0
- package/package.json +1 -1
package/lib/confluence-client.js
CHANGED
|
@@ -5,6 +5,27 @@ const FormData = require('form-data');
|
|
|
5
5
|
const { convert } = require('html-to-text');
|
|
6
6
|
const MarkdownIt = require('markdown-it');
|
|
7
7
|
|
|
8
|
+
const NAMED_ENTITIES = {
|
|
9
|
+
// uppercase variants
|
|
10
|
+
aring: 'å', auml: 'ä', ouml: 'ö',
|
|
11
|
+
eacute: 'é', egrave: 'è', ecirc: 'ê', euml: 'ë',
|
|
12
|
+
aacute: 'á', agrave: 'à', acirc: 'â', atilde: 'ã',
|
|
13
|
+
oacute: 'ó', ograve: 'ò', ocirc: 'ô', otilde: 'õ',
|
|
14
|
+
uacute: 'ú', ugrave: 'ù', ucirc: 'û', uuml: 'ü',
|
|
15
|
+
iacute: 'í', igrave: 'ì', icirc: 'î', iuml: 'ï',
|
|
16
|
+
ntilde: 'ñ', ccedil: 'ç', szlig: 'ß', yuml: 'ÿ',
|
|
17
|
+
eth: 'ð', thorn: 'þ',
|
|
18
|
+
// uppercase variants
|
|
19
|
+
Aring: 'Å', Auml: 'Ä', Ouml: 'Ö',
|
|
20
|
+
Eacute: 'É', Egrave: 'È', Ecirc: 'Ê', Euml: 'Ë',
|
|
21
|
+
Aacute: 'Á', Agrave: 'À', Acirc: 'Â', Atilde: 'Ã',
|
|
22
|
+
Oacute: 'Ó', Ograve: 'Ò', Ocirc: 'Ô', Otilde: 'Õ',
|
|
23
|
+
Uacute: 'Ú', Ugrave: 'Ù', Ucirc: 'Û', Uuml: 'Ü',
|
|
24
|
+
Iacute: 'Í', Igrave: 'Ì', Icirc: 'Î', Iuml: 'Ï',
|
|
25
|
+
Ntilde: 'Ñ', Ccedil: 'Ç', Szlig: 'SS', Yuml: 'Ÿ',
|
|
26
|
+
Eth: 'Ð', Thorn: 'Þ'
|
|
27
|
+
};
|
|
28
|
+
|
|
8
29
|
class ConfluenceClient {
|
|
9
30
|
constructor(config) {
|
|
10
31
|
this.domain = config.domain;
|
|
@@ -1472,6 +1493,9 @@ class ConfluenceClient {
|
|
|
1472
1493
|
// Numeric HTML entities
|
|
1473
1494
|
markdown = markdown.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(parseInt(code, 10)));
|
|
1474
1495
|
markdown = markdown.replace(/&#x([0-9a-fA-F]+);/g, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
1496
|
+
|
|
1497
|
+
// Clean up nordic alphabets and other named entities
|
|
1498
|
+
markdown = markdown.replace(/&([a-zA-Z]+);/g, (match, name) => NAMED_ENTITIES[name] || match);
|
|
1475
1499
|
|
|
1476
1500
|
// Clean up extra whitespace for standard Markdown format
|
|
1477
1501
|
// Remove trailing spaces from each line
|
|
@@ -2018,3 +2042,4 @@ class ConfluenceClient {
|
|
|
2018
2042
|
}
|
|
2019
2043
|
|
|
2020
2044
|
module.exports = ConfluenceClient;
|
|
2045
|
+
module.exports.NAMED_ENTITIES = NAMED_ENTITIES;
|