chat_sdk-whatsapp 0.8.0 → 0.9.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.
- checksums.yaml +4 -4
- data/lib/chat_sdk/whatsapp/format_converter.rb +2 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78917e2480c080caef0338d429d3f91c11fa886f3ebe0a3054ecf1dbed730bae
|
|
4
|
+
data.tar.gz: 3bda0cd18ee75406ad07085e28d7ee61e92af98061a2761c0e8c8847c87a1fa3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 821d98420a0dca888ee03f62ea72ce83f5d204883749f5a4e36682e29b86999d89008956b2ea3ccc66b7b70c15f0a8ece83f9c70a0fef63e9e1b6593588acd3b
|
|
7
|
+
data.tar.gz: d5977f541e427eb4a68939489004f35eecb407201d4a057f6bc00afb4cbf0b1a5114c313ca21611da4eafd35550aad3ca6f1249b2bf994380887d2d793c6a997
|
|
@@ -23,10 +23,6 @@ module ChatSDK
|
|
|
23
23
|
|
|
24
24
|
private
|
|
25
25
|
|
|
26
|
-
def split_code_blocks(text)
|
|
27
|
-
text.split(/(```[\s\S]*?```|`[^`]+`)/)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
26
|
def convert_whatsapp_to_md(text)
|
|
31
27
|
result = text
|
|
32
28
|
|
|
@@ -43,14 +39,8 @@ module ChatSDK
|
|
|
43
39
|
def convert_md_to_whatsapp(text)
|
|
44
40
|
result = text
|
|
45
41
|
|
|
46
|
-
# Bold
|
|
47
|
-
result = result
|
|
48
|
-
|
|
49
|
-
# Italic: *text* → _text_ (only single asterisks remaining after bold placeholder)
|
|
50
|
-
result = result.gsub(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/m, '_\1_')
|
|
51
|
-
|
|
52
|
-
# Restore bold placeholders
|
|
53
|
-
result = result.gsub(/\x00BOLD(.+?)BOLD\x00/m, '*\1*')
|
|
42
|
+
# Bold/italic with placeholder to prevent double conversion
|
|
43
|
+
result = convert_bold_and_italic_from_md(result, bold_char: "*", italic_char: "_")
|
|
54
44
|
|
|
55
45
|
# Strikethrough: ~~text~~ → ~text~
|
|
56
46
|
result.gsub(/~~(.+?)~~/m, '~\1~')
|