From d0cf5d745ca35b46aaf8c4361f88e489c6943cec Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sat, 26 Jan 2019 23:09:27 +0100 Subject: [PATCH] Add ReactiveX documentation --- .../templates/pages/about_tmpl.coffee | 5 ++ assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_reactivex.scss | 11 +++ lib/docs/filters/reactivex/clean_html.rb | 65 ++++++++++++++++++ lib/docs/filters/reactivex/entries.rb | 14 ++++ lib/docs/scrapers/reactivex.rb | 23 +++++++ public/icons/docs/reactivex/SOURCE | 1 + public/icons/docs/reactivex/logo.png | Bin 0 -> 1521 bytes public/icons/docs/reactivex/logo@2x.png | Bin 0 -> 5084 bytes 9 files changed, 120 insertions(+) create mode 100644 assets/stylesheets/pages/_reactivex.scss create mode 100644 lib/docs/filters/reactivex/clean_html.rb create mode 100644 lib/docs/filters/reactivex/entries.rb create mode 100644 lib/docs/scrapers/reactivex.rb create mode 100644 public/icons/docs/reactivex/SOURCE create mode 100644 public/icons/docs/reactivex/logo.png create mode 100644 public/icons/docs/reactivex/logo@2x.png diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 5d997403..8e8eebc2 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -595,6 +595,11 @@ credits = [ '2013-present Facebook Inc.', 'MIT', 'https://raw.githubusercontent.com/facebook/react/master/LICENSE' + ], [ + 'ReactiveX', + 'ReactiveX contributors', + 'Apache', + 'https://raw.githubusercontent.com/ReactiveX/reactivex.github.io/develop/LICENSE' ], [ 'Redis', '2009-2018 Salvatore Sanfilippo', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 2a64e5c9..0f239f81 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -89,6 +89,7 @@ 'pages/ramda', 'pages/rdoc', 'pages/react_native', + 'pages/reactivex', 'pages/redis', 'pages/rethinkdb', 'pages/rfc', diff --git a/assets/stylesheets/pages/_reactivex.scss b/assets/stylesheets/pages/_reactivex.scss new file mode 100644 index 00000000..f544865d --- /dev/null +++ b/assets/stylesheets/pages/_reactivex.scss @@ -0,0 +1,11 @@ +._reactivex { + @extend %simple; + + img { + max-width: 50%; + } + + figure { + margin: 0; + } +} diff --git a/lib/docs/filters/reactivex/clean_html.rb b/lib/docs/filters/reactivex/clean_html.rb new file mode 100644 index 00000000..2338bb5c --- /dev/null +++ b/lib/docs/filters/reactivex/clean_html.rb @@ -0,0 +1,65 @@ +module Docs + class Reactivex + class CleanHtmlFilter < Filter + def call + # Can't use options[:container] because then the navigation bar wouldn't be scraped + @doc = at_css(root_page? ? '.col-md-8' : '.col-sm-8') + + # Remove breadcrumbs + css('.breadcrumb').remove + + # Replace interactive demo's with links to them + css('rx-marbles').each do |node| + node.name = 'a' + node.content = 'Open interactive diagram on rxmarbles.com' + node['href'] = "https://rxmarbles.com/##{node['key']}" + node.remove_attribute('key') + end + + # Syntax-highlighted code blocks + css('.code').each do |node| + language = node['class'].gsub('code', '').strip + + pre = node.at_css('pre') + pre['data-language'] = language + pre.content = pre.content.strip + + node.replace(pre) + end + + # Assume JavaScript syntax for code blocks not surrounded by a div.code + css('pre').each do |node| + next if node['data-language'] + + node.content = node.content.strip + node['data-language'] = 'javascript' + end + + # Make language specific implementation titles prettier + css('.panel-title').each do |node| + # Remove the link, keep the text + node.content = node.content + + # Transform it into a header for better styling + node.name = 'h3' + end + + # Remove language specific implementations that are TBD + css('span').each do |node| + next unless node.content == 'TBD' + node.xpath('./ancestor::div[contains(@class, "panel-default")][1]').remove + end + + # Remove the : at the end of "Language-Specific Information:" + css('h2').each do |node| + node.inner_html = node.inner_html.gsub('Information:', 'Information') + end + + # Remove attributes to reduce file size + css('div').remove_attr('class') + + doc + end + end + end +end diff --git a/lib/docs/filters/reactivex/entries.rb b/lib/docs/filters/reactivex/entries.rb new file mode 100644 index 00000000..d238ffb4 --- /dev/null +++ b/lib/docs/filters/reactivex/entries.rb @@ -0,0 +1,14 @@ +module Docs + class Reactivex + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + links = css('.breadcrumb > li:nth-child(2) > a') + links.size > 0 ? links.first.content : 'Manual' + end + end + end +end diff --git a/lib/docs/scrapers/reactivex.rb b/lib/docs/scrapers/reactivex.rb new file mode 100644 index 00000000..1374468b --- /dev/null +++ b/lib/docs/scrapers/reactivex.rb @@ -0,0 +1,23 @@ +module Docs + class Reactivex < UrlScraper + self.type = 'reactivex' + self.name = 'ReactiveX' + self.base_url = 'http://reactivex.io/' + self.root_path = 'intro.html' + self.links = { + home: 'http://reactivex.io/' + } + + html_filters.push 'reactivex/entries', 'reactivex/clean_html' + + options[:download_images] = false + + options[:only_patterns] = [/documentation\//] + options[:skip_patterns] = [/ko\//] + + options[:attribution] = <<-HTML + © ReactiveX contributors
+ Licensed under the Apache License 2.0. + HTML + end +end diff --git a/public/icons/docs/reactivex/SOURCE b/public/icons/docs/reactivex/SOURCE new file mode 100644 index 00000000..f9c25e1e --- /dev/null +++ b/public/icons/docs/reactivex/SOURCE @@ -0,0 +1 @@ +https://github.com/ReactiveX/reactivex.github.io/blob/develop/assets/Rx_Icon.png diff --git a/public/icons/docs/reactivex/logo.png b/public/icons/docs/reactivex/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..790f839053e34c601f80928f7fecc99243099d91 GIT binary patch literal 1521 zcmah|dsxk99RHkiD$y)Z~!tni*7$tmRtL~dU*gFMgdVVKo?tzst4BC z0#AGa`vjnWSn}CfQviAS%o*O!tbl^60Zl^?1vMZk0}&J{=~zWkKyf1tTr##&_yj;* zfTVJ`Q(!rg%c0qXm?*?PgCht3R?t>x42bT=eu~u;NgR?XDhvqQgUb|?DYRYCHbZj@ zVits4a2eSAW=Ebvd;#e$q>~V`A>=_UkVz#nav!7uiKAgbL7G7_ARGr@BX2NF%Fde3PAEfo)~?=19(M1SOKya!d+1K`&|odfO#_~-U1jV62uxFm3ot#s`}H4h<3;Hn{p zgUbSU4BQd$=fU3wUjnWcd@FeB20jze`nKp2mOW{~o7Psne`2WiTB! zr}%Y!N!E(Nz?`x+M)XSWESIa<2d(y0=2L3uFwk2Q%q|)zZPG0i?zD7QtsQ&4F~Ho^ z$~|y4M^qi`!V$709+#=3Ldj>R61v`&;!xuf&=v&~tTB&7$Cr636KlGP6Mu z`rQjGQw=olQ0$1egK`?Hb6qebt<%udQ5+v%*xlf#K;Q7<4kn~o?`Z zY>=CigZF?tvOcos1|x@j#D^nCeKh)G#U~~#H68P*&1a>b+uA9|jvGJ0j4^yMagzNX zlc(IfKlRJ6zBVz3!?dyoc4plyui5aP^WEHs zKJ(@;Sh#5MqwjtFu;g)lgMUDvMNsh4Wy?cWti-A(p-;nBzZD+Qn~7DeS&Mbg8h==C zxuFmGZrt?F=EyCG+S(Mo?Omqmy_olZ{3&)j;&wc5-nlEjpW389#|t9C07=uL)g>f; zusbPv&)$@M7?`^M=d=R{52YXe<;c-v8OL#AP-fQ2Q`x7_{F-z2-1!T+82sCiyo;Cg zms_t~y_SFd#!$fOruD7c1-};-72mmAGHiIFD!hJ(qu)Me#7LF1k1D`V6=?4t9>@Ze zwswtBGCp#jT+*8c}U`41q`E9N=_z|Gmy JDPx*%^xvy8X{i7J literal 0 HcmV?d00001 diff --git a/public/icons/docs/reactivex/logo@2x.png b/public/icons/docs/reactivex/logo@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a45cd5cb84184a412b136a825e6303f6d4fbcd0b GIT binary patch literal 5084 zcmV<26C>=2P)X+uL$Nkc;*P;zf(X>4Tx07wm;mUmQB*%pV-y*Itk5+Wca^cs2zAksTX z6$DXM^`x7XQc?|s+008spb1j2M!0f022SQPH-!CVp(%f$Br7!UytSOLJ{W@ZFO z_(THK{JlMynW#v{v-a*TfMmPdEWc1DbJqWVks>!kBnAKqMb$PuekK>?0+ds;#ThdH z1j_W4DKdsJG8Ul;qO2n0#IJ1jr{*i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