@@ -3,25 +3,22 @@ class Rust
33 class EntriesFilter < Docs ::EntriesFilter
44
55 def get_name
6- if slug . start_with? ( 'book' )
7- name = at_css ( 'main h1' , 'main h2' )
8-
9- if slug . start_with? ( 'book/appendix' )
10- return name ? name . content : 'Appendix'
11- end
12-
6+ name = at_css ( 'main h1' , 'main h2' , '.main-heading h1' )
7+ if slug . start_with? ( 'book/appendix' )
8+ name ? name . content : 'Appendix'
9+ elsif slug . start_with? ( 'book' )
1310 ch1 = slug [ /ch(\d +)-(\d +)/ , 1 ] || '00'
1411 ch2 = slug [ /ch(\d +)-(\d +)/ , 2 ] || '00'
1512 name ? "#{ ch1 } .#{ ch2 } . #{ name . content } " : 'Introduction'
1613 elsif slug . start_with? ( 'reference' )
17- at_css ( 'main h1' ) . content
14+ name . content
1815 elsif slug == 'error_codes/error-index'
1916 'Compiler Errors'
2017 elsif slug . start_with? ( 'error_codes' )
2118 slug . split ( '/' ) . last . upcase
2219 else
23- at_css ( 'main h1' ) . at_css ( 'button' ) &.remove
24- name = at_css ( 'main h1' ) . content . remove ( /\A .+\s / ) . remove ( '⎘' )
20+ name . at_css ( 'button' ) &.remove
21+ name = name . content . strip . remove ( /\A .+\s / )
2522 path = slug . split ( '/' )
2623 if path . length == 2
2724 # Anything in the standard library but not in a `std::*` module is
0 commit comments