Update MDN documentations

pull/602/merge
Thibaut Courouble 8 years ago
parent 3ac7142224
commit 66e3848b5b

@ -24,6 +24,8 @@
> h3 { @extend %block-label, %label-blue; } > h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; } > h4 { font-size: 1em; }
p > code { @extend %label; }
> .note, > .note,
.notice, .notice,
.warning, .warning,

@ -293,6 +293,8 @@ class App < Sinatra::Application
'/css-data-types/' => '/css-values-units/', '/css-data-types/' => '/css-values-units/',
'/css-at-rules/' => '/?q=css%20%40', '/css-at-rules/' => '/?q=css%20%40',
'/html/article' => '/html/element/article', '/html/article' => '/html/element/article',
'html-html5/' => 'html-elements/',
'html-standard/' => 'html-elements/',
'/http-status-codes/' => '/http-status/' '/http-status-codes/' => '/http-status/'
}.each do |path, url| }.each do |path, url|
class_eval <<-CODE, __FILE__, __LINE__ + 1 class_eval <<-CODE, __FILE__, __LINE__ + 1

@ -6,17 +6,17 @@ module Docs
'CSS_Background_and_Borders' => 'Backgrounds & Borders', 'CSS_Background_and_Borders' => 'Backgrounds & Borders',
'CSS_Columns' => 'Multi-column Layout', 'CSS_Columns' => 'Multi-column Layout',
'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout',
'CSS_Grid_Layout' => 'Grid Layout',
'CSS_Images' => 'Image Values', 'CSS_Images' => 'Image Values',
'CSS_Lists_and_Counters' => 'Lists & Counters', 'CSS_Lists_and_Counters' => 'Lists & Counters',
'CSS_Transforms' => 'Transforms', 'CSS_Transforms' => 'Transforms',
'Media_Queries' => 'Media Queries', 'Media_Queries' => 'Media Queries',
'@media' => 'Media Queries',
'transform-function' => 'Transforms', 'transform-function' => 'Transforms',
'@media' => 'Media Queries',
'text-size-adjust' => 'Miscellaneous', 'text-size-adjust' => 'Miscellaneous',
'resolved_value' => 'Miscellaneous', 'resolved_value' => 'Miscellaneous',
'touch-action' => 'Miscellaneous', 'touch-action' => 'Miscellaneous',
'will-change' => 'Miscellaneous', 'will-change' => 'Miscellaneous'
'align-self' => 'Flexible Box Layout'
} }
DATA_TYPE_SLUGS = %w(angle basic-shape color_value counter frequency DATA_TYPE_SLUGS = %w(angle basic-shape color_value counter frequency
@ -53,6 +53,7 @@ module Docs
type.remove! %r{\(.*\)} type.remove! %r{\(.*\)}
type.sub! 'and', '&' type.sub! 'and', '&'
type.strip! type.strip!
type = 'Grid Layout' if type.include?('Grid Layout')
type = 'Scroll Snap' if type.include?('Scroll Snap') type = 'Scroll Snap' if type.include?('Scroll Snap')
type = 'Compositing & Blending' if type.include?('Compositing') type = 'Compositing & Blending' if type.include?('Compositing')
type = 'Animations & Transitions' if type.in?(%w(Animations Transitions)) type = 'Animations & Transitions' if type.in?(%w(Animations Transitions))
@ -118,7 +119,7 @@ module Docs
%w(step-end step-end) ], %w(step-end step-end) ],
'color_value' => [ 'color_value' => [
%w(transparent transparent_keyword), %w(transparent transparent_keyword),
%w(currentColor currentColor_keyword), %w(currentColor currentcolor_keyword),
%w(rgb() rgb), %w(rgb() rgb),
%w(hsl() hsl), %w(hsl() hsl),
%w(rgba() rgba), %w(rgba() rgba),

@ -10,9 +10,15 @@ module Docs
end end
def other def other
css('h1 + br').remove
# Bug fix: HTMLElement.offsetWidth # Bug fix: HTMLElement.offsetWidth
css('#offsetContainer .comment').remove css('#offsetContainer .comment').remove
css('section', 'font').each do |node|
node.before(node.children).remove
end
# Bug fix: CompositionEvent, DataTransfer, etc. # Bug fix: CompositionEvent, DataTransfer, etc.
if (div = at_css('div[style]')) && div['style'].include?('border: solid #ddd 2px') if (div = at_css('div[style]')) && div['style'].include?('border: solid #ddd 2px')
div.remove div.remove

@ -24,6 +24,7 @@ module Docs
'High Resolution Time' => 'Web Performance', 'High Resolution Time' => 'Web Performance',
'Intersection' => 'Intersection Observer', 'Intersection' => 'Intersection Observer',
'Media Capture' => 'Media', 'Media Capture' => 'Media',
'Media Session' => 'Media Session',
'Media Source' => 'Media', 'Media Source' => 'Media',
'MediaStream' => 'Media Streams', 'MediaStream' => 'Media Streams',
'Navigation Timing' => 'Web Performance', 'Navigation Timing' => 'Web Performance',
@ -69,6 +70,7 @@ module Docs
'element' => 'Element', 'element' => 'Element',
'event' => 'Event', 'event' => 'Event',
'Event' => 'Event', 'Event' => 'Event',
'EventSource' => 'Server-Sent Events',
'Fetch' => 'Fetch', 'Fetch' => 'Fetch',
'File' => 'File', 'File' => 'File',
'GlobalEventHandlers' => 'GlobalEventHandlers', 'GlobalEventHandlers' => 'GlobalEventHandlers',
@ -78,7 +80,8 @@ module Docs
'IDB' => 'IndexedDB', 'IDB' => 'IndexedDB',
'location' => 'Location', 'location' => 'Location',
'navigator' => 'Navigator', 'navigator' => 'Navigator',
'MediaQuery' => 'MediaQuery', 'MediaMetadata' => 'Media Session',
'MediaSession' => 'Media Session',
'MediaTrack' => 'Media Streams', 'MediaTrack' => 'Media Streams',
'Node' => 'Node', 'Node' => 'Node',
'Notification' => 'Notification', 'Notification' => 'Notification',
@ -92,10 +95,12 @@ module Docs
'RTC' => 'WebRTC', 'RTC' => 'WebRTC',
'screen' => 'Screen', 'screen' => 'Screen',
'Selection' => 'Selection', 'Selection' => 'Selection',
'Shadow' => 'Shadow DOM',
'Storage' => 'Web Storage', 'Storage' => 'Web Storage',
'StyleSheet' => 'CSS', 'StyleSheet' => 'CSS',
'Stylesheet' => 'CSS', 'Stylesheet' => 'CSS',
'SVG' => 'SVG', 'SVG' => 'SVG',
'TimeRanges' => 'Media',
'timing' => 'Web Performance', 'timing' => 'Web Performance',
'Timing' => 'Web Performance', 'Timing' => 'Web Performance',
'Touch' => 'Touch Events', 'Touch' => 'Touch Events',

@ -2,16 +2,8 @@ module Docs
class Html class Html
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
css('span > .icon-thumbs-down-alt:first-child:last-child').each do |node| css('section', 'div.section', 'div.row').each do |node|
node.parent.replace('deprecated') node.before(node.children).remove
end
css('span > .icon-trash:first-child:last-child').each do |node|
node.parent.replace('deleted')
end
css('span > .icon-warning-sign:first-child:last-child').each do |node|
node.parent.replace('non standard')
end end
doc doc

@ -1,7 +1,6 @@
module Docs module Docs
class Html class Html
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
HTML5 = %w(content element video)
OBSOLETE = %w(frame frameset hgroup noframes) OBSOLETE = %w(frame frameset hgroup noframes)
ADDITIONAL_ENTRIES = { 'Element/Heading_Elements' => (1..6).map { |n| ["h#{n}"] } } ADDITIONAL_ENTRIES = { 'Element/Heading_Elements' => (1..6).map { |n| ["h#{n}"] } }
@ -14,23 +13,16 @@ module Docs
end end
def get_type def get_type
slug = self.slug.remove('Element/') return 'Miscellaneous' if slug.include?('CORS') || slug.include?('Using')
if self.slug.start_with?('Global_attr') if slug.start_with?('Global_attr')
'Attributes' 'Attributes'
elsif at_css('.obsoleteHeader', '.deprecatedHeader', '.nonStandardHeader') || OBSOLETE.include?(slug) elsif at_css('.obsoleteHeader', '.deprecatedHeader', '.nonStandardHeader') || OBSOLETE.include?(slug.remove('Element/'))
'Obsolete' 'Obsolete'
elsif slug.start_with?('Element/')
'Elements'
else else
spec = css('.standard-table').last.try(:content) 'Miscellaneous'
if (spec && html5_spec?(spec)) || HTML5.include?(slug)
'HTML5'
else
if self.slug.start_with?('Element/')
'Standard'
else
'Miscellaneous'
end
end
end end
end end
@ -60,10 +52,6 @@ module Docs
[] []
end end
end end
def html5_spec?(spec)
(spec =~ /HTML\s?5/ || spec.include?('WHATWG HTML Living Standard')) && spec !~ /HTML\s?4/
end
end end
end end
end end

@ -19,7 +19,9 @@ module Docs
'/symbols' => '/@counter-style/symbols', '/symbols' => '/@counter-style/symbols',
'/system' => '/@counter-style/system', '/system' => '/@counter-style/system',
'/var' => '/var()', '/var' => '/var()',
'/Flexbox' => '/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes' '/element' => '/element()',
'/Flexbox' => '/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes',
'/currentColor' => '/color_value'
} }
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do

@ -8,6 +8,8 @@ module Docs
html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title' html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title'
options[:root_title] = 'XSLT'
options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/] options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/]
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do

Loading…
Cancel
Save