rdoc-markdown 0.19.1 → 0.20.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7fe864809969e8bc21a90e174270ac16a0d346dc7e909b2bc621af2518bbc971
|
|
4
|
+
data.tar.gz: 8aa123afbc0ba9e29fe03e3d922636cae237183bfa0af99ac25feed38fe7eb12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 452aa91cfc511f89e840b11b76dcaa8b6cb295acf8e20a59296f9298991d0c46a03274bc09e2e53ad56901803dd03cb36786480f574b222e547267cc1df0d9ad
|
|
7
|
+
data.tar.gz: ecabd0ada5aae3f3e0055f6cee4e8a41cf10497d13f116a05dae7863c1f6d15d3f6b4166602d947c96a7a9e624e2bcb637056feae2b083c8596c9c5675a43e4d
|
data/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,7 @@ class RDoc::Generator::Markdown::Conversion
|
|
|
14
14
|
document = fragment.document
|
|
15
15
|
fragment.css("a").each { |link| normalize_link(link, document) }
|
|
16
16
|
markdown = ReverseMarkdown.convert(fragment, github_flavored: true).dup
|
|
17
|
-
|
|
17
|
+
markdown.gsub!(Regexp.union(anchor_aliases.keys), anchor_aliases)
|
|
18
18
|
normalize_definition_list_code_blocks(markdown).rstrip.gsub(/^(#+)(\s)/) do
|
|
19
19
|
"#{"#" * [Regexp.last_match(1).length + heading_level_offset, 6].min}#{Regexp.last_match(2)}"
|
|
20
20
|
end
|
|
@@ -101,13 +101,13 @@ class RDoc::Generator::Markdown::Conversion
|
|
|
101
101
|
#
|
|
102
102
|
# @param anchors [Nokogiri::XML::NodeSet] Legacy anchor spans.
|
|
103
103
|
#
|
|
104
|
-
# @return [
|
|
104
|
+
# @return [Hash{String => String}] Token-to-anchor HTML lookup.
|
|
105
105
|
def tokenize_legacy_anchors(anchors)
|
|
106
|
-
anchors.
|
|
106
|
+
anchors.each.with_index.to_h do |span, index|
|
|
107
107
|
token = "RDocMarkdownAnchor#{index}End"
|
|
108
|
-
|
|
108
|
+
anchor = %(<a id="#{span["id"]}"></a>)
|
|
109
109
|
span.replace(token)
|
|
110
|
-
[token,
|
|
110
|
+
[token, anchor]
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
@@ -83,11 +83,16 @@ module RDoc::Generator::Markdown::Paths
|
|
|
83
83
|
#
|
|
84
84
|
# @return [String, nil] Resolved output path, or nil when unresolved.
|
|
85
85
|
def self.resolve_output_path_from(path, current_dir, state)
|
|
86
|
+
return if path.empty? || path.match?(%r{\A(?:[a-z][a-z0-9+.-]*:|//)}i)
|
|
87
|
+
|
|
86
88
|
candidates = [path, path.delete_prefix("#{state.root_path_segment}/")]
|
|
87
89
|
candidates += candidates.map { |candidate| candidate.sub(/_(md|markdown)\.md\z/i, '.\1') }
|
|
88
|
-
|
|
90
|
+
candidates.uniq!
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
candidates.find { |candidate| state.known_output_paths.include?(candidate) } ||
|
|
93
|
+
candidates.lazy
|
|
94
|
+
.map { |candidate| current_dir.join(candidate).cleanpath.to_s }
|
|
95
|
+
.find { |candidate| state.known_output_paths.include?(candidate) }
|
|
91
96
|
end
|
|
92
97
|
|
|
93
98
|
# Normalizes an input filename into an output-relative source path.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "erb"
|
|
4
|
+
# standard:disable Lint/RedundantRequireStatement
|
|
5
|
+
require "set"
|
|
6
|
+
# standard:enable Lint/RedundantRequireStatement
|
|
4
7
|
require "reverse_markdown"
|
|
5
8
|
require "csv"
|
|
6
9
|
require "fileutils"
|
|
@@ -173,8 +176,8 @@ class RDoc::Generator::Markdown
|
|
|
173
176
|
classes: classes,
|
|
174
177
|
pages: pages,
|
|
175
178
|
class_output_paths: class_output_paths,
|
|
176
|
-
markdown_output_object_ids: (classes + pages).
|
|
177
|
-
known_output_paths: class_output_paths.values
|
|
179
|
+
markdown_output_object_ids: (classes + pages).to_set(&:object_id),
|
|
180
|
+
known_output_paths: class_output_paths.values.to_set.merge(pages.map { |page| page_output_path(page) }),
|
|
178
181
|
root_path_segment: Pathname.new(options.root || ".").basename
|
|
179
182
|
)
|
|
180
183
|
end
|