Browse Source

Requested review changes

Suraj Yadav 1 year ago
parent
commit
775218e6af
2 changed files with 14 additions and 19 deletions
  1. 4 4
      docs/file-scrapers.md
  2. 10 15
      lib/docs/scrapers/opengl.rb

+ 4 - 4
docs/file-scrapers.md

@@ -168,10 +168,10 @@ Clone https://github.com/KhronosGroup/OpenGL-Refpages.git
 ```sh
 DEVDOCS_ROOT=/path/to/devdocs
 git clone https://github.com/KhronosGroup/OpenGL-Refpages.git
-mkdir $DEVDOCS_ROOT/docs/opengl~gl4
-mkdir $DEVDOCS_ROOT/docs/opengl~gl2.1
-cp -r OpenGL-Refpages/gl4/html/* "$DEVDOCS_ROOT/docs/opengl~gl4"
-cp -r OpenGL-Refpages/gl2.1/xhtml/* "$DEVDOCS_ROOT/docs/opengl~gl2.1"
+mkdir $DEVDOCS_ROOT/docs/opengl~4
+mkdir $DEVDOCS_ROOT/docs/opengl~2.1
+cp -r OpenGL-Refpages/gl4/html/* "$DEVDOCS_ROOT/docs/opengl~4"
+cp -r OpenGL-Refpages/gl2.1/xhtml/* "$DEVDOCS_ROOT/docs/opengl~2.1"
 ```
 
 ## OpenJDK

+ 10 - 15
lib/docs/scrapers/opengl.rb

@@ -10,25 +10,20 @@ module Docs
     # indexflat.php is a copy of index.php
     options[:skip] = %w(indexflat.php)
 
-    options[:attribution] = <<-HTML
-    Copyright 2017-2021 The Khronos Group, Inc.. This work is licensed
-    under a <a href="http://creativecommons.org/licenses/by/4.0/">Creative
-    Commons Attribution 4.0 International License</a>.
-    HTML
+    options[:attribution] = ->(filter) {
+      # copyright is the last section in these pages
+      return filter.css('.refsect1:last-child').css('p').inner_text
+    }
 
-    version 'gl2.1' do
+    version '2.1' do
       self.root_path = 'index.html'
-      self.release = 'gl2.1'
-      self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/"
+      self.release = '2.1'
+      self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/"
     end
-    version 'gl4' do
+    version '4' do
       self.root_path = 'index.php'
-      self.release = 'gl4'
-      self.base_url = "https://registry.khronos.org/OpenGL-Refpages/#{self.version}/"
-    end
-
-    def get_latest_version(opts)
-      return 'v1.0.0'
+      self.release = '4'
+      self.base_url = "https://registry.khronos.org/OpenGL-Refpages/gl#{self.version}/"
     end
   end
 end