rdoc-markdown 0.17.0 → 0.17.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 +11 -0
- data/Gemfile.lock +2 -2
- data/lib/rdoc/generator/markdown.rb +15 -7
- data/lib/rdoc/markdown/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8caf2553ce9d28bdd362ab86ee4ee7b18981e3da7254dd0e752de2471e70c69
|
|
4
|
+
data.tar.gz: c67f5d859ffe70426fde7cd058486c0ced84e9c5066a1340574b8342b458d6e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 716297af9880007fc262c1c207603c5ad77d1cface68a5e08c22c9523b4e48e2d1952559fa1909ddd5d6d8f20f3e4169c9688a409125146d1eeccfbaeb19499c
|
|
7
|
+
data.tar.gz: 28949178739a1d0539c5a9d45ef260513b18f929f95db6b3a02feed82b45a24fb2f7bd2fb19cc90ea2688a923e9ff8fd7c8be53e25ac851e7b5168a61f654fb4
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
|
|
4
4
|
## Unreleased
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
## 0.17.2
|
|
8
|
+
|
|
9
|
+
- Remove spaces after headers
|
|
10
|
+
- Remove legacy anchor links
|
|
11
|
+
- Remove extra files that are not required (js, css and etc)
|
|
12
|
+
|
|
13
|
+
## 0.17.1
|
|
14
|
+
|
|
15
|
+
- Don't include files with .tt extension
|
|
16
|
+
|
|
6
17
|
## 0.17.0
|
|
7
18
|
|
|
8
19
|
- Remove fabricated external namespaces and preserve exact class and module identities across generated paths, index entries, metadata, and links.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rdoc-markdown (0.17.
|
|
4
|
+
rdoc-markdown (0.17.2)
|
|
5
5
|
csv
|
|
6
6
|
erb
|
|
7
7
|
rdoc (>= 8.0)
|
|
@@ -108,7 +108,7 @@ GEM
|
|
|
108
108
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
109
109
|
rainbow (3.1.1)
|
|
110
110
|
rake (13.4.2)
|
|
111
|
-
rbs (4.0
|
|
111
|
+
rbs (4.1.0)
|
|
112
112
|
logger
|
|
113
113
|
prism (>= 1.6.0)
|
|
114
114
|
tsort
|
|
@@ -224,7 +224,7 @@ class RDoc::Generator::Markdown
|
|
|
224
224
|
out_file = Pathname.new("#{output_dir}/#{page_output_path(page)}")
|
|
225
225
|
out_file.dirname.mkpath
|
|
226
226
|
|
|
227
|
-
next FileUtils.cp(File.expand_path(page.absolute_name, @source_dir), out_file) if page.relative_name.
|
|
227
|
+
next FileUtils.cp(File.expand_path(page.absolute_name, @source_dir), out_file) if page.relative_name.match?(/\.(?:md|markdown)\z/i)
|
|
228
228
|
|
|
229
229
|
content = markdownify(render_description(page))
|
|
230
230
|
File.write(out_file, finalize_markdown(
|
|
@@ -250,7 +250,7 @@ class RDoc::Generator::Markdown
|
|
|
250
250
|
# @return [String] Relative Markdown path.
|
|
251
251
|
def page_output_path(page)
|
|
252
252
|
source_path = normalize_input_path_for_output(page.relative_name)
|
|
253
|
-
return source_path if page.relative_name.match?(/\.(?:md|markdown)\z/)
|
|
253
|
+
return source_path if page.relative_name.match?(/\.(?:md|markdown)\z/i)
|
|
254
254
|
|
|
255
255
|
dirname = File.dirname(source_path)
|
|
256
256
|
basename = "#{File.basename(source_path).tr(".", "_")}.md"
|
|
@@ -306,6 +306,13 @@ class RDoc::Generator::Markdown
|
|
|
306
306
|
# - raise - Raise an error to let you know
|
|
307
307
|
|
|
308
308
|
fragment = Nokogiri::HTML.fragment(input)
|
|
309
|
+
fragment.css("span.legacy-anchor[id]").select do |span|
|
|
310
|
+
span.next_element&.name == "h1" && span["id"].match?(/\A(?:class|module)-/)
|
|
311
|
+
end.each(&:remove)
|
|
312
|
+
fragment.css("span.legacy-anchor[id]").each do |span|
|
|
313
|
+
heading = span.next_element
|
|
314
|
+
heading.add_child(span) if heading&.name&.match?(/\Ah[1-6]\z/)
|
|
315
|
+
end
|
|
309
316
|
|
|
310
317
|
fragment.css("pre").each do |pre|
|
|
311
318
|
language = pre["class"].to_s[/\A(?!highlight\z)[A-Za-z][A-Za-z0-9_+-]*\z/]
|
|
@@ -357,9 +364,7 @@ class RDoc::Generator::Markdown
|
|
|
357
364
|
unknown_tags: @markdown_unknown_tags
|
|
358
365
|
).dup
|
|
359
366
|
anchor_aliases.each do |token, id|
|
|
360
|
-
|
|
361
|
-
md.gsub!("#{token}\n\n#", "#{anchor}\n#")
|
|
362
|
-
md.gsub!(token, anchor)
|
|
367
|
+
md.gsub!(token, %(<a id="#{id}"></a>))
|
|
363
368
|
end
|
|
364
369
|
|
|
365
370
|
normalize_definition_list_code_blocks(md).rstrip
|
|
@@ -607,6 +612,7 @@ class RDoc::Generator::Markdown
|
|
|
607
612
|
output = content.lines.map(&:rstrip).join("\n")
|
|
608
613
|
output = normalize_internal_links(output, current_output_path: current_output_path)
|
|
609
614
|
output = output.sub(/\n{3,}/, "\n\n")
|
|
615
|
+
output = output.gsub(/^(#+ .+)\n\n/, "\\1\n")
|
|
610
616
|
"#{output}\n"
|
|
611
617
|
end
|
|
612
618
|
|
|
@@ -711,7 +717,7 @@ class RDoc::Generator::Markdown
|
|
|
711
717
|
# @return [String, nil] Resolved output path, or nil when unresolved.
|
|
712
718
|
def resolve_output_path(path, current_dir)
|
|
713
719
|
candidates = [path, path.delete_prefix("#{@root_path_segment}/")]
|
|
714
|
-
candidates += candidates.map { |candidate| candidate.sub(/_(md|markdown)\.md\z
|
|
720
|
+
candidates += candidates.map { |candidate| candidate.sub(/_(md|markdown)\.md\z/i, '.\1') }
|
|
715
721
|
|
|
716
722
|
candidates.each do |candidate|
|
|
717
723
|
return candidate if @known_output_paths.include?(candidate)
|
|
@@ -760,7 +766,9 @@ class RDoc::Generator::Markdown
|
|
|
760
766
|
klass.sections.any? { |section| section.title.to_s.match?(/\S/) || !section.to_document.empty? }
|
|
761
767
|
end.sort
|
|
762
768
|
@class_output_paths = @classes.to_h { |klass| [klass.full_name, output_path_for(klass)] }
|
|
763
|
-
@pages = @store.all_files.select(&:text?).select(&:display?)
|
|
769
|
+
@pages = @store.all_files.select(&:text?).select(&:display?)
|
|
770
|
+
.select { |page| page.relative_name.match?(/\.(?:md|markdown|rdoc)\z/i) }
|
|
771
|
+
.sort_by(&:base_name)
|
|
764
772
|
@markdown_output_object_ids = (@classes + @pages).map(&:object_id)
|
|
765
773
|
@known_output_paths = @class_output_paths.values
|
|
766
774
|
@pages.each { |page| @known_output_paths << page_output_path(page) }
|