Bladeren bron

Add GCC documentation

Thibaut Courouble 9 jaren geleden
bovenliggende
commit
35c70b86be

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2016-04-10",
-    "New documentations: <a href=\"/browser_support_tables/\">Support tables (caniuse.com)</a> and <a href=\"/gnu_fortran/\">GNU Fortran</a>"
+    "New documentations: <a href=\"/browser_support_tables/\">Support tables (caniuse.com)</a>, <a href=\"/gcc/\">GCC</a> and <a href=\"/gnu_fortran/\">GNU Fortran</a>"
   ], [
     "2016-03-27",
     "New documentation: <a href=\"/typescript/\">TypeScript</a>"

+ 5 - 5
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -194,16 +194,16 @@ credits = [
     '2009-2015 TJ Holowaychuk',
     'MIT',
     'https://raw.githubusercontent.com/visionmedia/express/master/LICENSE'
+  ], [
+    'GCC<br>GNU Fortran',
+    'Free Software Foundation',
+    'GFDL',
+    'https://www.gnu.org/licenses/fdl-1.3.en.html'
   ], [
     'Git',
     '2005-2016 Linus Torvalds and others',
     'GPLv2',
     'https://raw.githubusercontent.com/git/git/master/COPYING'
-  ], [
-    'GNU Fortran',
-    'Free Software Foundation',
-    'GFDL',
-    'https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/GNU-Free-Documentation-License.html'
   ], [
     'Go',
     'Google, Inc.',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -135,3 +135,4 @@
 ._icon-typescript:before    { background-position: -9rem -10rem; }
 ._icon-browser_support_tables:before { background-position: 0rem -11rem; }
 ._icon-gnu_fortran:before   { background-position: -1rem -11rem; }
+._icon-gcc:before           { background-position: -2rem -11rem; }

+ 1 - 1
assets/stylesheets/pages/_simple.scss

@@ -17,7 +17,7 @@
 }
 
 ._cordova,
-._gnu_fortran,
+._gnu,
 ._grunt,
 ._haxe,
 ._influxdata,

+ 3 - 3
lib/docs/filters/gnu_fortran/clean_html.rb → lib/docs/filters/gnu/clean_html.rb

@@ -1,5 +1,5 @@
 module Docs
-  class GnuFortran
+  class Gnu
     class CleanHtmlFilter < Filter
       def call
         heading = at_css('h1, h2, h3, h4, h5')
@@ -26,11 +26,11 @@ module Docs
           node.inner_html = node.inner_html.strip_heredoc.strip
         end
 
-        css('dt > em', 'acronym', 'dfn').each do |node|
+        css('dt > em', 'acronym', 'dfn', 'cite').each do |node|
           node.before(node.children).remove
         end
 
-        css('.node', 'br').remove
+        css('.node', 'br', 'hr').remove
 
         doc
       end

+ 9 - 9
lib/docs/filters/gnu_fortran/entries.rb → lib/docs/filters/gnu/entries.rb

@@ -1,5 +1,5 @@
 module Docs
-  class GnuFortran
+  class Gnu
     class EntriesFilter < Docs::EntriesFilter
       TYPE_BY_CHAPTER = { }
 
@@ -9,32 +9,32 @@ module Docs
       end
 
       def get_name
-        at_css('h1').content.split(' ').drop(1).join(' ').split('—').first
+        name = at_css('h1').content
+        name.remove! %r{\A[\d\.]*}
+        name.split('—').first.strip
       end
 
       def get_type
         "#{chapter_number}. #{TYPE_BY_CHAPTER[chapter_number]}"
       end
 
-      def include_default_entry?
-        !at_css('ul.menu')
-      end
-
       private
 
       def detect_chapters
+        TYPE_BY_CHAPTER.clear # YOLO
         css('.contents > ul > li > a').each do |node|
           index = node.content.strip.to_i
           next unless index > 0
           name = node.content.split(' ').drop(1).join(' ')
           name.remove! 'GNU Fortran '
-          name.remove! %r{:.*}
-          TYPE_BY_CHAPTER[index] = name # YOLO
+          name.remove! 'with GCC'
+          name.remove! %r{[\:\u{2013}\u{2014}].*}
+          TYPE_BY_CHAPTER[index] = name
         end
       end
 
       def chapter_number
-        at_css('h1').content.to_i
+        [at_css('h1').content.to_i, 1].max
       end
     end
   end

+ 30 - 0
lib/docs/scrapers/gnu.rb

@@ -0,0 +1,30 @@
+module Docs
+  class Gnu < FileScraper
+    self.type = 'gnu'
+    self.root_path = 'index.html'
+    self.abstract = 'true'
+
+    html_filters.push 'gnu/clean_html', 'gnu/entries'
+
+    options[:skip] = %w(
+      GNU-Project.html
+      Service.html
+    )
+
+    options[:skip_patterns] = [
+      /Funding/,
+      /Projects/,
+      /Copying/,
+      /License/,
+      /Proposed/,
+      /Contribut/,
+      /Index/,
+      /\ABug/
+    ]
+
+    options[:attribution] = <<-HTML
+      &copy; Free Software Foundation<br>
+      Licensed under the GNU Free Documentation License, Version 1.3.
+    HTML
+  end
+end

+ 78 - 0
lib/docs/scrapers/gnu/gcc.rb

@@ -0,0 +1,78 @@
+module Docs
+  class Gcc < Gnu
+    self.name = 'GCC'
+    self.slug = 'gcc'
+    self.links = {
+      home: 'https://gcc.gnu.org/'
+    }
+
+    html_filters.push 'title'
+
+    options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
+    options[:title] = false
+
+    options[:replace_paths] = {
+      'AssemblerTemplate.html' => 'Extended-Asm.html',
+      'AVR-Named-Address-Spaces.html' => 'Named-Address-Spaces.html',
+      'AVR-Variable-Attributes.html' => 'Variable-Attributes.html',
+      'Clobbers.html' => 'Extended-Asm.html',
+      'dashMF.html' => 'Preprocessor-Options.html',
+      'GotoLabels.html' => 'Extended-Asm.html',
+      'InputOperands.html' => 'Extended-Asm.html',
+      'OutputOperands.html' => 'Extended-Asm.html',
+      'PowerPC-Type-Attributes.html' => 'Type-Attributes.html',
+      'SPU-Type-Attributes.html' => 'Type-Attributes.html',
+      'Type_002dpunning.html' => 'Optimize-Options.html',
+      'Volatile.html' => 'Extended-Asm.html',
+      'Wtrigraphs.html' => 'Preprocessor-Options.html',
+      'x86-Type-Attributes.html' => 'Type-Attributes.html',
+      'x86-Variable-Attributes.html' => 'Variable-Attributes.html',
+      'x86floatingpointasmoperands.html' => 'Extended-Asm.html',
+      'x86Operandmodifiers.html' => 'Extended-Asm.html',
+
+      'Example-of-asm-with-clobbered-asm-reg.html' => 'Extended-Asm.html',
+      'Extended-asm-with-goto.html' => 'Extended-Asm.html',
+      'fdollars_002din_002didentifiers.html' => 'Preprocessor-Options.html',
+      'i386-Type-Attributes.html' => 'Variable-Attributes.html',
+      'i386-Variable-Attributes.html' => 'Variable-Attributes.html'
+    }
+
+    CPP_PATHS = {
+      'dashMF.html' => 'Invocation.html',
+      'fdollars_002din_002didentifiers.html' => 'Invocation.html',
+      'Identifier-characters.html' => 'Implementation_002ddefined-behavior.html',
+      'trigraphs.html' => 'Initial-processing.html',
+      'Wtrigraphs.html' => 'Invocation.html'
+    }
+
+    version '5' do
+      self.release = '5.3.0'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gcc5'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
+    end
+
+    version '5 CPP' do
+      self.release = '5.3.0'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp5'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
+
+      options[:root_title] = false
+      options[:replace_paths] = CPP_PATHS
+    end
+
+    version '4' do
+      self.release = '4.9.3'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gcc4'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
+    end
+
+    version '4 CPP' do
+      self.release = '4.9.3'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp4'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
+
+      options[:root_title] = false
+      options[:replace_paths] = CPP_PATHS
+    end
+  end
+end

+ 21 - 0
lib/docs/scrapers/gnu/gnu_fortran.rb

@@ -0,0 +1,21 @@
+module Docs
+  class GnuFortran < Gnu
+    self.name = 'GNU Fortran'
+    self.slug = 'gnu_fortran'
+    self.links = {
+      home: 'https://gcc.gnu.org/fortran/'
+    }
+
+    version '5' do
+      self.release = '5.3.0'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran5'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/"
+    end
+
+    version '4' do
+      self.release = '4.9.3'
+      self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran4'
+      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/"
+    end
+  end
+end

+ 0 - 40
lib/docs/scrapers/gnu_fortran.rb

@@ -1,40 +0,0 @@
-module Docs
-  class GnuFortran < FileScraper
-    self.name = 'GNU Fortran'
-    self.slug = 'gnu_fortran'
-    self.type = 'gnu_fortran'
-    self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran'
-    self.root_path = 'index.html'
-
-    self.links = {
-      home: 'https://gcc.gnu.org/fortran/'
-    }
-
-    html_filters.push 'gnu_fortran/clean_html', 'gnu_fortran/entries'
-
-    options[:skip_patterns] = [
-      /Funding/,
-      /Projects/,
-      /Copying/,
-      /License/,
-      /Proposed/,
-      /Contribut/,
-      /Index/
-    ]
-
-    options[:attribution] = <<-HTML
-      &copy; Free Software Foundation<br>
-      Licensed under the GNU Free Documentation License, Version 1.3.
-    HTML
-
-    version '5' do
-      self.release = '5.3.0'
-      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/"
-    end
-
-    version '4' do
-      self.release = '4.9.3'
-      self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/"
-    end
-  end
-end

BIN
public/icons/docs/gcc/16.png


BIN
public/icons/docs/gcc/16@2x.png


BIN
public/icons/docs/gcc/GCC.png