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
8 figure {8 figure {
9 margin: 0;9 margin: 0;
10 }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: "…";
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 }
11}51}
lib/docs/filters/reactivex/clean_html.rb+33−2
@@ -8,6 +8,36 @@ module Docs · 7 unmodified lines
8 # Remove breadcrumbs8 # Remove breadcrumbs
9 css('.breadcrumb').remove9 css('.breadcrumb').remove
10 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
11 # Replace interactive demo's with links to them41 # Replace interactive demo's with links to them
12 css('rx-marbles').each do |node|42 css('rx-marbles').each do |node|
13 node.name = 'a'43 node.name = 'a'
@@ -37,8 +67,9 @@ module Docs · 23 unmodified lines
37 67
38 # Make language specific implementation titles prettier68 # Make language specific implementation titles prettier
39 css('.panel-title').each do |node|69 css('.panel-title').each do |node|
40 # Remove the link, keep the text70 # Remove the link, keep the children
41 node.content = node.content71 link = node.at_css('a')
72 link.replace(link.children) unless link.nil?
42 73
43 # Transform it into a header for better styling74 # Transform it into a header for better styling
44 node.name = 'h3'75 node.name = 'h3'
lib/docs/filters/reactivex/entries.rb+8−1
@@ -2,13 +2,20 @@ module Docs · 1 unmodified line
2 class Reactivex2 class Reactivex
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 at_css('h1').content5 title = at_css('h1').content
6 title = title.titleize if is_backpressure_operators?
7 title
6 end8 end
7 9
8 def get_type10 def get_type
11 return 'Manual' if is_backpressure_operators?
9 links = css('.breadcrumb > li:nth-child(2) > a')12 links = css('.breadcrumb > li:nth-child(2) > a')
10 links.size > 0 ? links.first.content : 'Manual'13 links.size > 0 ? links.first.content : 'Manual'
11 end14 end
15
16 def is_backpressure_operators?
17 subpath == 'documentation/operators/backpressure.html'
18 end
12 end19 end
13 end20 end
14end21end