telegrama 0.3.0 → 0.3.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/CHANGELOG.md +9 -0
- data/context7.json +4 -0
- data/lib/telegrama/formatter.rb +10 -1
- data/lib/telegrama/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d31e0ac18148fac53c29577602d858f326781575376c6fd42c1e984fac1adc2
|
|
4
|
+
data.tar.gz: a41b7301c11863797a284bb4f1284d45e146f4c74126bd3b3e52d334945687d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9284e1584ca9874b51bc63ff968eb01822d9e5ac72fdfe36afaaf0fc995738e7c234f44dc52638216743f068819899fc596c38415efff64775ed21fa4e016f57
|
|
7
|
+
data.tar.gz: 1473e4fabcf750c0491f5a659b500190307f094158984d95b2f97a068ec9c90d60a85653af6efd2a0a6fbee706e48259bf2b61d0838872e094a7cc5b500a1567
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.1] - 2026-07-22
|
|
4
|
+
|
|
5
|
+
- Fixed MarkdownV2 escaping for `-` inside link text: the link-text escape
|
|
6
|
+
class was missing the hyphen, so a label like `[GPS-risk](url)` reached
|
|
7
|
+
Telegram unescaped — the API rejects the entire message ("Character '-' is
|
|
8
|
+
reserved and must be escaped") and delivery fell back to unformatted plain
|
|
9
|
+
text. The escape regex is now derived from `MARKDOWN_SPECIAL_CHARS` so the
|
|
10
|
+
two can never drift apart again.
|
|
11
|
+
|
|
3
12
|
## [0.3.0] - 2026-05-22
|
|
4
13
|
|
|
5
14
|
- Added support for sending messages to Telegram forum topics with `message_thread_id`
|
data/context7.json
ADDED
data/lib/telegrama/formatter.rb
CHANGED
|
@@ -7,6 +7,15 @@ module Telegrama
|
|
|
7
7
|
# Characters used for Markdown formatting that need special handling
|
|
8
8
|
MARKDOWN_FORMAT_CHARS = %w[* _].freeze
|
|
9
9
|
|
|
10
|
+
# Escapes every MarkdownV2-reserved character (plus backslash) inside link
|
|
11
|
+
# TEXT. Derived from MARKDOWN_SPECIAL_CHARS so the two can never drift: a
|
|
12
|
+
# hand-typed copy of this class was missing '-', which let hyphenated link
|
|
13
|
+
# labels ("[GPS-risk](url)") reach Telegram unescaped — and the API rejects
|
|
14
|
+
# the ENTIRE message, not just the link, so delivery fell back to raw
|
|
15
|
+
# unformatted text. (URL parts keep their own narrower class below: per the
|
|
16
|
+
# MarkdownV2 spec, inside the (...) part only ')' and '\' MUST be escaped.)
|
|
17
|
+
LINK_TEXT_ESCAPE_REGEX = /([#{Regexp.escape((MARKDOWN_SPECIAL_CHARS + [ "\\" ]).join)}])/
|
|
18
|
+
|
|
10
19
|
# Error class for Markdown formatting issues
|
|
11
20
|
class MarkdownError < StandardError; end
|
|
12
21
|
|
|
@@ -100,7 +109,7 @@ module Telegrama
|
|
|
100
109
|
url_part = $2
|
|
101
110
|
|
|
102
111
|
# Handle escaping within link text
|
|
103
|
-
text_part = text_part.gsub(
|
|
112
|
+
text_part = text_part.gsub(LINK_TEXT_ESCAPE_REGEX) { |m| "\\#{m}" }
|
|
104
113
|
|
|
105
114
|
# Escape special characters in URL (except parentheses which define URL boundaries)
|
|
106
115
|
url_part = url_part.gsub(/([_*\[\]~`>#+=|{}.!\\])/) { |m| "\\#{m}" }
|
data/lib/telegrama/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: telegrama
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Javi R
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-07-21 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -56,6 +56,7 @@ files:
|
|
|
56
56
|
- LICENSE.txt
|
|
57
57
|
- README.md
|
|
58
58
|
- Rakefile
|
|
59
|
+
- context7.json
|
|
59
60
|
- gemfiles/rails_7.2.gemfile
|
|
60
61
|
- gemfiles/rails_8.0.gemfile
|
|
61
62
|
- gemfiles/rails_8.1.gemfile
|