From ddb83df8ec5d7c95ec390307029c1d646bacee32 Mon Sep 17 00:00:00 2001 From: Mathis Chenuet <9201969+artemisart@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:05:21 +0100 Subject: [PATCH 1/3] Update and add missing pytorch versions --- .github/CONTRIBUTING.md | 2 +- lib/docs/scrapers/pytorch.rb | 81 ++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2922dcf0..f474cb3a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -64,7 +64,7 @@ If the latest [documentation versions report](https://github.com/freeCodeCamp/de Follow the following steps to update documentations to their latest version: 1. Make version/release changes in the scraper file. -2. Check if the license is still correct. If you update `options[:attribution]`, also update the documentation's entry in the array in [`assets/javascripts/templates/pages/about_tmpl.coffee`](../assets/javascripts/templates/pages/about_tmpl.coffee) to match. +2. Check if the license is still correct. If you update `options[:attribution]`, also update the documentation's entry in the array in [`assets/javascripts/templates/pages/about_tmpl.js`](../assets/javascripts/templates/pages/about_tmpl.js) to match. 3. If the documentation has a custom icon, ensure the icons in public/icons/*your_scraper_name*/ are up-to-date. If you pull the updated icon from a place different than the one specified in the `SOURCE` file, make sure to replace the old link with the new one. 4. If `self.links` is defined, check if the urls are still correct. 5. If the scraper inherits from `FileScraper` rather than `URLScraper`, follow the instructions for that scraper in [`file-scrapers.md`](../docs/file-scrapers.md) to obtain the source material for the scraper. diff --git a/lib/docs/scrapers/pytorch.rb b/lib/docs/scrapers/pytorch.rb index 927d0be3..d3329d06 100644 --- a/lib/docs/scrapers/pytorch.rb +++ b/lib/docs/scrapers/pytorch.rb @@ -16,12 +16,87 @@ module Docs options[:max_image_size] = 256_000 options[:attribution] = <<-HTML - © 2019 Torch Contributors
+ © 2019-2024 Torch Contributors
Licensed under the 3-clause BSD License. HTML - version do - self.release = '1.8.0' + version '2.1' do + self.release = '2.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '2.0' do + self.release = '2.0' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.13' do + self.release = '1.13' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.12' do + self.release = '1.12' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.11' do + self.release = '1.11' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.10' do + self.release = '1.10' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.9' do + self.release = '1.9.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.8' do + self.release = '1.8.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.7' do + self.release = '1.7.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.6' do + self.release = '1.6.0' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.5' do + self.release = '1.5.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.4' do + self.release = '1.4.0' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.3' do + self.release = '1.3.1' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.2' do + self.release = '1.2.0' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.1' do + self.release = '1.1.0' + self.base_url = "https://pytorch.org/docs/#{release}/" + end + + version '1.0' do + self.release = '1.0.1' self.base_url = "https://pytorch.org/docs/#{release}/" end From 15cafae60d87e64f2e5cb45b8ce82ed2beee2672 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 14 Jan 2024 16:15:36 +0100 Subject: [PATCH 2/3] docs: options[:attribution] has replaced about_tmpl --- .github/CONTRIBUTING.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- docs/adding-docs.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f474cb3a..fc0dac2e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -64,7 +64,7 @@ If the latest [documentation versions report](https://github.com/freeCodeCamp/de Follow the following steps to update documentations to their latest version: 1. Make version/release changes in the scraper file. -2. Check if the license is still correct. If you update `options[:attribution]`, also update the documentation's entry in the array in [`assets/javascripts/templates/pages/about_tmpl.js`](../assets/javascripts/templates/pages/about_tmpl.js) to match. +2. Check if the license is still correct. Update `options[:attribution]` if needed. 3. If the documentation has a custom icon, ensure the icons in public/icons/*your_scraper_name*/ are up-to-date. If you pull the updated icon from a place different than the one specified in the `SOURCE` file, make sure to replace the old link with the new one. 4. If `self.links` is defined, check if the urls are still correct. 5. If the scraper inherits from `FileScraper` rather than `URLScraper`, follow the instructions for that scraper in [`file-scrapers.md`](../docs/file-scrapers.md) to obtain the source material for the scraper. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c93bfc45..029babb2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -22,7 +22,7 @@ If you’re adding a new scraper, please ensure that you have: If you're updating existing documentation to its latest version, please ensure that you have: - [ ] Updated the versions and releases in the scraper file -- [ ] Ensured the license is up-to-date and that the documentation's entry in the array in `about_tmpl.coffee` matches its data in `self.attribution` +- [ ] Ensured the license is up-to-date - [ ] Ensured the icons and the `SOURCE` file in public/icons/*your_scraper_name*/ are up-to-date if the documentation has a custom icon - [ ] Ensured `self.links` contains up-to-date urls if `self.links` is defined - [ ] Tested the changes locally to ensure: diff --git a/docs/adding-docs.md b/docs/adding-docs.md index cf543fcc..971b91be 100644 --- a/docs/adding-docs.md +++ b/docs/adding-docs.md @@ -16,7 +16,7 @@ Adding a documentation may look like a daunting task but once you get the hang o 9. To customize the pages' styling, create an SCSS file in the `assets/stylesheets/pages/` directory and import it in both `application.css.scss` AND `application-dark.css.scss`. Both the file and CSS class should be named `_[type]` where [type] is equal to the scraper's `type` attribute (documentations with the same type share the same custom CSS and JS). Setting the type to `simple` will apply the general styling rules in `assets/stylesheets/pages/_simple.scss`, which can be used for documentations where little to no CSS changes are needed. 10. To add syntax highlighting or execute custom JavaScript on the pages, create a file in the `assets/javascripts/views/pages/` directory (take a look at the other files to see how it works). 11. Add the documentation's icon in the `public/icons/docs/[my_doc]/` directory, in both 16x16 and 32x32-pixels formats. The icon spritesheet is automatically generated when you (re)start your local DevDocs instance. -12. Add the documentation's copyright details to the list in `assets/javascripts/templates/pages/about_tmpl.coffee`. This is the data shown in the table on the [about](https://devdocs.io/about) page, and is ordered alphabetically. Simply copying an existing item, placing it in the right slot and updating the values to match the new scraper will do the job. +12. Add the documentation's copyright details to `options[:attribution]`. This is the data shown in the table on the [about](https://devdocs.io/about) page, and is ordered alphabetically. Please see an existing scraper for the typesetting. 13. Ensure `thor updates:check [my_doc]` shows the correct latest version. If the documentation includes more than a few hundreds pages and is available for download, try to scrape it locally (e.g. using `FileScraper`). It'll make the development process much faster and avoids putting too much load on the source site. (It's not a problem if your scraper is coupled to your local setup, just explain how it works in your pull request.) From 3789d0b52307bee6b93699da89b29f137b88006c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 14 Jan 2024 16:20:49 +0100 Subject: [PATCH 3/3] pytorch: keep latest version 1 and latest version 2 --- lib/docs/filters/pytorch/entries.rb | 2 +- lib/docs/scrapers/pytorch.rb | 74 +---------------------------- 2 files changed, 3 insertions(+), 73 deletions(-) diff --git a/lib/docs/filters/pytorch/entries.rb b/lib/docs/filters/pytorch/entries.rb index 8a019b14..4b8d153e 100644 --- a/lib/docs/filters/pytorch/entries.rb +++ b/lib/docs/filters/pytorch/entries.rb @@ -13,7 +13,7 @@ module Docs # The id of the container `div.section` indicates the page type. # If the id starts with `module-`, then it's an API reference, # otherwise it is a note or design doc. - section_id = at_css('.section')['id'] + section_id = at_css('.section[id], section[id]')['id'] if section_id.starts_with? 'module-' section_id.remove('module-') else diff --git a/lib/docs/scrapers/pytorch.rb b/lib/docs/scrapers/pytorch.rb index d3329d06..a6d9ea82 100644 --- a/lib/docs/scrapers/pytorch.rb +++ b/lib/docs/scrapers/pytorch.rb @@ -20,86 +20,16 @@ module Docs Licensed under the 3-clause BSD License. HTML - version '2.1' do + version '2' do self.release = '2.1' self.base_url = "https://pytorch.org/docs/#{release}/" end - version '2.0' do - self.release = '2.0' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.13' do + version '1' do self.release = '1.13' self.base_url = "https://pytorch.org/docs/#{release}/" end - version '1.12' do - self.release = '1.12' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.11' do - self.release = '1.11' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.10' do - self.release = '1.10' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.9' do - self.release = '1.9.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.8' do - self.release = '1.8.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.7' do - self.release = '1.7.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.6' do - self.release = '1.6.0' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.5' do - self.release = '1.5.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.4' do - self.release = '1.4.0' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.3' do - self.release = '1.3.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.2' do - self.release = '1.2.0' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.1' do - self.release = '1.1.0' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - - version '1.0' do - self.release = '1.0.1' - self.base_url = "https://pytorch.org/docs/#{release}/" - end - def get_latest_version(opts) get_latest_github_release('pytorch', 'pytorch', opts) end