From eabcb6179a695c6db67851d2c1b92c63b0f287a7 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sat, 8 Aug 2015 12:49:18 -0400 Subject: [PATCH] Add React Native documentation --- assets/images/icons.png | Bin 32531 -> 33055 bytes assets/images/icons@2x.png | Bin 86142 -> 87338 bytes assets/javascripts/news.json | 3 ++ .../templates/pages/about_tmpl.coffee | 2 +- assets/stylesheets/global/_icons.scss | 3 +- assets/stylesheets/pages/_react.scss | 2 +- lib/docs/filters/react/clean_html.rb | 17 ++++++++++-- lib/docs/filters/react/entries.rb | 9 +++++- lib/docs/scrapers/react.rb | 1 + lib/docs/scrapers/react_native.rb | 26 ++++++++++++++++++ public/icons/docs/react_native/16.png | Bin 0 -> 302 bytes public/icons/docs/react_native/16@2x.png | Bin 0 -> 677 bytes public/icons/docs/react_native/SOURCE | 1 + 13 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 lib/docs/scrapers/react_native.rb create mode 100644 public/icons/docs/react_native/16.png create mode 100644 public/icons/docs/react_native/16@2x.png create mode 100644 public/icons/docs/react_native/SOURCE diff --git a/assets/images/icons.png b/assets/images/icons.png index 93afb499232fe5ad34bb7241dcb3780daf330f95..7bca5a0badbad7c1e94c07a9cf529d2dca235f20 100644 GIT binary patch delta 3273 zcmV;)3^wzV{sEtY0+1IDpa=#4004{6XDt8#fab9!W^{ksyY{Fmt1Nz2&1!su@6a)` zaZRtOne^W8f`GgsF(?FIQIg?^kcbK>7eRT+BZ(_d1%yy8kBf?LnOtx4(V%zSpHc&pv0LbI(s8P1jb;Vt}X+;}SZ8#xp2D9$LNl%(~J&AwLhE32B@(hpst(QyqRTG!&2cY{rj86p|;g)sN}5cbl+fBcYk zkMMC{(@N%gJW&+4rfArB@AxWwL|?Z(hP6QuPb!@e5X9@0fP6yn2mM%Zu}k9`a;RT@ zcd~yrvRz^STD#JH4nd&9=CCjE4t(Hih(-EEdSwCCG`%on=9UZNi{lSWA=oXvPDTZS`@TPt0K)R6~*wjDy_g%va)}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_z#prgTg}u*JyFj2mS%hPK8q~ZEXz>LD5o4Lm||6>ql-u;FAg zk=Is(Ti=J?_N>TrEUb=`s2#eV85z8Og8#9f;8r0)X}dyJsRdqx9ojCwAjQ3hQ*6^_ z{uDf-RM9u8Q};DTI3pj+98*MZdhCVIErQHHKn_KJVrVDGx diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 391bed88..83840abb 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2015-08-09", + "New documentation: React Native" + ], [ "2015-08-03", "Added an icon in the sidebar to constrain the width of the UI (visible when applicable)." ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 0af71918..de0d9a24 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -310,7 +310,7 @@ credits = [ 'MIT', 'https://raw.githubusercontent.com/kriskowal/q/v1/LICENSE' ], [ - 'React', + 'React, React Native', '2013-2015 Facebook Inc.', 'CC BY', 'https://raw.githubusercontent.com/facebook/react/master/LICENSE-docs' diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index e18c6dd3..f1cf5289 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -4,7 +4,7 @@ width: 1rem; height: 1rem; background-image: image-url('icons.png'); - background-size: 10rem 9rem; + background-size: 10rem 10rem; } @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { @@ -111,3 +111,4 @@ %icon-contract { background-position: -7rem -8rem; } %icon-expand-white { background-position: -8rem -8rem; } %icon-contract-white { background-position: -9rem -8rem; } +._icon-react_native:before { background-position: 0 -9rem; } diff --git a/assets/stylesheets/pages/_react.scss b/assets/stylesheets/pages/_react.scss index dbed0046..026f25d2 100644 --- a/assets/stylesheets/pages/_react.scss +++ b/assets/stylesheets/pages/_react.scss @@ -1,7 +1,7 @@ ._react { > h2 { @extend %block-heading; } > h3 { @extend %block-label, %label-blue; } - > h4 { font-size: 1em; } + > h4 { @extend %block-label; } code { @extend %label; } blockquote { @extend %note; } diff --git a/lib/docs/filters/react/clean_html.rb b/lib/docs/filters/react/clean_html.rb index a9a7d829..25b3b8bb 100644 --- a/lib/docs/filters/react/clean_html.rb +++ b/lib/docs/filters/react/clean_html.rb @@ -5,10 +5,10 @@ module Docs @doc = at_css('.inner-content') if root_page? - at_css('h1').content = 'React Documentation' + at_css('h1').content = context[:root_title] end - css('.docs-prevnext', '.hash-link', '.edit-page-link').remove + css('.docs-prevnext', '.hash-link', '.edit-page-link', '.edit-github').remove css('a.anchor').each do |node| node.parent['id'] = node['name'] @@ -20,10 +20,23 @@ module Docs node.content = node.content end + css('.prism').each do |node| + node.name = 'pre' + node['data-lang'] = node['class'][/(?<=language\-)(\w+)/] + node.content = node.content + end + css('blockquote > p:first-child').each do |node| node.remove if node.content.strip == 'Note:' end + css('h3#props', 'h3#methods').each { |node| node.name = 'h2' } + css('h4.propTitle').each { |node| node.name = 'h3' } + + css('> div > div', '> div', 'div > span', '.props', '.prop').each do |node| + node.before(node.children).remove + end + doc end end diff --git a/lib/docs/filters/react/entries.rb b/lib/docs/filters/react/entries.rb index 07ff0b69..f233c26d 100644 --- a/lib/docs/filters/react/entries.rb +++ b/lib/docs/filters/react/entries.rb @@ -7,6 +7,12 @@ module Docs docs/component-specs ) + REPLACE_TYPES = { + 'Quick Start' => 'Guides', + 'apis' => 'APIs', + 'components' => 'Components' + } + def get_name at_css('h1').child.content end @@ -14,7 +20,8 @@ module Docs def get_type link = at_css('.nav-docs-section .active') section = link.ancestors('.nav-docs-section').first - section.at_css('h3').content + type = section.at_css('h3').content.strip + REPLACE_TYPES[type] || type end def additional_entries diff --git a/lib/docs/scrapers/react.rb b/lib/docs/scrapers/react.rb index 11888d2c..20d434f3 100644 --- a/lib/docs/scrapers/react.rb +++ b/lib/docs/scrapers/react.rb @@ -12,6 +12,7 @@ module Docs html_filters.push 'react/entries', 'react/clean_html' + options[:root_title] = 'React Documentation' options[:container] = '.documentationContent' options[:only_patterns] = [/\Adocs\//, /\Atips\//] options[:skip] = %w( diff --git a/lib/docs/scrapers/react_native.rb b/lib/docs/scrapers/react_native.rb new file mode 100644 index 00000000..d52015fa --- /dev/null +++ b/lib/docs/scrapers/react_native.rb @@ -0,0 +1,26 @@ +module Docs + class ReactNative < React + self.name = 'React Native' + self.slug = 'react_native' + self.type = 'react' + self.version = '0.8.0' + self.base_url = 'https://facebook.github.io/react-native/docs/' + self.root_path = 'getting-started.html' + self.links = { + home: 'https://facebook.github.io/react-native/', + code: 'https://github.com/facebook/react-native' + } + + options[:root_title] = 'React Native Documentation' + options[:only_patterns] = nil + options[:skip] = %w( + videos.html + transforms.html + troubleshooting.html) + + options[:attribution] = <<-HTML + © 2015 Facebook Inc.
+ Licensed under the Creative Commons Attribution 4.0 International Public License. + HTML + end +end diff --git a/public/icons/docs/react_native/16.png b/public/icons/docs/react_native/16.png new file mode 100644 index 0000000000000000000000000000000000000000..01011842929edef9afba26f17fd6e7b8782cb135 GIT binary patch literal 302 zcmV+}0nz@6P)Nkl0`j`m*EiglJ^RLn>ovOa$_(;u>uQ&5&2@9j-MXZ1 zotr#^{L(=FFk!@RCvjyCbZJPjUNpMZTUeh&vQqmzk9>TUKti%vAv_psZNA zx?WSWes!fHkOT6Zvb>V45)jD)nKEGSBY+Gi0N9368{QIfr~m)}07*qoM6N<$f|X=~ ARsaA1 literal 0 HcmV?d00001 diff --git a/public/icons/docs/react_native/16@2x.png b/public/icons/docs/react_native/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..aae4d0dcd36273288515232744f4ccd3faaabaa1 GIT binary patch literal 677 zcmV;W0$TlvP)kdg0007PNkl%catPgE_LB_c~eFCb`G3a5as0%9pf3j)3J4w%IqM{h0w^Bf;@ zhnaZ?Eas}C*9L&L4&@4q^A4EK1Iw!civ*}@wFh$K8IZ~+{Azua=N@mVE4<+@74b^- ztD2g3Knq|!CwWJfOJS!}ftI-kv|&F0e_3O!86*=ElEq+y)V~07waFe3_E-{Zkt~z$o-O)*nnqD#ceSOh^w7y1E%1XVp@x7im(A|cupDn2G_uh zb~^w7F}D=BW#?oWp0NfS5abOHXkdiqz+xaGK7t>@2(buK?LTNJ_Zx!FQ3!DiI8HA% zno+pH9-{{Ywe02^ZZ5Dvj*}pFIQu;4z##zsu!40!Dp5i*M#PY^LKQ%+4!O_7R=_6C z@{uf;lryRzN8W3J&-l%(PvSmrXh41Qe=1>ARR`xCFpc|`R|n=XAH*^>Rj1~+A6#+t z+5^z8F#Eww?%>>?z|6{m??}BNbB-r-4Co;smTa^nkR#84Qat1VBiRVtq_)v&iy>tc z4~0^B1_)7h@R8G`;J>LHT_K!p0MC}f700000 LNkvXXu0mjfkE}Hx literal 0 HcmV?d00001 diff --git a/public/icons/docs/react_native/SOURCE b/public/icons/docs/react_native/SOURCE new file mode 100644 index 00000000..c1d5f7fb --- /dev/null +++ b/public/icons/docs/react_native/SOURCE @@ -0,0 +1 @@ +https://github.com/facebook/react-native/blob/gh-pages/img/favicon.png