History

reactivex: process review comments

Jasper van Merle committed 7 years ago

Commit dcbe81c1 parent f2a38db3 files · +81 −3Browse files

Unified · Split

3 files
  1. assets/stylesheets/pages/_reactivex.scss +40 −0
  2. lib/docs/filters/reactivex/clean_html.rb +33 −2
  3. lib/docs/filters/reactivex/entries.rb +8 −1
assets/stylesheets/pages/_reactivex.scss+40−0
@@ -8,4 +8,44 @@ · 7 unmodified lines
88 figure {
99 margin: 0;
1010 }
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: "…";
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+ }
1151 }
lib/docs/filters/reactivex/clean_html.rb+33−2
@@ -8,6 +8,36 @@ module Docs · 7 unmodified lines
88 # Remove breadcrumbs
99 css('.breadcrumb').remove
1010
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+
1141 # Replace interactive demo's with links to them
1242 css('rx-marbles').each do |node|
1343 node.name = 'a'
@@ -37,8 +67,9 @@ module Docs · 23 unmodified lines
3767
3868 # Make language specific implementation titles prettier
3969 css('.panel-title').each do |node|
40− # Remove the link, keep the text
41− node.content = node.content
70+ # Remove the link, keep the children
71+ link = node.at_css('a')
72+ link.replace(link.children) unless link.nil?
4273
4374 # Transform it into a header for better styling
4475 node.name = 'h3'
lib/docs/filters/reactivex/entries.rb+8−1
@@ -2,13 +2,20 @@ module Docs · 1 unmodified line
22 class Reactivex
33 class EntriesFilter < Docs::EntriesFilter
44 def get_name
5− at_css('h1').content
5+ title = at_css('h1').content
6+ title = title.titleize if is_backpressure_operators?
7+ title
68 end
79
810 def get_type
11+ return 'Manual' if is_backpressure_operators?
912 links = css('.breadcrumb > li:nth-child(2) > a')
1013 links.size > 0 ? links.first.content : 'Manual'
1114 end
15+
16+ def is_backpressure_operators?
17+ subpath == 'documentation/operators/backpressure.html'
18+ end
1219 end
1320 end
1421 end