@vielhuber/wahelper 1.2.3 → 1.2.5
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/WhatsApp.js +5 -3
- package/package.json +1 -1
package/WhatsApp.js
CHANGED
|
@@ -47,6 +47,8 @@ export default class WhatsApp {
|
|
|
47
47
|
currentDir = dirname(fileURLToPath(import.meta.url));
|
|
48
48
|
if (currentDir.includes('node_modules')) {
|
|
49
49
|
projectRoot = dirname(dirname(dirname(currentDir)));
|
|
50
|
+
} else if (currentDir.includes('vendor')) {
|
|
51
|
+
projectRoot = dirname(dirname(dirname(currentDir)));
|
|
50
52
|
} else {
|
|
51
53
|
projectRoot = currentDir;
|
|
52
54
|
}
|
|
@@ -388,11 +390,11 @@ export default class WhatsApp {
|
|
|
388
390
|
// remove "<x> </x>"
|
|
389
391
|
message = message.replace(/<([a-z]+)(?:\s[^>]*)?\>\s*<\/\1>/gis, '');
|
|
390
392
|
// replace <strong>...</strong> with "*"
|
|
391
|
-
message = message.replace(/<strong(?:\s[^>]*)?\>(.*?)<\/strong>/
|
|
393
|
+
message = message.replace(/<strong(?:\s[^>]*)?\>(.*?)<\/strong>/gi, '*$1*');
|
|
392
394
|
// replace <em></em> with "_"
|
|
393
|
-
message = message.replace(/<em(?:\s[^>]*)?\>(.*?)<\/em>/
|
|
395
|
+
message = message.replace(/<em(?:\s[^>]*)?\>(.*?)<\/em>/gi, '_$1_');
|
|
394
396
|
// replace <i></i> with "_"
|
|
395
|
-
message = message.replace(/<i(?:\s[^>]*)?\>(.*?)<\/i>/
|
|
397
|
+
message = message.replace(/<i(?:\s[^>]*)?\>(.*?)<\/i>/gi, '_$1_');
|
|
396
398
|
// replace <ul> with line break
|
|
397
399
|
message = message.replace(/<ul(?:\s[^>]*)?\>(.*?)<\/ul>/gis, '\n$1\n');
|
|
398
400
|
// replace "<li></li>" with " - "
|