yard-relative_markdown_links 0.2.0 → 0.3.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: f08a3042106a441008993198b7023f440110ab8717ada00cf0047687abad61b4
4
- data.tar.gz: bee1ae647802e524aa6b3e9eef92acaa43bed7e84fe785f81e769ad7d0f75466
3
+ metadata.gz: a1ba604ffff07a62d9a4d07e6e56ad6865d8752a727032e13e46cb08404599cd
4
+ data.tar.gz: 656f0f6c43e6d766f1c7bb6b3df110efae719b8e74e9e9877b1f0908e698db5a
5
5
  SHA512:
6
- metadata.gz: bf2b2c96447c81369390515b4b9e666034031bfc796c15fee923653e53acf6c36fa574ceed6ae93d2655bcebc5c6b14fad0cc628741c29531a43f1a4be844d47
7
- data.tar.gz: 466b92f58a7b7dc2878692fee6ce9e08e6d881f045832d8d59a95588630c652e6b39f55de92a052f2681ab45a6a9ed00bc3b32dc062de4961b8c38c0c3355052
6
+ metadata.gz: 459e633a68b4a588370cbe7b18ff64742d99f4d73a59afa5e708f62cf5bd466b25192b1e23f8592e514a7045a27b3f28e5377e119f540a168cba0774a3f11198
7
+ data.tar.gz: e8c0f800b34e8704f6ffe385a047108eb33d6a7da993e4b7be6e70aebdee5161285f0022d936cadeafc46a03683aeb56cd511295d05102fdd6d87c8a77abda18
@@ -0,0 +1,61 @@
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
+
15
+ name: Ruby ${{ matrix.ruby }}
16
+
17
+ runs-on: ubuntu-latest
18
+
19
+ container:
20
+ image: ruby:${{ matrix.ruby }}-alpine
21
+
22
+ env:
23
+ BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
24
+
25
+ steps:
26
+ - name: Install dependencies
27
+ run: apk add build-base git
28
+
29
+ - name: Check out source code
30
+ uses: actions/checkout@v2
31
+
32
+ - name: Install Bundler
33
+ run: bin/install-bundler
34
+
35
+ - name: Compute cache key
36
+ id: cache-key
37
+ run: |
38
+ source /etc/os-release
39
+ printf \
40
+ "::set-output name=cache-key::alpine-%s-ruby-%s\n" \
41
+ "${VERSION_ID}" \
42
+ "${RUBY_VERSION}"
43
+
44
+ - name: Cache gems
45
+ uses: actions/cache@v1
46
+ with:
47
+ key: ${{ steps.cache-key.outputs.cache-key }}-gems-${{ hashFiles('Gemfile.lock') }}
48
+ path: vendor/bundle
49
+
50
+ - name: Install gems
51
+ run: bin/bundle install
52
+ env:
53
+ BUNDLE_FROZEN: true
54
+ BUNDLE_JOBS: 4
55
+ BUNDLE_RETRY: 3
56
+
57
+ - name: Run RuboCop
58
+ run: bin/rake rubocop
59
+
60
+ - name: Run tests
61
+ run: bin/rake test
@@ -1,11 +1,12 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.5
3
4
  Exclude:
4
5
  - bin/bundle
5
6
  - bin/rake
6
7
  - vendor/bundle/**/*
7
8
 
8
- Metrics/LineLength:
9
+ Layout/LineLength:
9
10
  Enabled: false
10
11
 
11
12
  Metrics/MethodLength:
