File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -2,29 +2,32 @@ module Docs
22 class Bun
33 class CleanHtmlFilter < Filter
44 def call
5- @doc = at_css ( 'section > .w-full' )
5+ @doc = at_css ( '#content-area' )
6+ doc . children = css ( '#header, #content' )
67
78 header = at_css ( 'header:has(h1)' )
89 if header
910 header . content = header . at_css ( 'h1' ) . content
1011 header . name = 'h1'
1112 end
1213
13- css ( '.CodeBlockTab' ) . remove
14- css ( '.CopyIcon' ) . remove
14+ css ( '*[aria-label="Navigate to header"]' , '*[aria-label="Copy the contents from the code block"]' ) . each do |node |
15+ node . parent . remove
16+ end
17+ css ( 'img' ) . remove
1518 css ( 'svg' ) . remove
16- css ( 'a:contains("Edit on GitHub")' ) . remove
17- css ( 'a:contains("Previous")' ) . remove
18- css ( 'a:contains("Next")' ) . remove
19-
20- css ( 'pre' ) . each do |node |
19+
20+ css ( '.code-block *[data-component-part="code-block-header"]' ) . remove
21+ css ( '.code-block' , '.code-group' ) . each do |node |
22+ node . name = 'pre'
2123 node . content = node . content
2224 node [ 'data-language' ] = 'typescript'
2325 node . remove_attribute ( 'style' )
2426 end
2527
2628 css ( '.font-mono' ) . each do |node |
2729 node . name = 'code'
30+ node . content = node . content
2831 end
2932
3033 css ( '.font-mono.text-blue-600' ) . each do |node |
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ def get_type
1111 end
1212
1313 def additional_entries
14- if slug . start_with? ( 'cli' )
14+ if slug . start_with? ( 'pm/ cli' )
1515 css ( 'h2[id]' ) . each_with_object [ ] do |node , entries |
1616 name = get_name + " " + node . content . strip
1717 entries << [ name , node [ 'id' ] ]
1818 end
19- elsif slug . start_with? ( 'api ' )
19+ elsif slug . start_with? ( 'runtime ' )
2020 css ( 'h2[id]' ) . each_with_object [ ] do |node , entries |
2121 name = get_name + ": " + node . content . strip
2222 entries << [ name , node [ 'id' ] ]
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class Bun < UrlScraper
77 home : 'https://leafletjs.com/' ,
88 code : 'https://github.com/oven-sh/bun'
99 }
10- self . release = '1.3.0 '
10+ self . release = '1.3.4 '
1111 self . base_url = "https://bun.com/docs/"
1212 self . root_path = 'installation'
1313
@@ -19,14 +19,15 @@ class Bun < UrlScraper
1919 Licensed under the MIT License.
2020 HTML
2121
22- options [ :skip_patterns ] = [ /^project/ ]
22+ options [ :download_images ] = false
23+ options [ :skip_patterns ] = [ /^project/ , /^feedback/ ]
2324 options [ :fix_urls ] = -> ( url ) do
2425 url . sub! %r{.md$} , ''
2526 url
2627 end
2728
2829 def get_latest_version ( opts )
29- tags = get_github_tags ( 'oven-sh' , 'bun' , opts )
30+ get_latest_github_release ( 'oven-sh' , 'bun' , opts ) [ 5 .. ]
3031 end
3132 end
3233end
You can’t perform that action at this time.
0 commit comments