yard-readme 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +12 -0
- data/lib/yard-readme.rb +11 -1
- data/lib/yard-readme/docstring_parser.rb +9 -3
- data/lib/yard-readme/tag_factory.rb +16 -0
- data/lib/yard-readme/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf25f4d0d965036850d04c859580025a2fce1361e6bd99d73d0d3a4912ab9e0
|
4
|
+
data.tar.gz: c17189420b7ffb6105cf5b1439ccd0b73677b900de1dab4efaf74f70e0b07d25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49d8edda2cb446af0a24ebe9ffa164db854f8965cca06d7b8f856cb5d4d834944de98f2fbaad8ea1659adcff4e1490044a6922b63aa4864513e015670624d20
|
7
|
+
data.tar.gz: e48995e33ecd0175352fec3d0cf8464bff98cab4c498f26cdb9822dc5d8cfee0519d5f8c4611bed1d33a52a6f8f550c35e3893b76ea9eebee6e9acd820a50c4b
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
|
4
|
+
## [0.1.2] - 2021-08-07
|
5
|
+
|
6
|
+
- Inherit from existing default to minimize conflict between plugins 69463cb2f580a1f5bcb734564eb51b32bf833250
|
7
|
+
- Avoid raising error when readme tag text is blank 294c9400de41d297c71212939b410e4ce821bc15
|
8
|
+
- Remove special readme tag names (README_YARD args) from docs when parsing docstring 983e1485b89888d390dc4879e7019fd7785dedda
|
9
|
+
|
10
|
+
|
11
|
+
## [0.1.1] - 2021-07-31
|
12
|
+
|
13
|
+
- Use readme_yard to build README
|
14
|
+
|
3
15
|
## [0.1.0] - 2021-07-25
|
4
16
|
|
5
17
|
- Initial release
|
data/lib/yard-readme.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'yard'
|
4
4
|
require_relative 'yard-readme/version'
|
5
5
|
require_relative 'yard-readme/docstring_parser'
|
6
|
+
require_relative 'yard-readme/tag_factory'
|
6
7
|
|
7
8
|
#
|
8
9
|
# @readme
|
@@ -20,5 +21,14 @@ require_relative 'yard-readme/docstring_parser'
|
|
20
21
|
#
|
21
22
|
module YARDReadme; end
|
22
23
|
|
24
|
+
#
|
25
|
+
# @see https://www.rubydoc.info/gems/yard/0.9.13/YARD/DocstringParser
|
26
|
+
#
|
23
27
|
YARD::Docstring.default_parser = YARDReadme::DocstringParser
|
24
|
-
|
28
|
+
|
29
|
+
#
|
30
|
+
# @see https://www.rubydoc.info/gems/yard/file/docs/TagsArch.md
|
31
|
+
#
|
32
|
+
YARD::Tags::Library.default_factory = YARDReadme::TagFactory
|
33
|
+
|
34
|
+
YARD::Tags::Library.define_tag('README', :readme, :with_title_and_text)
|
@@ -9,7 +9,7 @@ module YARDReadme
|
|
9
9
|
#
|
10
10
|
# Doing so would make this custom parser obsolete.
|
11
11
|
#
|
12
|
-
class DocstringParser < YARD::
|
12
|
+
class DocstringParser < YARD::Docstring.default_parser
|
13
13
|
def parse_content(content)
|
14
14
|
content = content.split(/\r?\n/) if content.is_a?(String)
|
15
15
|
return '' if !content || content.empty?
|
@@ -37,7 +37,8 @@ module YARDReadme
|
|
37
37
|
docstring << parse_content(directive.expanded_text).chomp
|
38
38
|
end
|
39
39
|
else
|
40
|
-
|
40
|
+
readme_text = parse_readme_text(buf) if parse_readme_text?(tag_name, buf)
|
41
|
+
docstring << readme_text if readme_text
|
41
42
|
create_tag(tag_name, buf)
|
42
43
|
end
|
43
44
|
tag_name = nil
|
@@ -72,7 +73,12 @@ module YARDReadme
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def parse_readme_text(text)
|
75
|
-
text
|
76
|
+
readme_text = text.sub(/\A(source|docstring|object)/, "")
|
77
|
+
readme_text << "\n\n" if readme_text
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse_readme_text?(tag_name, buf)
|
81
|
+
tag_name == 'readme' && !buf.empty?
|
76
82
|
end
|
77
83
|
end
|
78
84
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module YARDReadme
|
2
|
+
class TagFactory < YARD::Tags::Library.default_factory.class
|
3
|
+
#
|
4
|
+
# @see https://github.com/lsegal/yard/blob/359006641260eef1fe6d28f5c43c7c98d40f257d/lib/yard/tags/default_factory.rb#L70
|
5
|
+
#
|
6
|
+
def parse_tag_with_title_and_text(tag_name, text)
|
7
|
+
return YARD::Tags::Tag.new(tag_name, text) if blank_readme_tag?(tag_name, text)
|
8
|
+
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def blank_readme_tag?(tag_name, text)
|
13
|
+
tag_name == "readme" && text.nil? || text.empty?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/yard-readme/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-readme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Ruzicka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07
|
11
|
+
date: 2021-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -45,6 +45,7 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- ".gitignore"
|
48
|
+
- ".rubocop.yml"
|
48
49
|
- ".yardopts"
|
49
50
|
- CHANGELOG.md
|
50
51
|
- Gemfile
|
@@ -55,6 +56,7 @@ files:
|
|
55
56
|
- bin/setup
|
56
57
|
- lib/yard-readme.rb
|
57
58
|
- lib/yard-readme/docstring_parser.rb
|
59
|
+
- lib/yard-readme/tag_factory.rb
|
58
60
|
- lib/yard-readme/version.rb
|
59
61
|
- yard-readme.gemspec
|
60
62
|
homepage: https://github.com/mattruzicka/yard-readme
|