History

Update Rust documentation (1.71.0)

Fixes #1881.

Simon Legner committed 3 years ago

Commit 03dfcf51 parent a32e3d02 files · +9 −0Browse files

Unified · Split

2 files
  1. lib/docs/filters/rust/clean_html.rb +4 −0
  2. lib/docs/scrapers/rust.rb +5 −0
lib/docs/filters/rust/clean_html.rb+4−0
@@ -88,8 +88,12 @@ module Docs · 87 unmodified lines
88 end88 end
89 89
90 css('pre').each do |node|90 css('pre').each do |node|
91 node.css('.where.fmt-newline').each do |node|
92 node.before("\n")
93 end
91 node.content = node.content94 node.content = node.content
92 node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust')95 node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust')
96 node['data-language'] = 'rust' if node.classes.include?('code-header')
93 end97 end
94 98
95 doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'99 doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'
lib/docs/scrapers/rust.rb+5−0
@@ -53,5 +53,10 @@ module Docs · 52 unmodified lines
53 def process_response?(response)53 def process_response?(response)
54 !(response.body =~ REDIRECT_RGX || response.body =~ NOT_FOUND_RGX || response.body.blank?)54 !(response.body =~ REDIRECT_RGX || response.body =~ NOT_FOUND_RGX || response.body.blank?)
55 end55 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
56 end61 end
57end62end