@@ -1 +1 @@
1
- 2.7.0
1
+ 2.7.1
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2020-07-26
11
+ ### Added
12
+ - Support for relative links to all extra files, not just markdown ([#9](https://github.com/haines/yard-relative_markdown_links/pull/9))
13
+
10
14
  ## [0.2.0] - 2020-03-06
11
15
  ### Changed
12
16
  - Stop testing against old Rubies and upgrade dependencies ([#6](https://github.com/haines/yard-relative_markdown_links/pull/6))
@@ -23,7 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
27
  ### Added
24
28
  - A YARD plugin to allow relative links between Markdown files ([#1](https://github.com/haines/yard-relative_markdown_links/pull/1))
25
29
 
26
- [Unreleased]: https://github.com/haines/yard-relative_markdown_links/compare/v0.2.0...HEAD
30
+ [Unreleased]: https://github.com/haines/yard-relative_markdown_links/compare/v0.3.0...HEAD
31
+ [0.3.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.2.0...v0.3.0
27
32
  [0.2.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.2...v0.2.0
28
33
  [0.1.2]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.1...v0.1.2
29
34
  [0.1.1]: https://github.com/haines/yard-relative_markdown_links/compare/v0.1.0...v0.1.1
data/Gemfile CHANGED
@@ -3,3 +3,10 @@
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 "yard"
@@ -1,51 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yard-relative_markdown_links (0.2.0)
4
+ yard-relative_markdown_links (0.3.0)
5
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.4)
13
- method_source (0.9.2)
10
+ ast (2.4.1)
11
+ coderay (1.1.3)
12
+ method_source (1.0.0)
14
13
  mini_portile2 (2.4.0)
15
- minitest (5.14.0)
16
- nokogiri (1.10.9)
14
+ minitest (5.14.1)
15
+ nokogiri (1.10.10)
17
16
  mini_portile2 (~> 2.4.0)
18
- parallel (1.19.1)
19
- parser (2.7.0.4)
20
- ast (~> 2.4.0)
21
- pry (0.12.2)
22
- coderay (~> 1.1.0)
23
- method_source (~> 0.9.0)
17
+ parallel (1.19.2)
18
+ parser (2.7.1.4)
19
+ ast (~> 2.4.1)
20
+ pry (0.13.1)
21
+ coderay (~> 1.1)
22
+ method_source (~> 1.0)
24
23
  rainbow (3.0.0)
25
- rake (12.3.3)
24
+ rake (13.0.1)
25
+ regexp_parser (1.7.1)
26
26
  rexml (3.2.4)
27
- rubocop (0.80.1)
28
- jaro_winkler (~> 1.5.1)
27
+ rubocop (0.88.0)
29
28
  parallel (~> 1.10)
30
- parser (>= 2.7.0.1)
29
+ parser (>= 2.7.1.1)
31
30
  rainbow (>= 2.2.2, < 4.0)
31
+ regexp_parser (>= 1.7)
32
32
  rexml
33
+ rubocop-ast (>= 0.1.0, < 1.0)
33
34
  ruby-progressbar (~> 1.7)
34
- unicode-display_width (>= 1.4.0, < 1.7)
35
+ unicode-display_width (>= 1.4.0, < 2.0)
36
+ rubocop-ast (0.2.0)
37
+ parser (>= 2.7.0.1)
35
38
  ruby-progressbar (1.10.1)
36
- unicode-display_width (1.6.1)
37
- yard (0.9.24)
39
+ unicode-display_width (1.7.0)
40
+ yard (0.9.25)
38
41
 
39
42
  PLATFORMS
40
43
  ruby
41
44
 
42
45
  DEPENDENCIES
43
- bundler (~> 2.1)
44
- minitest (~> 5.11)
45
- pry (~> 0.11)
46
- rake (~> 12.1)
47
- rubocop (~> 0.80.1)
48
- yard (~> 0.9)
46
+ bundler
47
+ minitest
48
+ pry
49
+ rake
50
+ rubocop
51
+ yard
49
52
  yard-relative_markdown_links!
50
53
 
51
54
  BUNDLED WITH
data/README.md CHANGED
@@ -3,14 +3,13 @@
3
3
  [![Docs](https://img.shields.io/badge/docs-github.io-blue.svg?style=flat-square)](https://haines.github.io/yard-relative_markdown_links/)
4
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
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/master/LICENSE.md)
7
- [![Travis](https://img.shields.io/travis/haines/yard-relative_markdown_links.svg?style=flat-square)](https://travis-ci.org/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)
8
7
 
9
8
 
10
9
  A [YARD](https://yardoc.org) plugin to allow relative links between Markdown files.
11
10
 
12
11
  GitHub and YARD render Markdown files differently.
13
- 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.
14
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.
15
14
 
16
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.
@@ -53,6 +52,8 @@ To include all Markdown files in your project, add the following lines to the en
53
52
  **/*.md
54
53
  ```
55
54
 
55
+ If you include other types of file, relative links to those files from Markdown will work as well.
56
+
56
57
 
57
58
  ## Development
58
59
 
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ Gem.install "bundler", Gem::BundlerVersionFinder.bundler_version
@@ -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,15 @@ 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)
24
26
 
25
27
  link.replace "{file:#{href} #{link.inner_html}}"
26
28
  end
@@ -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.2.0"
6
+ VERSION = "0.3.0"
7
7
  end
8
8
  end
@@ -20,18 +20,11 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
23
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
23
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
24
24
  spec.metadata["documentation_uri"] = "https://haines.github.io/yard-relative_markdown_links/"
25
25
  spec.metadata["homepage_uri"] = spec.homepage
26
26
  spec.metadata["source_code_uri"] = spec.homepage
27
27
  spec.metadata["yard.run"] = "yri"
28
28
 
29
29
  spec.add_dependency "nokogiri", "~> 1.8"
30
-
31
- spec.add_development_dependency "bundler", "~> 2.1"
32
- spec.add_development_dependency "minitest", "~> 5.11"
33
- spec.add_development_dependency "pry", "~> 0.11"
34
- spec.add_development_dependency "rake", "~> 12.1"
35
- spec.add_development_dependency "rubocop", "~> 0.80.1"
36
- spec.add_development_dependency "yard", "~> 0.9"
37
30
  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.2.0
4
+ version: 0.3.0
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: 2020-03-06 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -24,101 +24,17 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.1'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.1'
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.80.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.80.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:
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/workflows/pull-request.yml"
118
35
  - ".gitignore"
119
36
  - ".rubocop.yml"
120
37
  - ".ruby-version"
121
- - ".travis.yml"
122
38
  - ".yardopts"
123
39
  - CHANGELOG.md
124
40
  - CODE_OF_CONDUCT.md
@@ -129,6 +45,7 @@ files:
129
45
  - Rakefile
130
46
  - bin/bundle
131
47
  - bin/console
48
+ - bin/install-bundler
132
49
  - bin/rake
133
50
  - bin/setup
134
51
  - lib/yard-relative_markdown_links.rb
@@ -140,12 +57,12 @@ licenses:
140
57
  - MIT
141
58
  metadata:
142
59
  bug_tracker_uri: https://github.com/haines/yard-relative_markdown_links/issues
143
- changelog_uri: https://github.com/haines/yard-relative_markdown_links/blob/master/CHANGELOG.md
60
+ changelog_uri: https://github.com/haines/yard-relative_markdown_links/blob/main/CHANGELOG.md
144
61
  documentation_uri: https://haines.github.io/yard-relative_markdown_links/
145
62
  homepage_uri: https://github.com/haines/yard-relative_markdown_links
146
63
  source_code_uri: https://github.com/haines/yard-relative_markdown_links
147
64
  yard.run: yri
148
- post_install_message:
65
+ post_install_message:
149
66
  rdoc_options: []
150
67
  require_paths:
151
68
  - lib
@@ -161,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
78
  version: '0'
162
79
  requirements: []
163
80
  rubygems_version: 3.1.2
164
- signing_key:
81
+ signing_key:
165
82
  specification_version: 4
166
83
  summary: A YARD plugin to allow relative links between Markdown files
167
84
  test_files: []
@@ -1,6 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5
5
- - 2.6
6
- - 2.7