Update Deno documentation scraper - #2681
Conversation
Ensure consistent line endings and proper diff handling for text and binary files.
Add a new UrlScraper for Deno standard library and runtime documentation (lib/docs/scrapers/deno.rb) with: - Deno docs site scraping (docs.deno.com) - Page parsing with Nokogiri (main/article content extraction) - Link resolution (relative to absolute URL conversion) - Version handling with semver normalization (v2 and v1 support) - Module categorization (Web APIs, I/O, File System, Network, etc.) - Code example extraction with language detection - HTML filter pipeline (clean_html and entries filters) Also includes: - Minitest test class for scraper configuration validation - Bug fix: replace File.open(path).read with File.read(path) in sprites.thor to prevent unclosed file handle leak Signed-off-by: Srikanth Patchava <spatchava@meta.com>
|
Thanks for the review and the screenshots @simon04! You're right that the output needs refinement. From the screenshots I can see a few issues to address:
I'll iterate on the |
Remove source-site navigation and controls that leaked into generated API and runtime pages, while preserving the source language metadata DevDocs uses for syntax highlighting. Add representative regression fixtures for the reviewer-reported page shapes. Test Plan: - Ran the focused Deno suite: 17 runs, 73 assertions, 0 failures. - Ran the remaining Ruby suite excluding two independently failing Windows-only baseline files: 665 runs, 927 assertions, 0 failures. - Compared old and new filters on current Network and @std/fmt source pages; all measured chrome counts dropped to zero while TypeScript, JavaScript, and shell language metadata was preserved. - Ran Ruby syntax checks and git diff --check.
|
@simon04 I pushed d17aafb to address the requested scraper fine-tuning without waiting for the missing source URL. I matched the screenshots to the current pages and validated the previous vs updated filter on both:
The filter now scopes output to Validation:
Re-review is requested because the two issues identified from the screenshots are now covered directly. |
There was a problem hiding this comment.
🟡 Changes recommended
The v1 URL configuration is invalid, API symbols are omitted from the index, and version and styling metadata regress.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates the Deno scraper for the current documentation layout, adds fixtures and tests, and configures line-ending normalization.
Changes:
- Expands Deno crawling, filtering, and version configuration.
- Adds scraper and HTML-cleaning tests with fixtures.
- Adds
.gitattributesand simplifies file reading in the sprite task.
File summaries
| File | Description |
|---|---|
.gitattributes |
Defines text normalization and binary-file handling. |
lib/docs/scrapers/deno.rb |
Reconfigures Deno scraping and versions. |
lib/docs/filters/deno/entries.rb |
Updates entry names and categories. |
lib/docs/filters/deno/clean_html.rb |
Handles the current page structure. |
lib/tasks/sprites.thor |
Uses File.read for ERB input. |
test/lib/docs/scrapers/deno_test.rb |
Adds Deno scraper and filter tests. |
test/files/deno_api.html |
Adds an API-page fixture. |
test/files/deno_runtime.html |
Adds a runtime-page fixture. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| version '1' do | ||
| self.release = '1.27.0' | ||
| self.release = '1.46.3' | ||
| self.base_url = 'https://docs.deno.com/api/' | ||
| end |
| def get_name | ||
| if result[:path].start_with?('api/deno/') | ||
| at_css('main[id!="content"]')['id'][/\Asymbol_([.\w]+)/, 1] | ||
| else | ||
| at_css('main article h1').content | ||
| end | ||
| name = at_css('h1') | ||
| name ? name.content.strip : slug.split('/').last |
| class Deno < UrlScraper | ||
| self.name = 'Deno' | ||
| self.type = 'simple' | ||
| self.type = 'deno' |
| /\Aapi\/deno\/~\/Deno\.OpMetrics/, # deprecated in deno 2 | ||
| ] | ||
| options[:trailing_slash] = false | ||
| self.release = '2.3.1' |
|
|
||
| # https://github.com/denoland/manual/blob/main/LICENSE | ||
| # https://github.com/denoland/deno/blob/main/LICENSE.md | ||
| html_filters.push 'deno/clean_html', 'deno/entries' |
| def parse_page(response) | ||
| doc = Nokogiri::HTML.parse(response.body) | ||
| return nil if doc.at_css('meta[http-equiv="refresh"]') | ||
|
|
||
| content = doc.at_css('main, article, [role="main"], .markdown-body') |


No description provided.