Browse Source

Merge pull request #1070 from simon04/gcc

gcc: add versions 8 and 9; enable syntax highlighting
Jasper van Merle 6 years ago
parent
commit
ec252ca6a4
2 changed files with 40 additions and 3 deletions
  1. 13 0
      lib/docs/filters/gcc/clean_html.rb
  2. 27 3
      lib/docs/scrapers/gnu/gcc.rb

+ 13 - 0
lib/docs/filters/gcc/clean_html.rb

@@ -0,0 +1,13 @@
+module Docs
+  class Gcc
+    class CleanHtmlFilter < Filter
+      def call
+        css('pre').each do |node|
+          node['data-language'] = 'cpp'
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 27 - 3
lib/docs/scrapers/gnu/gcc.rb

@@ -6,7 +6,7 @@ module Docs
       home: 'https://gcc.gnu.org/'
     }
 
-    html_filters.push 'title'
+    html_filters.push 'gcc/clean_html', 'title'
 
     options[:root_title] = false
     options[:title] = false
@@ -46,13 +46,37 @@ module Docs
       'Wtrigraphs.html' => 'Invocation.html'
     }
 
+    version '9' do
+      self.release = '9.2.0'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
+    end
+
+    version '9 CPP' do
+      self.release = '9.2.0'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
+
+      options[:replace_paths] = CPP_PATHS
+    end
+
+    version '8' do
+      self.release = '8.3.0'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
+    end
+
+    version '8 CPP' do
+      self.release = '8.3.0'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
+
+      options[:replace_paths] = CPP_PATHS
+    end
+
     version '7' do
-      self.release = '7.3.0'
+      self.release = '7.4.0'
       self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
     end
 
     version '7 CPP' do
-      self.release = '7.3.0'
+      self.release = '7.4.0'
       self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
 
       options[:replace_paths] = CPP_PATHS