hoe-markdown 1.5.1 → 1.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cc0106e2ca0ff4a9737428397092d41934babb0c2be0fe7036046bffb3b7ccf
4
- data.tar.gz: a5e2956195654d9fe6a011ad00893b4cf6d5f70603c5ed8aa7b90250e01d65e9
3
+ metadata.gz: ec4f0613c872babc3ad05a0fc751e8fccd3cbe86903ad2b184e0d1c801f8dad1
4
+ data.tar.gz: bc67121c659c02f5bde9fcc351ba90f9c019b25ba916c7b53da1b598798c0a43
5
5
  SHA512:
6
- metadata.gz: 948b02eb6dac577a5c8e9a5425aefae6d78070743aa023c9cdf0c6ef5ede50aee88449d4e08bdcc455f472ecffbe7ec7886e098790db27fb91090890e7faa1bc
7
- data.tar.gz: 9052832cfebca7e3664f87e234332f3fbca03fecf129340572ce825bc75362c1477d1b384b98d1a88f1392cdf9df1e119a5ed531fe9fc0bd7c46d4ba3b7c3be8
6
+ metadata.gz: 12c36a92d335f28bf4aef752e07a5998c950ee2ef99f9392a00a83612fc09aad1abe4856f11912fce633f6850194e8209df1d7268ea4d75fe3404ff57502e4cc
7
+ data.tar.gz: 85534f4dce74c768a512402418ae32ed2249ecfc1e4e73ddd497c3172ba486ec33633a2b23533fdf26bc85e863b9a633df05df2992212681492ef2c9ebd5c1c4
@@ -17,7 +17,7 @@ jobs:
17
17
  strategy:
18
18
  fail-fast: false
19
19
  matrix:
20
- ruby: ["2.7", "3.0", "3.1", "3.2", "head"]
20
+ ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"]
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
23
  - uses: actions/checkout@v4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Hoe::Markdown CHANGELOG
2
2
 
3
+ ## v1.7.0 / 2025-01-02
4
+
5
+ Fix:
6
+
7
+ - Do not linkify link refs and link ref definitions. #5 @halostatue
8
+
9
+
10
+ ## v1.6.0 / 2023-11-19
11
+
12
+ Fix:
13
+
14
+ - Do not linkify things like that look like issues when they are part of a word, like "LH#123".
15
+
16
+
3
17
  ## v1.5.1 / 2023-10-10
4
18
 
5
19
  Remove experimental code that was accidentally included in v1.5.0.
@@ -2,6 +2,9 @@ class Hoe
2
2
  module Markdown
3
3
  module Util
4
4
  GITHUB_ISSUE_MENTION_REGEX = %r{
5
+ # not immediately preceded by a word character
6
+ (?<!\w)
7
+
5
8
  # issue number, like '#1234'
6
9
  \#([[:digit:]]+)
7
10
 
@@ -54,13 +57,33 @@ class Hoe
54
57
  }x
55
58
 
56
59
  markdown
57
- .gsub(GITHUB_ISSUE_MENTION_REGEX, "[#\\1](#{issues_uri}/\\1)")
58
- .gsub(issue_uri_regex, "[#\\1](#{issues_uri}/\\1)")
59
- .gsub(pull_uri_regex, "[#\\1](#{pull_uri}/\\1)")
60
+ .gsub(GITHUB_ISSUE_MENTION_REGEX) {
61
+ __replace_with_link(Regexp.last_match, "[#%<id>s](#{issues_uri}/%<id>s)")
62
+ }
63
+ .gsub(issue_uri_regex) {
64
+ __replace_with_link(Regexp.last_match, "[#%<id>s](#{issues_uri}/%<id>s)")
65
+ }
66
+ .gsub(pull_uri_regex) {
67
+ __replace_with_link(Regexp.last_match, "[#%<id>s](#{pull_uri}/%<id>s)")
68
+ }
60
69
  end
61
70
 
62
71
  def self.linkify_github_usernames(markdown)
63
- markdown.gsub(GITHUB_USER_REGEX, "[@\\1](https://github.com/\\1)")
72
+ markdown.gsub(GITHUB_USER_REGEX) {
73
+ __replace_with_link(Regexp.last_match, "[@%<id>s](https://github.com/%<id>s)")
74
+ }
75
+ end
76
+
77
+ def self.__replace_with_link(match, link)
78
+ skip =
79
+ (match.pre_match.end_with?("\n[") && match.post_match =~ /\A\]:\s+.+\n/) ||
80
+ (match.pre_match =~ /\]\[[^\]]*\z/ && match.post_match =~ /\A[^\]]*\]/)
81
+
82
+ if skip
83
+ match[0]
84
+ else
85
+ link % {id: match[1]}
86
+ end
64
87
  end
65
88
  end
66
89
  end
@@ -1,5 +1,5 @@
1
1
  class Hoe
2
2
  module Markdown
3
- VERSION = "1.5.1"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
10
+ date: 2025-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -54,7 +53,6 @@ metadata:
54
53
  homepage_uri: https://github.com/flavorjones/hoe-markdown
55
54
  source_code_uri: https://github.com/flavorjones/hoe-markdown
56
55
  changelog_uri: https://github.com/flavorjones/hoe-markdown/blob/master/CHANGELOG.md
57
- post_install_message:
58
56
  rdoc_options: []
59
57
  require_paths:
60
58
  - lib
@@ -69,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
67
  - !ruby/object:Gem::Version
70
68
  version: '0'
71
69
  requirements: []
72
- rubygems_version: 3.5.0.dev
73
- signing_key:
70
+ rubygems_version: 3.6.2
74
71
  specification_version: 4
75
72
  summary: Hoe plugin with helpers for markdown documentation files.
76
73
  test_files: []