yard-relative_markdown_links 0.1.2 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 241fab84ccb581bb448a4982b49250ee49b522ea735f59a51b12075b62327951
4
- data.tar.gz: 46c1e2924b1022be33a4285392a7919f2f50c9805b27af78de92899e73c1e1d4
3
+ metadata.gz: 80b7c7cab3b827823c2078b115951199a31f73e9950d5a59c8ef3934e722a369
4
+ data.tar.gz: 34a0cacb3db651d342c1dca6df506bf71db93b63debc9a8bbae247743dd2d5d2
5
5
  SHA512:
6
- metadata.gz: ee7f97e58019d1cc899eca68bb052a8f7ed75b5dfdb70c67442a826a5d211ef89e1439d60750abd21df038f20079d606c14bf3b2c8029ed32cc1abf890b5ee58
7
- data.tar.gz: 635a2aec1be2c4576d6a098aeb55f790070d4d32ef921b6ca9499ea893899179a5dcc0a5812581d49ccddc9467e6d8e442e937c9aa92ec2d5ae0fd90af4b9520
6
+ metadata.gz: 7b011be39b3c63128218ea975e62dd4ee94c126582f99a2291dfe6674c0b80f807844d1b47f40844862aa17b81ddbd4333019cba2b6490d580075fad0a5d0ef8
7
+ data.tar.gz: c53087dbd10685c87f2ed4c1770942f2679fe444eb218dff93e9c46218c076861160d6b063cbe6d9ef7f9bd1599117508112aee22d30e2b6dc4bf77b6596ebaa
@@ -0,0 +1,16 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: bundler
5
+ directory: /
6
+ schedule:
7
+ interval: weekly
8
+ reviewers:
9
+ - haines
10
+
11
+ - package-ecosystem: github-actions
12
+ directory: /
13
+ schedule:
14
+ interval: weekly
15
+ reviewers:
16
+ - haines
@@ -0,0 +1,62 @@
1
+ name: pull-request
2
+
3
+ on:
4
+ - pull_request
5
+
6
+ jobs:
7
+ test:
8
+ strategy:
9
+ matrix:
10
+ ruby:
11
+ - "2.5"
12
+ - "2.6"
13
+ - "2.7"
14
+ - "3.0"
15
+
16
+ name: Ruby ${{ matrix.ruby }}
17
+
18
+ runs-on: ubuntu-latest
19
+
20
+ container:
21
+ image: ruby:${{ matrix.ruby }}-alpine
22
+
23
+ env:
24
+ BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
25
+
26
+ steps:
27
+ - name: Install dependencies
28
+ run: apk add build-base git tar
29
+
30
+ - name: Check out source code
31
+ uses: actions/checkout@v2
32
+
33
+ - name: Install Bundler
34
+ run: bin/install-bundler
35
+
36
+ - name: Compute cache key
37
+ id: cache-key
38
+ run: |
39
+ source /etc/os-release
40
+ printf \
41
+ "::set-output name=cache-key::alpine-%s-ruby-%s\n" \
42
+ "${VERSION_ID}" \
43
+ "${RUBY_VERSION}"
44
+
45
+ - name: Cache gems
46
+ uses: actions/cache@v2
47
+ with:
48
+ key: ${{ steps.cache-key.outputs.cache-key }}-gems-${{ hashFiles('Gemfile.lock') }}
49
+ path: vendor/bundle
50
+
51
+ - name: Install gems
52
+ run: bin/bundle install
53
+ env:
54
+ BUNDLE_FROZEN: true
55
+ BUNDLE_JOBS: 4
56
+ BUNDLE_RETRY: 3
57
+
58
+ - name: Run RuboCop
59
+ run: bin/rake rubocop
60
+
61
+ - name: Run tests
62
+ run: bin/rake test
data/.rubocop.yml CHANGED
@@ -1,16 +1,25 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
1
5
  AllCops:
2
- TargetRubyVersion: 2.3
6
+ NewCops: enable
7
+ TargetRubyVersion: 2.5
3
8
  Exclude:
4
9
  - bin/bundle
5
10
  - bin/rake
6
11
  - vendor/bundle/**/*
7
12
 
8
- Metrics/LineLength:
13
+ Layout/LineLength:
9
14
  Enabled: false
10
15
 
11
16
  Metrics/MethodLength:
12
17
  Enabled: false
13
18
 
19
+ Naming/FileName:
20
+ Exclude:
21
+ - lib/yard-relative_markdown_links.rb
22
+
14
23
  Style/BlockDelimiters:
15
24
  EnforcedStyle: semantic
16
25
 
@@ -18,10 +27,19 @@ Style/Documentation:
18
27
  Exclude:
19
28
  - test/**/*
