chat_sdk-slack 0.8.0 → 0.8.1
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/slack/format_converter.rb +2 -18
- 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: 229d477d831f90275df64bc7eb47447ba4fcb574f435806d2839c3aa3154d106
|
|
4
|
+
data.tar.gz: a538ab5f51da90868d3fd4b018ba33d98b97d703d952844909cdc614e5a08e10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86a3e66cc7be0f102beb2ce1d12c4b7e6ba60df6e0dbaa6887a43a3ff15dbbc16c1d003573cb12093a763fb338eb7d37205be62717c3feffbd6560533f73ea62
|
|
7
|
+
data.tar.gz: 0b78d5335690d409deedc6a69f45a57093ab559a35a0e20f1ee4518b883afc924f5919a4b2f46e1b50dc12fd443ae7eb9547c3c268daff1928c6db37244f1902
|
|
@@ -21,16 +21,6 @@ module ChatSDK
|
|
|
21
21
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
|
-
# Splits text into alternating [text, code, text, code, ...] segments.
|
|
25
|
-
# Odd-indexed segments are code blocks (including their delimiters) and
|
|
26
|
-
# should be passed through without conversion.
|
|
27
|
-
def split_code_blocks(text)
|
|
28
|
-
# Match fenced code blocks (```...```) and inline code (`...`)
|
|
29
|
-
# The fenced block pattern must come first so triple backticks aren't
|
|
30
|
-
# eaten by the inline pattern.
|
|
31
|
-
text.split(/(```[\s\S]*?```|`[^`]+`)/)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
24
|
# ── Slack mrkdwn → Markdown ──────────────────────────────────────────
|
|
35
25
|
|
|
36
26
|
def convert_mrkdwn_to_md(text)
|
|
@@ -81,14 +71,8 @@ module ChatSDK
|
|
|
81
71
|
# Links: [text](url) -> <url|text>
|
|
82
72
|
result = result.gsub(/\[([^\]]+)\]\(([^)]+)\)/) { "<#{Regexp.last_match(2)}|#{Regexp.last_match(1)}>" }
|
|
83
73
|
|
|
84
|
-
# Bold
|
|
85
|
-
result = result
|
|
86
|
-
|
|
87
|
-
# Italic: *text* -> _text_ (only single asterisks remaining after bold placeholder)
|
|
88
|
-
result = result.gsub(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/, '_\1_')
|
|
89
|
-
|
|
90
|
-
# Restore bold placeholders
|
|
91
|
-
result = result.gsub(/\x00BOLD(.+?)BOLD\x00/, '*\1*')
|
|
74
|
+
# Bold/italic with placeholder to prevent double conversion
|
|
75
|
+
result = convert_bold_and_italic_from_md(result, bold_char: "*", italic_char: "_")
|
|
92
76
|
|
|
93
77
|
# Strikethrough: ~~text~~ -> ~text~
|
|
94
78
|
result = result.gsub(/~~(.+?)~~/, '~\1~')
|