Add ReactiveX documentation
Unified · Split
| @@ -631,6 +631,11 @@ credits = [ · 630 unmodified lines | ||
| 631 | 631 | '2013-present Facebook Inc.', |
| 632 | 632 | 'MIT', |
| 633 | 633 | 'https://raw.githubusercontent.com/facebook/react/master/LICENSE' |
| 634 | + ], [ | |
| 635 | + 'ReactiveX', | |
| 636 | + 'ReactiveX contributors', | |
| 637 | + 'Apache', | |
| 638 | + 'https://raw.githubusercontent.com/ReactiveX/reactivex.github.io/develop/LICENSE' | |
| 634 | 639 | ], [ |
| 635 | 640 | 'Redis', |
| 636 | 641 | '2009-2018 Salvatore Sanfilippo', |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* PrismJS 1.17.1 |
| 2 | −https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+java+php+json+julia+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */ | |
| 2 | +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+groovy+java+php+json+julia+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */ | |
| 3 | 3 | var _self = (typeof window !== 'undefined') |
| 4 | 4 | ? window // if in browser |
| 5 | 5 | : ( |
| @@ -1686,6 +1686,72 @@ Prism.languages.go = Prism.languages.extend('clike', { · 1680 unmodified lines | ||
| 1686 | 1686 | }); |
| 1687 | 1687 | delete Prism.languages.go['class-name']; |
| 1688 | 1688 | |
| 1689 | +Prism.languages.groovy = Prism.languages.extend('clike', { | |
| 1690 | + 'keyword': /\b(?:as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/, | |
| 1691 | + 'string': [ | |
| 1692 | + { | |
| 1693 | + pattern: /("""|''')[\s\S]*?\1|(?:\$\/)(?:\$\/\$|[\s\S])*?\/\$/, | |
| 1694 | + greedy: true | |
| 1695 | + }, | |
| 1696 | + { | |
| 1697 | + pattern: /(["'\/])(?:\\.|(?!\1)[^\\\r\n])*\1/, | |
| 1698 | + greedy: true | |
| 1699 | + } | |
| 1700 | + ], | |
| 1701 | + 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i, | |
| 1702 | + 'operator': { | |
| 1703 | + pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, | |
| 1704 | + lookbehind: true | |
| 1705 | + }, | |
| 1706 | + 'punctuation': /\.+|[{}[\];(),:$]/ | |
| 1707 | +}); | |
| 1708 | + | |
| 1709 | +Prism.languages.insertBefore('groovy', 'string', { | |
| 1710 | + 'shebang': { | |
| 1711 | + pattern: /#!.+/, | |
| 1712 | + alias: 'comment' | |
| 1713 | + } | |
| 1714 | +}); | |
| 1715 | + | |
| 1716 | +Prism.languages.insertBefore('groovy', 'punctuation', { | |
| 1717 | + 'spock-block': /\b(?:setup|given|when|then|and|cleanup|expect|where):/ | |
| 1718 | +}); | |
| 1719 | + | |
| 1720 | +Prism.languages.insertBefore('groovy', 'function', { | |
| 1721 | + 'annotation': { | |
| 1722 | + alias: 'punctuation', | |
| 1723 | + pattern: /(^|[^.])@\w+/, | |
| 1724 | + lookbehind: true | |
| 1725 | + } | |
| 1726 | +}); | |
| 1727 | + | |
| 1728 | +// Handle string interpolation | |
| 1729 | +Prism.hooks.add('wrap', function(env) { | |
| 1730 | + if (env.language === 'groovy' && env.type === 'string') { | |
| 1731 | + var delimiter = env.content[0]; | |
| 1732 | + | |
| 1733 | + if (delimiter != "'") { | |
| 1734 | + var pattern = /([^\\])(?:\$(?:\{.*?\}|[\w.]+))/; | |
| 1735 | + if (delimiter === '$') { | |
| 1736 | + pattern = /([^\$])(?:\$(?:\{.*?\}|[\w.]+))/; | |
| 1737 | + } | |
| 1738 | + | |
| 1739 | + // To prevent double HTML-encoding we have to decode env.content first | |
| 1740 | + env.content = env.content.replace(/</g, '<').replace(/&/g, '&'); | |
| 1741 | + | |
| 1742 | + env.content = Prism.highlight(env.content, { | |
| 1743 | + 'expression': { | |
| 1744 | + pattern: pattern, | |
| 1745 | + lookbehind: true, | |
| 1746 | + inside: Prism.languages.groovy | |
| 1747 | + } | |
| 1748 | + }); | |
| 1749 | + | |
| 1750 | + env.classes.push(delimiter === '/' ? 'regex' : 'gstring'); | |
| 1751 | + } | |
| 1752 | + } | |
| 1753 | +}); | |
| 1754 | + | |
| 1689 | 1755 | (function (Prism) { |
| 1690 | 1756 | |
| 1691 | 1757 | var keywords = /\b(?:abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while|var|null|exports|module|open|opens|provides|requires|to|transitive|uses|with)\b/; |
| @@ -92,6 +92,7 @@ · 91 unmodified lines | ||
| 92 | 92 | 'pages/ramda', |
| 93 | 93 | 'pages/rdoc', |
| 94 | 94 | 'pages/react_native', |
| 95 | + 'pages/reactivex', | |
| 95 | 96 | 'pages/redis', |
| 96 | 97 | 'pages/rethinkdb', |
| 97 | 98 | 'pages/rfc', |
| @@ -0,0 +1,51 @@ | ||
| 1 | +._reactivex { | |
| 2 | + @extend %simple; | |
| 3 | + | |
| 4 | + img { | |
| 5 | + max-width: 50%; | |
| 6 | + } | |
| 7 | + | |
| 8 | + figure { | |
| 9 | + margin: 0; | |
| 10 | + } | |
| 11 | + | |
| 12 | + dfn { | |
| 13 | + cursor: text; | |
| 14 | + font-style: italic; | |
| 15 | + text-decoration: none; | |
| 16 | + border-bottom: none; | |
| 17 | + } | |
| 18 | + | |
| 19 | + #tree { | |
| 20 | + dt, dd { | |
| 21 | + font-weight: normal; | |
| 22 | + } | |
| 23 | + | |
| 24 | + dt { | |
| 25 | + float: left; | |
| 26 | + clear: left; | |
| 27 | + | |
| 28 | + margin-top: 0; | |
| 29 | + | |
| 30 | + &:before { | |
| 31 | + content: "\2026"; | |
| 32 | + } | |
| 33 | + } | |
| 34 | + | |
| 35 | + dd:not(.sub) { | |
| 36 | + float: left; | |
| 37 | + | |
| 38 | + margin: 0 0 0 5px; | |
| 39 | + padding: 0; | |
| 40 | + } | |
| 41 | + | |
| 42 | + dl#outer > dt { | |
| 43 | + font-weight: bold; | |
| 44 | + margin-top: 5px; | |
| 45 | + | |
| 46 | + & + dd { | |
| 47 | + margin-top: 5px; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | +} | |
| @@ -262,5 +262,11 @@ module Docs · 261 unmodified lines | ||
| 262 | 262 | json = fetch_json("https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}", opts) |
| 263 | 263 | Base64.decode64(json['content']) |
| 264 | 264 | end |
| 265 | + | |
| 266 | + def get_latest_github_commit_date(owner, repo, opts) | |
| 267 | + commits = fetch_json("https://api.github.com/repos/#{owner}/#{repo}/commits", opts) | |
| 268 | + timestamp = commits[0]['commit']['author']['date'] | |
| 269 | + Date.iso8601(timestamp).to_time.to_i | |
| 270 | + end | |
| 265 | 271 | end |
| 266 | 272 | end |
| @@ -0,0 +1,96 @@ | ||
| 1 | +module Docs | |
| 2 | + class Reactivex | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + # Can't use options[:container] because then the navigation bar wouldn't be scraped | |
| 6 | + @doc = at_css(root_page? ? '.col-md-8' : '.col-sm-8') | |
| 7 | + | |
| 8 | + # Remove breadcrumbs | |
| 9 | + css('.breadcrumb').remove | |
| 10 | + | |
| 11 | + # Titleize title on Backpressure Operators page | |
| 12 | + if subpath == 'documentation/operators/backpressure.html' | |
| 13 | + title = at_css('h1') | |
| 14 | + title.content = title.content.titleize | |
| 15 | + end | |
| 16 | + | |
| 17 | + # Lower all h1 headers except the first one | |
| 18 | + css('* + h1').each do |node| | |
| 19 | + node.name = 'h2' | |
| 20 | + end | |
| 21 | + | |
| 22 | + # Pull code blocks in links out of their <strong> parent (if possible) | |
| 23 | + css('a > strong > code').each do |node| | |
| 24 | + # Skip if the parent had multiple code nodes and node.parent.replace already ran for one | |
| 25 | + next unless node.parent.name == 'strong' | |
| 26 | + | |
| 27 | + node.parent.replace node.parent.children | |
| 28 | + end | |
| 29 | + | |
| 30 | + # Pull header out of trees | |
| 31 | + tree = at_css('#tree') | |
| 32 | + unless tree.nil? | |
| 33 | + title = tree.at_css('h1') | |
| 34 | + title.name = 'h2' | |
| 35 | + tree.before(title) | |
| 36 | + end | |
| 37 | + | |
| 38 | + # Beautify operator descriptions | |
| 39 | + at_css('h3').name = 'blockquote' if subpath.include?('operators/') | |
| 40 | + | |
| 41 | + # Replace interactive demo's with links to them | |
| 42 | + css('rx-marbles').each do |node| | |
| 43 | + node.name = 'a' | |
| 44 | + node.content = 'Open interactive diagram on rxmarbles.com' | |
| 45 | + node['href'] = "https://rxmarbles.com/##{node['key']}" | |
| 46 | + node.remove_attribute('key') | |
| 47 | + end | |
| 48 | + | |
| 49 | + # Syntax-highlighted code blocks | |
| 50 | + css('.code').each do |node| | |
| 51 | + language = node['class'].gsub('code', '').strip | |
| 52 | + | |
| 53 | + pre = node.at_css('pre') | |
| 54 | + pre['data-language'] = language | |
| 55 | + pre.content = pre.content.strip | |
| 56 | + | |
| 57 | + node.replace(pre) | |
| 58 | + end | |
| 59 | + | |
| 60 | + # Assume JavaScript syntax for code blocks not surrounded by a div.code | |
| 61 | + css('pre').each do |node| | |
| 62 | + next if node['data-language'] | |
| 63 | + | |
| 64 | + node.content = node.content.strip | |
| 65 | + node['data-language'] = 'javascript' | |
| 66 | + end | |
| 67 | + | |
| 68 | + # Make language specific implementation titles prettier | |
| 69 | + css('.panel-title').each do |node| | |
| 70 | + # Remove the link, keep the children | |
| 71 | + link = node.at_css('a') | |
| 72 | + link.replace(link.children) unless link.nil? | |
| 73 | + | |
| 74 | + # Transform it into a header for better styling | |
| 75 | + node.name = 'h3' | |
| 76 | + end | |
| 77 | + | |
| 78 | + # Remove language specific implementations that are TBD | |
| 79 | + css('span').each do |node| | |
| 80 | + next unless node.content == 'TBD' | |
| 81 | + node.xpath('./ancestor::div[contains(@class, "panel-default")][1]').remove | |
| 82 | + end | |
| 83 | + | |
| 84 | + # Remove the : at the end of "Language-Specific Information:" | |
| 85 | + css('h2').each do |node| | |
| 86 | + node.inner_html = node.inner_html.gsub('Information:', 'Information') | |
| 87 | + end | |
| 88 | + | |
| 89 | + # Remove attributes to reduce file size | |
| 90 | + css('div').remove_attr('class') | |
| 91 | + | |
| 92 | + doc | |
| 93 | + end | |
| 94 | + end | |
| 95 | + end | |
| 96 | +end | |
| @@ -0,0 +1,21 @@ | ||
| 1 | +module Docs | |
| 2 | + class Reactivex | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + title = at_css('h1').content | |
| 6 | + title = title.titleize if is_backpressure_operators? | |
| 7 | + title | |
| 8 | + end | |
| 9 | + | |
| 10 | + def get_type | |
| 11 | + return 'Manual' if is_backpressure_operators? | |
| 12 | + links = css('.breadcrumb > li:nth-child(2) > a') | |
| 13 | + links.size > 0 ? links.first.content : 'Manual' | |
| 14 | + end | |
| 15 | + | |
| 16 | + def is_backpressure_operators? | |
| 17 | + subpath == 'documentation/operators/backpressure.html' | |
| 18 | + end | |
| 19 | + end | |
| 20 | + end | |
| 21 | +end | |
| @@ -0,0 +1,27 @@ | ||
| 1 | +module Docs | |
| 2 | + class Reactivex < UrlScraper | |
| 3 | + self.name = 'ReactiveX' | |
| 4 | + self.type = 'reactivex' | |
| 5 | + self.base_url = 'http://reactivex.io/' | |
| 6 | + self.root_path = 'intro.html' | |
| 7 | + self.links = { | |
| 8 | + home: 'http://reactivex.io/' | |
| 9 | + } | |
| 10 | + | |
| 11 | + html_filters.push 'reactivex/entries', 'reactivex/clean_html' | |
| 12 | + | |
| 13 | + options[:download_images] = false | |
| 14 | + | |
| 15 | + options[:only_patterns] = [/documentation\//] | |
| 16 | + options[:skip_patterns] = [/ko\//] | |
| 17 | + | |
| 18 | + options[:attribution] = <<-HTML | |
| 19 | + © ReactiveX contributors<br> | |
| 20 | + Licensed under the Apache License 2.0. | |
| 21 | + HTML | |
| 22 | + | |
| 23 | + def get_latest_version(opts) | |
| 24 | + get_latest_github_commit_date('ReactiveX', 'reactivex.github.io', opts) | |
| 25 | + end | |
| 26 | + end | |
| 27 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +https://github.com/ReactiveX/reactivex.github.io/blob/develop/assets/Rx_Icon.png | |