20
29
 
30
+ Style/HashEachMethods:
31
+ Enabled: true
32
+
21
33
  Style/HashSyntax:
22
34
  Exclude:
23
35
  - Rakefile
24
36
 
37
+ Style/HashTransformKeys:
38
+ Enabled: true
39
+
40
+ Style/HashTransformValues:
41
+ Enabled: true
42
+
25
43
  Style/Lambda:
26
44
  EnforcedStyle: literal
27
45
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 3.0.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+ No notable changes.
10
+
11
+ ## [0.4.1] - 2021-11-15
12
+ ### Changed
13
+ * Require MFA to publish gem ([#92](https://github.com/haines/yard-relative_markdown_links/pull/92))
14
+
15
+ ## [0.4.0] - 2021-01-29
16
+ ### Changed
17
+ * Require Ruby ≥ 2.5 ([#40](https://github.com/haines/yard-relative_markdown_links/pull/40))
18
+ * Test against Ruby 3.0 ([#41](https://github.com/haines/yard-relative_markdown_links/pull/41))
19
+
20
+ ## [0.3.0] - 2020-07-26
21
+ ### Added
22
+ - Support for relative links to all extra files, not just markdown ([#9](https://github.com/haines/yard-relative_markdown_links/pull/9))
23
+
24
+ ## [0.2.0] - 2020-03-06
25
+ ### Changed
26
+ - Stop testing against old Rubies and upgrade dependencies ([#6](https://github.com/haines/yard-relative_markdown_links/pull/6))
27
+
28
+ ## [0.1.2] - 2018-06-11
29
+ ### Changed
30
+ - Fix documentation ([#3](https://github.com/haines/yard-relative_markdown_links/pull/3))
31
+
32
+ ## [0.1.1] - 2018-06-11
33
+ ### Changed
34
+ - Fix error on plugin load ([#2](https://github.com/haines/yard-relative_markdown_links/pull/2))
35
+
36
+ ## [0.1.0] - 2018-06-11
37
+ ### Added
38
+ - A YARD plugin to allow relative links between Markdown files ([#1](https://github.com/haines/yard-relative_markdown_links/pull/1))
39
+
40
+ [Unreleased]: https://github.com/haines/yard-relative_markdown_links/compare/v0.4.1...HEAD
41
+ [0.4.1]: https://github.com/haines/yard-relative_markdown_links/compare/v0.4.0...v0.4.1
42
+ [0.4.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.3.0...v0.4.0
43
+ [0.3.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.2.0...v0.3.0
44
+ [0.2.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.2...v0.2.0
45
+ [0.1.2]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.1...v0.1.2
46
+ [0.1.1]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.0...v0.1.1
47
+ [0.1.0]: https://github.com/haines/yard-relative_markdown_links/compare/51b60cc1664a807cf32742a61b000a6a30da89fd...v0.1.0
data/Gemfile CHANGED
@@ -3,3 +3,12 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
+
7
+ gem "bundler"
8
+ gem "minitest"
9
+ gem "pry"
10
+ gem "rake"
11
+ gem "rubocop"
12
+ gem "rubocop-minitest"
13
+ gem "rubocop-rake"
14
+ gem "yard"
data/Gemfile.lock CHANGED
@@ -1,52 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yard-relative_markdown_links (0.1.2)
5
- nokogiri (~> 1.8.1)
4
+ yard-relative_markdown_links (0.4.1)
5
+ nokogiri (~> 1.8)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
11
- coderay (1.1.2)
12
- jaro_winkler (1.5.1)
13
- method_source (0.9.0)
14
- mini_portile2 (2.3.0)
15
- minitest (5.11.3)
16
- nokogiri (1.8.2)
17
- mini_portile2 (~> 2.3.0)
18
- parallel (1.12.1)
19
- parser (2.5.1.0)
20
- ast (~> 2.4.0)
21
- powerpack (0.1.2)
22
- pry (0.11.3)
23
- coderay (~> 1.1.0)
24
- method_source (~> 0.9.0)
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ method_source (1.0.0)
13
+ mini_portile2 (2.6.1)
14
+ minitest (5.14.4)
15
+ nokogiri (1.12.5)
16
+ mini_portile2 (~> 2.6.1)
17
+ racc (~> 1.4)
18
+ nokogiri (1.12.5-x86_64-darwin)
19
+ racc (~> 1.4)
20
+ nokogiri (1.12.5-x86_64-linux)
21
+ racc (~> 1.4)
22
+ parallel (1.21.0)
23
+ parser (3.0.2.0)
24
+ ast (~> 2.4.1)
25
+ pry (0.14.1)
26
+ coderay (~> 1.1)
27
+ method_source (~> 1.0)
28
+ racc (1.5.2)
25
29
  rainbow (3.0.0)
26
- rake (12.3.1)
27
- rubocop (0.57.1)
28
- jaro_winkler (~> 1.5.1)
30
+ rake (13.0.6)
31
+ regexp_parser (2.1.1)
32
+ rexml (3.2.5)
33
+ rubocop (1.23.0)
29
34
  parallel (~> 1.10)
30
- parser (>= 2.5)
31
- powerpack (~> 0.1)
35
+ parser (>= 3.0.0.0)
32
36
  rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml
39
+ rubocop-ast (>= 1.12.0, < 2.0)
33
40
  ruby-progressbar (~> 1.7)
34
- unicode-display_width (~> 1.0, >= 1.0.1)
35
- ruby-progressbar (1.9.0)
36
- unicode-display_width (1.4.0)
37
- yard (0.9.14)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.13.0)
43
+ parser (>= 3.0.1.1)
44
+ rubocop-minitest (0.16.0)
45
+ rubocop (>= 0.90, < 2.0)
46
+ rubocop-rake (0.6.0)
47
+ rubocop (~> 1.0)
48
+ ruby-progressbar (1.11.0)
49
+ unicode-display_width (2.1.0)
50
+ yard (0.9.26)
38
51
 
39
52
  PLATFORMS
40
53
  ruby
54
+ x86_64-darwin-20
55
+ x86_64-linux
41
56
 
42
57
  DEPENDENCIES
43
- bundler (~> 1.16)
44
- minitest (~> 5.11)
45
- pry (~> 0.11)
46
- rake (~> 12.1)
47
- rubocop (~> 0.57.1)
48
- yard (~> 0.9)
58
+ bundler
59
+ minitest
60
+ pry
61
+ rake
62
+ rubocop
63
+ rubocop-minitest
64
+ rubocop-rake
65
+ yard
49
66
  yard-relative_markdown_links!
50
67
 
51
68
  BUNDLED WITH
52
- 1.16.2
69
+ 2.2.31
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # YARD::RelativeMarkdownLinks
2
2
 
3
+ [![Docs](https://img.shields.io/badge/docs-github.io-blue.svg?style=flat-square)](https://haines.github.io/yard-relative_markdown_links/)
4
+ [![Gem](https://img.shields.io/gem/v/yard-relative_markdown_links.svg?style=flat-square)](https://rubygems.org/gems/yard-relative_markdown_links)
5
+ [![GitHub](https://img.shields.io/badge/github-haines%2Fyard--relative__markdown__links-blue.svg?style=flat-square)](https://github.com/haines/yard-relative_markdown_links)
6
+ [![License](https://img.shields.io/github/license/haines/yard-relative_markdown_links.svg?style=flat-square)](https://github.com/haines/yard-relative_markdown_links/blob/main/LICENSE.md)
7
+
8
+
3
9
  A [YARD](https://yardoc.org) plugin to allow relative links between Markdown files.
4
10
 
5
11
  GitHub and YARD render Markdown files differently.
6
- In particular, relative links between Markdown files that work in GitHub don't work in YARD.
12
+ In particular, relative links in Markdown files that work in GitHub don't work in YARD.
7
13
  For example, if you have `[hello](FOO.md)` in your README, YARD renders it as `<a href="FOO.md">hello</a>`, creating a broken link in your docs.
8
14
 
9
15
  With this plugin enabled, you'll get `<a href="file.FOO.html">hello</a>` instead, which correctly links through to the rendered HTML file.
@@ -46,6 +52,8 @@ To include all Markdown files in your project, add the following lines to the en
46
52
  **/*.md
47
53
  ```
48
54
 
55
+ If you include other types of file, relative links to those files from Markdown will work as well.
56
+
49
57
 
50
58
  ## Development
51
59
 
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ Gem.install "bundler", Gem::BundlerVersionFinder.bundler_version
@@ -3,6 +3,6 @@
3
3
  module YARD
4
4
  module RelativeMarkdownLinks
5
5
  # Current version of the yard-relative_markdown_links gem.
6
- VERSION = "0.1.2"
6
+ VERSION = "0.4.1"
7
7
  end
8
8
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "nokogiri"
4
+ require "uri"
4
5
  require "yard"
5
6
  require "yard/relative_markdown_links/version"
6
7
 
@@ -13,14 +14,16 @@ module YARD # rubocop:disable Style/Documentation
13
14
  # With this plugin enabled, you'll get `<a href="file.FOO.html">hello</a>`
14
15
  # instead, which correctly links through to the rendered HTML file.
15
16
  module RelativeMarkdownLinks
16
- # Resolves relative links to Markdown files.
17
+ # Resolves relative links from Markdown files.
17
18
  # @param [String] text the HTML fragment in which to resolve links.
18
- # @return [String] HTML with relative links to Markdown files converted to `{file:}` links.
19
+ # @return [String] HTML with relative links to extra files converted to `{file:}` links.
19
20
  def resolve_links(text)
20
21
  html = Nokogiri::HTML.fragment(text)
21
22
  html.css("a[href]").each do |link|
22
23
  href = URI(link["href"])
23
- next unless href.relative? && markup_for_file(nil, href.path) == :markdown
24
+
25
+ next unless href.relative? && options.files.map(&:filename).include?(href.path)
26
+
24
27
  link.replace "{file:#{href} #{link.inner_html}}"
25
28
  end
26
29
  super(html.to_s)
@@ -19,14 +19,15 @@ Gem::Specification.new do |spec|
19
19
  spec.files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0").reject { |path| path.match(%r{^test/}) } }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
23
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
24
+ spec.metadata["documentation_uri"] = "https://haines.github.io/yard-relative_markdown_links/"
25
+ spec.metadata["homepage_uri"] = spec.homepage
26
+ spec.metadata["rubygems_mfa_required"] = "true"
27
+ spec.metadata["source_code_uri"] = spec.homepage
22
28
  spec.metadata["yard.run"] = "yri"
23
29
 
24
- spec.add_dependency "nokogiri", "~> 1.8.1"
30
+ spec.required_ruby_version = ">= 2.5"
25
31
 
26
- spec.add_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "minitest", "~> 5.11"
28
- spec.add_development_dependency "pry", "~> 0.11"
29
- spec.add_development_dependency "rake", "~> 12.1"
30
- spec.add_development_dependency "rubocop", "~> 0.57.1"
31
- spec.add_development_dependency "yard", "~> 0.9"
32
+ spec.add_dependency "nokogiri", "~> 1.8"
32
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-relative_markdown_links
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Haines
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-11 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,110 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.1
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.8.1
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.16'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.16'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.11'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.11'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.11'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.11'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '12.1'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '12.1'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.57.1
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.57.1
97
- - !ruby/object:Gem::Dependency
98
- name: yard
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.9'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.9'
111
- description:
26
+ version: '1.8'
27
+ description:
112
28
  email:
113
29
  - andrew@haines.org.nz
114
30
  executables: []
115
31
  extensions: []
116
32
  extra_rdoc_files: []
117
33
  files:
34
+ - ".github/dependabot.yml"
35
+ - ".github/workflows/pull-request.yml"
118
36
  - ".gitignore"
119
37
  - ".rubocop.yml"
120
38
  - ".ruby-version"
121
- - ".travis.yml"
122
39
  - ".yardopts"
40
+ - CHANGELOG.md
123
41
  - CODE_OF_CONDUCT.md
124
42
  - Gemfile
125
43
  - Gemfile.lock
@@ -128,6 +46,7 @@ files:
128
46
  - Rakefile
129
47
  - bin/bundle
130
48
  - bin/console
49
+ - bin/install-bundler
131
50
  - bin/rake
132
51
  - bin/setup
133
52
  - lib/yard-relative_markdown_links.rb
@@ -138,8 +57,14 @@ homepage: https://github.com/haines/yard-relative_markdown_links
138
57
  licenses:
139
58
  - MIT
140
59
  metadata:
60
+ bug_tracker_uri: https://github.com/haines/yard-relative_markdown_links/issues
61
+ changelog_uri: https://github.com/haines/yard-relative_markdown_links/blob/main/CHANGELOG.md
62
+ documentation_uri: https://haines.github.io/yard-relative_markdown_links/
63
+ homepage_uri: https://github.com/haines/yard-relative_markdown_links
64
+ rubygems_mfa_required: 'true'
65
+ source_code_uri: https://github.com/haines/yard-relative_markdown_links
141
66
  yard.run: yri
142
- post_install_message:
67
+ post_install_message:
143
68
  rdoc_options: []
144
69
  require_paths:
145
70
  - lib
@@ -147,16 +72,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
72
  requirements:
148
73
  - - ">="
149
74
  - !ruby/object:Gem::Version
150
- version: '0'
75
+ version: '2.5'
151
76
  required_rubygems_version: !ruby/object:Gem::Requirement
152
77
  requirements:
153
78
  - - ">="
154
79
  - !ruby/object:Gem::Version
155
80
  version: '0'
156
81
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.7.7
159
- signing_key:
82
+ rubygems_version: 3.2.31
83
+ signing_key:
160
84
  specification_version: 4
161
85
  summary: A YARD plugin to allow relative links between Markdown files
162
86
  test_files: []
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3
5
- - 2.4
6
- - 2.5