diff --git a/assets/images/icons.png b/assets/images/icons.png index 7a40ea86..213a9dc7 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 36d0fbc8..d104bed8 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 19c6de6c..ca9705d8 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,13 +1,13 @@ [ [ "2016-04-10", - "New documentation: Support tables (caniuse.com)" + "New documentations: Support tables (caniuse.com) and GNU Fortran" ], [ "2016-03-27", "New documentation: TypeScript" ], [ "2016-03-06", - "New documentation: TensorFlow, Haxe and Ansible" + "New documentations: TensorFlow, Haxe and Ansible" ], [ "2016-02-28", "New documentations: CodeIgniter, nginx Lua Module and InfluxData" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index a83f7945..c493c04e 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -199,6 +199,11 @@ credits = [ '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.', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 584c260a..2445cd1b 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -134,3 +134,4 @@ ._icon-ansible:before { background-position: -8rem -10rem; @extend %darkIconFix !optional; } ._icon-typescript:before { background-position: -9rem -10rem; } ._icon-browser_support_tables:before { background-position: 0rem -11rem; } +._icon-gnu_fortran:before { background-position: -1rem -11rem; } diff --git a/assets/stylesheets/pages/_base.scss b/assets/stylesheets/pages/_base.scss index 632d4e58..bf2f4bc8 100644 --- a/assets/stylesheets/pages/_base.scss +++ b/assets/stylesheets/pages/_base.scss @@ -17,7 +17,7 @@ } ._cordova, -._fortran, +._gnu_fortran, ._grunt, ._haxe, ._influxdata, diff --git a/lib/docs/filters/fortran/clean_html.rb b/lib/docs/filters/fortran/clean_html.rb deleted file mode 100644 index b3a89f01..00000000 --- a/lib/docs/filters/fortran/clean_html.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Docs - class Fortran - class CleanHtmlFilter < Filter - def call - css('h2', 'h3', 'h4').each do |node| - node.name = 'h1' - end - - # Move page anchor to page title - at_css('h1')['id'] = at_css('.node > a')['name'] - - css('.node', 'br').remove - - doc - end - end - end -end diff --git a/lib/docs/filters/fortran/entries.rb b/lib/docs/filters/fortran/entries.rb deleted file mode 100644 index c9f0cb70..00000000 --- a/lib/docs/filters/fortran/entries.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Docs - class Fortran - class EntriesFilter < Docs::EntriesFilter - REPLACE_TYPES = { - 1 => 'Introduction', - 2 => 'GNU Fortran Command Options', - 3 => 'Runtime Environment Variables', - 4 => 'Fortran 2003 and 2008 Status', - 5 => 'Compiler Characteristics', - 6 => 'Extensions', - 7 => 'Mixed Language Programming', - 8 => 'Coarray Programming', - 9 => 'Intrinsic Procedures', - 10 => 'Intrinsic Modules' } - - def chapter_number - at_css('h1').content.to_i - end - - def include_default_entry? - REPLACE_TYPES[chapter_number] and not at_css('ul.menu') - end - - def get_name - at_css('h1').content.split(' ').drop(1).join(' ').split('—').first - end - - def get_type - REPLACE_TYPES[chapter_number] - end - - end - end -end diff --git a/lib/docs/filters/gnu_fortran/clean_html.rb b/lib/docs/filters/gnu_fortran/clean_html.rb new file mode 100644 index 00000000..c14eca21 --- /dev/null +++ b/lib/docs/filters/gnu_fortran/clean_html.rb @@ -0,0 +1,39 @@ +module Docs + class GnuFortran + class CleanHtmlFilter < Filter + def call + heading = at_css('h1, h2, h3, h4, h5') + heading_level = heading.name[/h(\d)/, 1].to_i + + css('h2, h3, h4, h5, h6').each do |node| + node.name = node.name.sub(/\d/) { |i| i.to_i - (heading_level - 1) } + end + + css('.node > a[name]').each do |node| + node.parent.next_element['id'] = node['name'] + end + + css('a[name]').each do |node| + node['id'] = node['name'] + end + + css('samp > span:first-child:last-child').each do |node| + node.parent.name = 'code' + node.before(node.children).remove + end + + css('pre').each do |node| + node.inner_html = node.inner_html.strip_heredoc.strip + end + + css('dt > em', 'acronym', 'dfn').each do |node| + node.before(node.children).remove + end + + css('.node', 'br').remove + + doc + end + end + end +end diff --git a/lib/docs/filters/gnu_fortran/entries.rb b/lib/docs/filters/gnu_fortran/entries.rb new file mode 100644 index 00000000..a5388671 --- /dev/null +++ b/lib/docs/filters/gnu_fortran/entries.rb @@ -0,0 +1,41 @@ +module Docs + class GnuFortran + class EntriesFilter < Docs::EntriesFilter + TYPE_BY_CHAPTER = { } + + def initialize(*) + super + detect_chapters if root_page? + end + + def get_name + at_css('h1').content.split(' ').drop(1).join(' ').split('—').first + 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 + 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 + end + end + + def chapter_number + at_css('h1').content.to_i + end + end + end +end diff --git a/lib/docs/scrapers/fortran.rb b/lib/docs/scrapers/fortran.rb deleted file mode 100644 index 4950769d..00000000 --- a/lib/docs/scrapers/fortran.rb +++ /dev/null @@ -1,32 +0,0 @@ -module Docs - class Fortran < FileScraper - self.name = 'GNU Fortran' - self.slug = 'fortran' - self.type = 'fortran' - self.release = '5.3.0' - self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" - self.dir = '' - self.root_path = 'index.html' - - self.links = { - home: 'https://gcc.gnu.org/fortran/' - } - - html_filters.push 'fortran/clean_html', 'fortran/entries' - - options[:skip_patterns] = [ - /Funding/, - /Projects/, - /Copying/, - /License/, - /Proposed/, - /Contribut/, - /Index/ - ] - - options[:attribution] = <<-HTML - © Free Software Foundation
- Licensed under the GNU Free Documentation License version 1.3. - HTML - end -end diff --git a/lib/docs/scrapers/gnu_fortran.rb b/lib/docs/scrapers/gnu_fortran.rb new file mode 100644 index 00000000..90b17077 --- /dev/null +++ b/lib/docs/scrapers/gnu_fortran.rb @@ -0,0 +1,40 @@ +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 + © Free Software Foundation
+ 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 diff --git a/public/icons/docs/fortran/fortran.png b/public/icons/docs/fortran/fortran.png deleted file mode 100644 index ebe9ec88..00000000 Binary files a/public/icons/docs/fortran/fortran.png and /dev/null differ diff --git a/public/icons/docs/gnu_fortran/16.png b/public/icons/docs/gnu_fortran/16.png new file mode 100644 index 00000000..74001ea4 Binary files /dev/null and b/public/icons/docs/gnu_fortran/16.png differ diff --git a/public/icons/docs/gnu_fortran/16@2x.png b/public/icons/docs/gnu_fortran/16@2x.png new file mode 100644 index 00000000..f8d404d3 Binary files /dev/null and b/public/icons/docs/gnu_fortran/16@2x.png differ diff --git a/public/icons/docs/fortran/SOURCE b/public/icons/docs/gnu_fortran/SOURCE similarity index 100% rename from public/icons/docs/fortran/SOURCE rename to public/icons/docs/gnu_fortran/SOURCE diff --git a/public/icons/docs/gnu_fortran/fortran.png b/public/icons/docs/gnu_fortran/fortran.png new file mode 100644 index 00000000..efded3ac Binary files /dev/null and b/public/icons/docs/gnu_fortran/fortran.png differ