Update MDN documentations

Closes #615.
pull/631/merge
Thibaut Courouble 8 years ago
parent a6855329e8
commit df2af95a54

@ -24,7 +24,7 @@
> h3 { @extend %block-label, %label-blue; } > h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; } > h4 { font-size: 1em; }
p > code { @extend %label; } p > code, li > code { @extend %label; }
> .note, > .note,
.notice, .notice,
@ -104,6 +104,4 @@
.cleared { clear: both; } // CSS/box-shadow .cleared { clear: both; } // CSS/box-shadow
code > strong { font-weight: normal; } code > strong { font-weight: normal; }
#compat-desktop, #compat-mobile { @extend ._table; }
} }

@ -225,8 +225,8 @@ module Docs
entries = [] entries = []
if slug == 'history' || slug == 'XMLHttpRequest' if slug == 'history' || slug == 'XMLHttpRequest'
css('dt a[title*="not yet been written"]').each do |node| css('dt a[href^="https://developer.mozilla.org"]').each do |node|
next if node.parent.at_css('.obsolete') next if node.parent.at_css('.obsolete') || node.content.include?('moz')
name = node.content.sub('History', 'history') name = node.content.sub('History', 'history')
id = node.parent['id'] = name.parameterize id = node.parent['id'] = name.parameterize
entries << [name, id] entries << [name, id]

@ -8,7 +8,7 @@ module Docs
'Clipboard' => 'Clipboard', 'Clipboard' => 'Clipboard',
'CSS' => 'CSS', 'CSS' => 'CSS',
'Drag' => 'Drag & Drop', 'Drag' => 'Drag & Drop',
'Focus' => 'Focus', 'Fetch' => 'Fetch',
'Fullscreen' => 'Fullscreen', 'Fullscreen' => 'Fullscreen',
'Gamepad' => 'Gamepad', 'Gamepad' => 'Gamepad',
'HashChange' => 'History', 'HashChange' => 'History',
@ -43,7 +43,8 @@ module Docs
'WebRTC' => 'WebRTC', 'WebRTC' => 'WebRTC',
'WebVR' => 'WebVR', 'WebVR' => 'WebVR',
'Wheel' => 'Mouse', 'Wheel' => 'Mouse',
'Worker' => 'Web Workers' } 'Worker' => 'Web Workers',
'Focus' => 'Focus' }
FORM_SLUGS = %w(change compositionend compositionstart compositionupdate FORM_SLUGS = %w(change compositionend compositionstart compositionupdate
input invalid reset select submit) input invalid reset select submit)

@ -83,6 +83,11 @@ module Docs
[2, 5, 6], [2, 5, 6],
[3, 4], [3, 4],
[] []
],
'rfc5023' => [
[],
[],
[]
] ]
} }

@ -7,11 +7,6 @@ module Docs
end end
def root def root
# Move "Global Objects" lists to the same level as the other ones
css('#Global_Objects + p').remove
div = at_css '#Global_Objects + div'
div.css('h3').each { |node| node.name = 'h2' }
at_css('#Global_Objects').replace(div.children)
end end
def other def other

@ -21,12 +21,16 @@ module Docs
node.name = 'th' node.name = 'th'
end end
css('nobr', 'span[style*="font"]', 'pre code', 'h2 strong').each do |node| css('nobr', 'span[style*="font"]', 'pre code', 'h2 strong', 'div:not([class])', 'span.seoSummary').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
css('h2[style]', 'pre[style]', 'th[style]', 'div[style*="line-height"]', 'table[style]', 'pre p[style]').remove_attr('style') css('h2[style]', 'pre[style]', 'th[style]', 'div[style*="line-height"]', 'table[style]', 'pre p[style]').remove_attr('style')
css('a[title]', 'span[title]').remove_attr('title')
css('a.glossaryLink').remove_attr('class')
css('*[lang]').remove_attr('lang')
css('h2 > a[name]', 'h3 > a[name]').each do |node| css('h2 > a[name]', 'h3 > a[name]').each do |node|
node.parent['id'] = node['name'] node.parent['id'] = node['name']
node.before(node.content).remove node.before(node.content).remove
@ -37,6 +41,16 @@ module Docs
node.remove_attribute('class') node.remove_attribute('class')
end end
css('pre.eval').each do |node|
node.content = node.content
node.remove_attribute('class')
end
css('table').each do |node|
node.before %(<div class="_table"></div>)
node.previous_element << node
end
doc doc
end end
end end

@ -8,26 +8,21 @@ module Docs
html_filters.push 'http/clean_html', 'http/entries', 'title' html_filters.push 'http/clean_html', 'http/entries', 'title'
options[:root_title] = 'HTTP' options[:root_title] = 'HTTP'
options[:title] = ->(filter) { options[:title] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title }
filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title options[:container] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? '.content' : nil }
} options[:skip_links] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? true : false }
options[:container] = ->(filter) { options[:fix_urls] = ->(url) do
filter.current_url.host == 'tools.ietf.org' ? '.content' : nil
}
options[:skip_links] = ->(filter) {
filter.current_url.host == 'tools.ietf.org' ? true : false
}
options[:fix_urls] = ->(url) {
url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1' url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1'
url url
} end
options[:attribution] = ->(filter) {
options[:attribution] = ->(filter) do
if filter.current_url.host == 'tools.ietf.org' if filter.current_url.host == 'tools.ietf.org'
"&copy; document authors. All rights reserved." "&copy; document authors. All rights reserved."
else else
Docs::Mdn.options[:attribution] Docs::Mdn.options[:attribution]
end end
} end
def initial_urls def initial_urls
%w(https://developer.mozilla.org/en-US/docs/Web/HTTP %w(https://developer.mozilla.org/en-US/docs/Web/HTTP
@ -38,7 +33,8 @@ module Docs
https://tools.ietf.org/html/rfc7232 https://tools.ietf.org/html/rfc7232
https://tools.ietf.org/html/rfc7233 https://tools.ietf.org/html/rfc7233
https://tools.ietf.org/html/rfc7234 https://tools.ietf.org/html/rfc7234
https://tools.ietf.org/html/rfc7235) https://tools.ietf.org/html/rfc7235
https://tools.ietf.org/html/rfc5023)
end end
end end
end end

@ -21,6 +21,7 @@ module Docs
'/var' => '/var()', '/var' => '/var()',
'/element' => '/element()', '/element' => '/element()',
'/Flexbox' => '/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes', '/Flexbox' => '/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes',
'/flexbox' => '/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes',
'/currentColor' => '/color_value' '/currentColor' => '/color_value'
} }

@ -1,5 +1,7 @@
module Docs module Docs
class Html < Mdn class Html < Mdn
prepend FixInternalUrlsBehavior
self.name = 'HTML' self.name = 'HTML'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'

@ -6,7 +6,7 @@ module Docs
params[:raw] = 1 params[:raw] = 1
params[:macros] = 1 params[:macros] = 1
html_filters.push 'mdn/clean_html' html_filters.push 'mdn/clean_html', 'images'
text_filters.insert_before 'attribution', 'mdn/contribute_link' text_filters.insert_before 'attribution', 'mdn/contribute_link'
options[:trailing_slash] = false options[:trailing_slash] = false

Loading…
Cancel
Save