yard-markdown 0.7.1 → 0.7.2
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 +8 -0
- data/README.md +0 -8
- data/lib/yard/markdown/aref_helper.rb +11 -1
- data/lib/yard/markdown/collection_rendering_helper.rb +19 -53
- data/lib/yard/markdown/method_presentation_helper.rb +3 -7
- data/lib/yard/markdown/section_assembly_helper.rb +5 -16
- data/lib/yard/markdown/tag_formatting_helper.rb +4 -28
- data/lib/yard-markdown.rb +0 -1
- data/templates/default/fulldoc/markdown/setup.rb +11 -39
- data/templates/default/module/markdown/setup.rb +11 -27
- metadata +2 -22
- data/.editorconfig +0 -13
- data/.standard.yml +0 -3
- data/.streerc +0 -2
- data/.yard-lint.yml +0 -317
- data/.yardopts +0 -1
- data/AGENTS.md +0 -54
- data/Rakefile +0 -195
- data/config/mutant.yml +0 -15
- data/example/rdoc/Bird.md +0 -25
- data/example/rdoc/Duck.md +0 -59
- data/example/rdoc/Waterfowl.md +0 -7
- data/example/rdoc/index.csv +0 -16
- data/example/yard/Aquatic.md +0 -8
- data/example/yard/Fish.md +0 -25
- data/example/yard/Salmon.md +0 -58
- data/example/yard/index.csv +0 -16
- data/example_rdoc.rb +0 -146
- data/example_yard.rb +0 -145
- data/lib/yard/markdown/anchor_component_helper.rb +0 -20
- data/sig/yard/markdown.rbs +0 -348
data/example/yard/Fish.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Class Fish <a id="class-Fish"></a>
|
|
2
|
-
|
|
3
|
-
**Inherits:** `Object`
|
|
4
|
-
|
|
5
|
-
The base class for all fish.
|
|
6
|
-
|
|
7
|
-
## Public Instance Methods
|
|
8
|
-
### `make_sound()` <a id="method-i-make_sound"></a> <a id="make_sound-instance_method"></a>
|
|
9
|
-
Make a sound.
|
|
10
|
-
- **@return** [void]
|
|
11
|
-
- **@yield** [sound] The sound produced by the fish
|
|
12
|
-
- **@yieldparam** `sound` [String] The actual sound
|
|
13
|
-
|
|
14
|
-
### `swim(direction, speed)` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
|
|
15
|
-
Swim in a specific direction.
|
|
16
|
-
|
|
17
|
-
Swimming is the most critical feature of fish.
|
|
18
|
-
- **@param** `direction` [Symbol, String] The direction to swim
|
|
19
|
-
- **@param** `speed` [Integer] The speed at which to swim
|
|
20
|
-
- **@return** [Boolean] Whether the swim was successful
|
|
21
|
-
|
|
22
|
-
**@example**
|
|
23
|
-
```ruby
|
|
24
|
-
swim(:north, 30)
|
|
25
|
-
```
|
data/example/yard/Salmon.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Class Salmon <a id="class-Salmon"></a>
|
|
2
|
-
|
|
3
|
-
**Inherits:** `Fish`
|
|
4
|
-
**Includes:** `Aquatic`
|
|
5
|
-
|
|
6
|
-
A salmon is an Aquatic Fish.
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
* **Fish**
|
|
11
|
-
* make_sound
|
|
12
|
-
* swim
|
|
13
|
-
* **Aquatic**
|
|
14
|
-
* swim (overridden)
|
|
15
|
-
|
|
16
|
-
## Constants
|
|
17
|
-
### Salmon specific attributes
|
|
18
|
-
#### `MAX_SPEED` <a id="constant-MAX_SPEED"></a> <a id="MAX_SPEED-constant"></a>
|
|
19
|
-
- **@return** [Integer] Maximum speed for a swimming salmon
|
|
20
|
-
### General
|
|
21
|
-
#### `@@wild_salmon` <a id="classvariable--40-40wild_salmon"></a> <a id="@@wild_salmon-classvariable"></a>
|
|
22
|
-
Global list of all wild salmon.
|
|
23
|
-
|
|
24
|
-
Use for conservation efforts.
|
|
25
|
-
|
|
26
|
-
## Attributes
|
|
27
|
-
### Salmon specific attributes
|
|
28
|
-
#### `farmed` [RW] <a id="attribute-i-farmed"></a> <a id="farmed-instance_method"></a>
|
|
29
|
-
- **@return** [Boolean] True for farmed salmon
|
|
30
|
-
|
|
31
|
-
#### `wild` [R] <a id="attribute-i-wild"></a> <a id="wild-instance_method"></a>
|
|
32
|
-
- **@return** [Boolean] True for wild salmon
|
|
33
|
-
|
|
34
|
-
## Public Class Methods
|
|
35
|
-
### `wild_salmon()` <a id="method-c-wild_salmon"></a> <a id="wild_salmon-class_method"></a>
|
|
36
|
-
- **@return** [Array<Salmon>] List of all wild salmon
|
|
37
|
-
|
|
38
|
-
## Public Instance Methods
|
|
39
|
-
### Fish overrides
|
|
40
|
-
#### `make_sound()` <a id="method-i-make_sound"></a> <a id="make_sound-instance_method"></a>
|
|
41
|
-
Salmon overrides generic implementation.
|
|
42
|
-
- **@return** [void]
|
|
43
|
-
- **@yield** [sound] The sound produced by the salmon
|
|
44
|
-
- **@yieldparam** `sound` [String] The actual sound
|
|
45
|
-
### General
|
|
46
|
-
#### `initialize(farmed, wild)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
|
|
47
|
-
Creates a new salmon.
|
|
48
|
-
- **@param** `farmed` [Boolean] Whether the salmon is farmed
|
|
49
|
-
- **@param** `wild` [Boolean] Whether the salmon is wild
|
|
50
|
-
- **@return** [Salmon] a new instance of Salmon
|
|
51
|
-
|
|
52
|
-
#### `sustainable?()` <a id="method-i-sustainable-3F"></a> <a id="sustainable?-instance_method"></a>
|
|
53
|
-
Checks if this salmon is sustainable.
|
|
54
|
-
- **@return** [Boolean] Whether the salmon is sustainable
|
|
55
|
-
|
|
56
|
-
#### `swim()` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
|
|
57
|
-
Swim in the water.
|
|
58
|
-
- **@return** [void]
|
data/example/yard/index.csv
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name,type,path
|
|
2
|
-
Aquatic,Module,Aquatic.md
|
|
3
|
-
Aquatic.swim,Method,Aquatic.md#method-i-swim
|
|
4
|
-
Fish,Class,Fish.md
|
|
5
|
-
Fish.make_sound,Method,Fish.md#method-i-make_sound
|
|
6
|
-
Fish.swim,Method,Fish.md#method-i-swim
|
|
7
|
-
Salmon,Class,Salmon.md
|
|
8
|
-
Salmon.MAX_SPEED,Constant,Salmon.md#constant-MAX_SPEED
|
|
9
|
-
Salmon.@@wild_salmon,Constant,Salmon.md#classvariable--40-40wild_salmon
|
|
10
|
-
Salmon.initialize,Method,Salmon.md#method-i-initialize
|
|
11
|
-
Salmon.make_sound,Method,Salmon.md#method-i-make_sound
|
|
12
|
-
Salmon.sustainable?,Method,Salmon.md#method-i-sustainable-3F
|
|
13
|
-
Salmon.swim,Method,Salmon.md#method-i-swim
|
|
14
|
-
Salmon.wild_salmon,Method,Salmon.md#method-c-wild_salmon
|
|
15
|
-
Salmon.farmed,Attribute,Salmon.md#attribute-i-farmed
|
|
16
|
-
Salmon.wild,Attribute,Salmon.md#attribute-i-wild
|
data/example_rdoc.rb
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# === RDoc::Generator::Markdown example.
|
|
3
|
-
#
|
|
4
|
-
# This example employs various RDoc features to demonstrate
|
|
5
|
-
# generator output.
|
|
6
|
-
#
|
|
7
|
-
# ---
|
|
8
|
-
#
|
|
9
|
-
# Links:
|
|
10
|
-
#
|
|
11
|
-
# 1. {Project Home Page}[https://github.com/skatkov/rdoc-markdown)
|
|
12
|
-
# 2. {RDoc Documentation}[http://ruby-doc.org/stdlib-2.0.0/libdoc/rdoc/rdoc/RDoc/Markup.html]
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
# A mixin for waterfowl creatures.
|
|
17
|
-
module Waterfowl
|
|
18
|
-
# Swimming helper.
|
|
19
|
-
def swim
|
|
20
|
-
puts "swimming around"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
# The base class for all birds.
|
|
26
|
-
class Bird
|
|
27
|
-
##
|
|
28
|
-
# Produce some noise.
|
|
29
|
-
#--
|
|
30
|
-
# FIXME: maybe extract this to a base class +Animal+?
|
|
31
|
-
#++
|
|
32
|
-
def speak # :yields: text
|
|
33
|
-
puts "generic tweeting"
|
|
34
|
-
yield "tweet"
|
|
35
|
-
yield "tweet"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Fly somewhere.
|
|
39
|
-
#
|
|
40
|
-
# Flying is the most critical feature of birds.
|
|
41
|
-
#
|
|
42
|
-
# :args: direction, velocity
|
|
43
|
-
#
|
|
44
|
-
# :call-seq:
|
|
45
|
-
# Bird.fly(symbol, number) -> bool
|
|
46
|
-
# Bird.fly(string, number) -> bool
|
|
47
|
-
#
|
|
48
|
-
# = Example
|
|
49
|
-
#
|
|
50
|
-
# fly(:south, 70)
|
|
51
|
-
def fly(direction, velocity)
|
|
52
|
-
_fly_impl(direction, velocity)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def _fly_impl(_direction, _velocity) # :nodoc:
|
|
56
|
-
puts "flying away: direction=#{direction}, velocity=#{velocity}"
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
##
|
|
61
|
-
# A duck is a Waterfowl Bird.
|
|
62
|
-
#
|
|
63
|
-
# Features:
|
|
64
|
-
#
|
|
65
|
-
# bird::
|
|
66
|
-
#
|
|
67
|
-
# * speak
|
|
68
|
-
# * fly
|
|
69
|
-
#
|
|
70
|
-
# waterfowl::
|
|
71
|
-
#
|
|
72
|
-
# * swim
|
|
73
|
-
class Duck
|
|
74
|
-
extend Animal
|
|
75
|
-
include Waterfowl
|
|
76
|
-
|
|
77
|
-
# :section: Bird overrides
|
|
78
|
-
|
|
79
|
-
# Duck overrides generic implementation.
|
|
80
|
-
def speak
|
|
81
|
-
speech = quack
|
|
82
|
-
yield speech
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# Implements quacking
|
|
86
|
-
def quack
|
|
87
|
-
"quack"
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
private :quack
|
|
91
|
-
|
|
92
|
-
# :section: Duck extensions
|
|
93
|
-
|
|
94
|
-
# True for domestic ducks.
|
|
95
|
-
attr_accessor :domestic
|
|
96
|
-
|
|
97
|
-
# True for rubber ducks.
|
|
98
|
-
attr_reader :rubber
|
|
99
|
-
|
|
100
|
-
MAX_VELOCITY = 130 # Maximum velocity for a flying duck.
|
|
101
|
-
|
|
102
|
-
##
|
|
103
|
-
# Global list of all rubber ducks.
|
|
104
|
-
#
|
|
105
|
-
# Use when in trouble.
|
|
106
|
-
@@rubber_ducks = []
|
|
107
|
-
|
|
108
|
-
# @return [Array<Duck>] list of all rubber ducks
|
|
109
|
-
def self.rubber_ducks
|
|
110
|
-
@@rubber_ducks
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# Creates a new duck.
|
|
114
|
-
#
|
|
115
|
-
# @param [Boolean] domestic
|
|
116
|
-
# @param [Boolean] rubber
|
|
117
|
-
def initialize(domestic, rubber)
|
|
118
|
-
@domestic = domestic
|
|
119
|
-
@rubber = rubber
|
|
120
|
-
@@rubber_ducks << self if rubber
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
# Checks if this duck is a useful one.
|
|
124
|
-
#
|
|
125
|
-
# :call-seq:
|
|
126
|
-
# Bird.useful? -> bool
|
|
127
|
-
def useful?
|
|
128
|
-
@domestic || @rubber
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# Default velocity for a flying duck.
|
|
133
|
-
DEFAULT_DUCK_VELOCITY = 70
|
|
134
|
-
DEFAULT_SPEED = 10 # Maximum speed for a swimming duck.
|
|
135
|
-
|
|
136
|
-
# Default rubber duck.
|
|
137
|
-
#
|
|
138
|
-
# *Note:*
|
|
139
|
-
# Global variables are evil, but rubber ducks are worth it.
|
|
140
|
-
$default_rubber_duck = Duck.new(false, true)
|
|
141
|
-
|
|
142
|
-
# Domestic rubber duck.
|
|
143
|
-
#
|
|
144
|
-
# *Note:*
|
|
145
|
-
# This is weird... Thus not making it global.
|
|
146
|
-
domestic_rubber_duck = Duck.new(true, true) # rubocop:disable Lint/UselessAssignment
|
data/example_yard.rb
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# A mixin for aquatic creatures.
|
|
2
|
-
#
|
|
3
|
-
module Aquatic
|
|
4
|
-
# Swim in the water.
|
|
5
|
-
#
|
|
6
|
-
# @return [void]
|
|
7
|
-
def swim
|
|
8
|
-
puts "swimming in the water"
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# The base class for all fish.
|
|
13
|
-
class Fish
|
|
14
|
-
# Make a sound.
|
|
15
|
-
#
|
|
16
|
-
# @yield [sound] The sound produced by the fish
|
|
17
|
-
# @yieldparam sound [String] The actual sound
|
|
18
|
-
# @return [void]
|
|
19
|
-
def make_sound
|
|
20
|
-
puts "generic bubbling"
|
|
21
|
-
yield "blub"
|
|
22
|
-
yield "blub"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Swim in a specific direction.
|
|
26
|
-
#
|
|
27
|
-
# Swimming is the most critical feature of fish.
|
|
28
|
-
#
|
|
29
|
-
# @param direction [Symbol, String] The direction to swim
|
|
30
|
-
# @param speed [Integer] The speed at which to swim
|
|
31
|
-
# @return [Boolean] Whether the swim was successful
|
|
32
|
-
#
|
|
33
|
-
# @example
|
|
34
|
-
# swim(:north, 30)
|
|
35
|
-
def swim(direction, speed)
|
|
36
|
-
_swim_impl(direction, speed)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
private
|
|
40
|
-
|
|
41
|
-
# @!visibility private
|
|
42
|
-
def _swim_impl(direction, speed)
|
|
43
|
-
puts "swimming away: direction=#{direction}, speed=#{speed}"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# A salmon is an Aquatic Fish.
|
|
48
|
-
#
|
|
49
|
-
# ## Features
|
|
50
|
-
#
|
|
51
|
-
# - **Fish**
|
|
52
|
-
# - make_sound
|
|
53
|
-
# - swim
|
|
54
|
-
# - **Aquatic**
|
|
55
|
-
# - swim (overridden)
|
|
56
|
-
class Salmon < Fish
|
|
57
|
-
include Aquatic
|
|
58
|
-
|
|
59
|
-
# @!group Fish overrides
|
|
60
|
-
|
|
61
|
-
# Salmon overrides generic implementation.
|
|
62
|
-
#
|
|
63
|
-
# @yield [sound] The sound produced by the salmon
|
|
64
|
-
# @yieldparam sound [String] The actual sound
|
|
65
|
-
# @return [void]
|
|
66
|
-
def make_sound
|
|
67
|
-
sound = splash
|
|
68
|
-
yield sound
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# Implements splashing
|
|
72
|
-
#
|
|
73
|
-
# @return [String] The splash sound
|
|
74
|
-
def splash
|
|
75
|
-
"splash"
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
private :splash
|
|
79
|
-
|
|
80
|
-
# @!endgroup
|
|
81
|
-
|
|
82
|
-
# @!group Salmon specific attributes
|
|
83
|
-
|
|
84
|
-
# @return [Boolean] True for farmed salmon
|
|
85
|
-
attr_accessor :farmed
|
|
86
|
-
|
|
87
|
-
# @return [Boolean] True for wild salmon
|
|
88
|
-
attr_reader :wild
|
|
89
|
-
|
|
90
|
-
# @return [Integer] Maximum speed for a swimming salmon
|
|
91
|
-
MAX_SPEED = 40
|
|
92
|
-
|
|
93
|
-
# @!endgroup
|
|
94
|
-
|
|
95
|
-
# Global list of all wild salmon.
|
|
96
|
-
#
|
|
97
|
-
# Use for conservation efforts.
|
|
98
|
-
@@wild_salmon = []
|
|
99
|
-
|
|
100
|
-
# @return [Array<Salmon>] List of all wild salmon
|
|
101
|
-
def self.wild_salmon
|
|
102
|
-
@@wild_salmon
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# Creates a new salmon.
|
|
106
|
-
#
|
|
107
|
-
# @param farmed [Boolean] Whether the salmon is farmed
|
|
108
|
-
# @param wild [Boolean] Whether the salmon is wild
|
|
109
|
-
def initialize(farmed, wild)
|
|
110
|
-
@farmed = farmed
|
|
111
|
-
@wild = wild
|
|
112
|
-
@@wild_salmon << self if wild
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Checks if this salmon is sustainable.
|
|
116
|
-
#
|
|
117
|
-
# @return [Boolean] Whether the salmon is sustainable
|
|
118
|
-
def sustainable?
|
|
119
|
-
@wild || (@farmed && environmentally_friendly?)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
private
|
|
123
|
-
|
|
124
|
-
# @return [Boolean] Whether farming practices are environmentally friendly
|
|
125
|
-
def environmentally_friendly?
|
|
126
|
-
# Implementation details...
|
|
127
|
-
true
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Default speed for a swimming salmon
|
|
132
|
-
DEFAULT_SALMON_SPEED = 20
|
|
133
|
-
|
|
134
|
-
# Maximum depth for salmon habitat
|
|
135
|
-
MAX_DEPTH = 500
|
|
136
|
-
|
|
137
|
-
# Default wild salmon.
|
|
138
|
-
#
|
|
139
|
-
# @note Global variables should be used sparingly, but this is for demonstration.
|
|
140
|
-
$default_wild_salmon = Salmon.new(false, true)
|
|
141
|
-
|
|
142
|
-
# Farmed sustainable salmon.
|
|
143
|
-
#
|
|
144
|
-
# @note This is just a local variable for demonstration purposes.
|
|
145
|
-
Salmon.new(true, false)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Namespace for YARD extensions used by this gem.
|
|
4
|
-
module YARD
|
|
5
|
-
# Shared helpers for rendering YARD objects as Markdown.
|
|
6
|
-
module Markdown
|
|
7
|
-
# Builds anchor-safe identifier fragments from arbitrary values.
|
|
8
|
-
module AnchorComponentHelper
|
|
9
|
-
# Encodes a value so it can be embedded safely in an HTML anchor id.
|
|
10
|
-
#
|
|
11
|
-
# @param value [Object] Raw anchor fragment to encode.
|
|
12
|
-
# @return [String] Anchor-safe identifier fragment.
|
|
13
|
-
def anchor_component(value)
|
|
14
|
-
value.to_s.each_char.map do |char|
|
|
15
|
-
char.match?(/[A-Za-z0-9_-]/) ? char : format("-%X", char.ord)
|
|
16
|
-
end.join
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|