Skip to content

Commit 03dfcf5

Browse files
committed
Update Rust documentation (1.71.0)
Fixes #1881.
1 parent a32e3d0 commit 03dfcf5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/docs/filters/rust/clean_html.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ def call
8888
end
8989

9090
css('pre').each do |node|
91+
node.css('.where.fmt-newline').each do |node|
92+
node.before("\n")
93+
end
9194
node.content = node.content
9295
node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust')
96+
node['data-language'] = 'rust' if node.classes.include?('code-header')
9397
end
9498

9599
doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'

lib/docs/scrapers/rust.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@ def get_latest_version(opts)
5353
def process_response?(response)
5454
!(response.body =~ REDIRECT_RGX || response.body =~ NOT_FOUND_RGX || response.body.blank?)
5555
end
56+
57+
def parse(response) # Hook here because Nokogori removes whitespace from headings
58+
response.body.gsub! %r{<h[1-6] class="code-header">}, '<pre class="code-header">'
59+
super
60+
end
5661
end
5762
end

0 commit comments

Comments
 (0)