File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,8 +3,20 @@ class Homebrew
33 class EntriesFilter < Docs ::EntriesFilter
44 def get_name
55 header = at_css ( 'h1' )
6- name = header . nil? ? current_url . normalized_path [ 1 ..-1 ] . gsub ( /-/ , ' ' ) : header . content . strip
7- name . remove! %r{\( .*}
6+
7+ if current_url . path . start_with? ( '/rubydoc' )
8+ # Titles in rubydoc content follow a different format, with a bit of cleanup needed.
9+ name = header
10+ . content
11+ . gsub ( 'Class: ' , '' )
12+ . gsub ( 'Module: ' , '' )
13+ . gsub ( 'Exception: ' , '' )
14+ . gsub ( ' Private' , '' )
15+ else
16+ name = header . nil? ? current_url . normalized_path [ 1 ..-1 ] . gsub ( /-/ , ' ' ) : header . content . strip
17+ name . remove! %r{\( .*}
18+ end
19+
820 name
921 end
1022
@@ -26,13 +38,21 @@ def get_name
2638 Building-Against-Non-Homebrew-Dependencies
2739 How-to-Create-and-Maintain-a-Tap
2840 Brew-Test-Bot
29- Prose-Style-Guidelines
3041 Typechecking
3142 Reproducible-Builds
3243 )
3344
3445 def get_type
35- if CONTRIBUTOR_SLUGS . include? ( slug )
46+ if current_url . path . start_with? ( '/rubydoc' )
47+ header = at_css ( 'h1' ) . content
48+ if header . start_with? ( 'Module' )
49+ 'API Modules'
50+ elsif header . start_with? ( 'Class' )
51+ 'API Classes'
52+ else
53+ 'API Exceptions'
54+ end
55+ elsif CONTRIBUTOR_SLUGS . include? ( slug )
3656 'Contributors'
3757 else
3858 'Users'
Original file line number Diff line number Diff line change 11module Docs
22 class Homebrew < UrlScraper
3+ # include MultipleBaseUrls
4+
35 self . name = 'Homebrew'
46 self . type = 'simple'
5- self . release = '4.6.15 '
7+ self . release = '6.0.3 '
68 self . base_url = 'https://docs.brew.sh/'
79 self . links = {
810 home : 'https://brew.sh' ,
@@ -11,9 +13,29 @@ class Homebrew < UrlScraper
1113
1214 html_filters . push 'homebrew/entries' , 'homebrew/clean_html'
1315
14- options [ :container ] = -> ( filter ) { filter . root_page? ? '#home' : '#page' }
16+ options [ :container ] = -> ( filter ) do
17+ if filter . current_url . path . include? ( 'rubydoc' )
18+ '#content'
19+ else
20+ '#default'
21+ end
22+ end
1523
16- options [ :skip_patterns ] = [ /maintainer/i , /core\- contributor/i , /kickstarter/i , /governance/i ]
24+ # Mostly handbook articles with no code.
25+ options [ :skip_patterns ] = [
26+ /maintainer/i ,
27+ /core\- contributor/i ,
28+ /kickstarter/i ,
29+ /governance/i ,
30+ /responsible/i ,
31+ /leadership/i ,
32+ /prose/i ,
33+ /expense/i ,
34+ /creating-a-homebrew-issue/i ,
35+ /homebrew-and-java/i ,
36+ /checksum_deprecation/i ,
37+ /Working-with/i
38+ ]
1739
1840 options [ :attribution ] = <<-HTML
1941 © 2009–present Homebrew contributors< br >
You can’t perform that action at this time.
0 commit comments