diff --git a/assets/stylesheets/pages/_base.scss b/assets/stylesheets/pages/_base.scss index 7e813832..632d4e58 100644 --- a/assets/stylesheets/pages/_base.scss +++ b/assets/stylesheets/pages/_base.scss @@ -17,6 +17,7 @@ } ._cordova, +._fortran, ._grunt, ._haxe, ._influxdata, diff --git a/lib/docs/filters/fortran/clean_html.rb b/lib/docs/filters/fortran/clean_html.rb new file mode 100644 index 00000000..b3a89f01 --- /dev/null +++ b/lib/docs/filters/fortran/clean_html.rb @@ -0,0 +1,18 @@ +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 new file mode 100644 index 00000000..c9f0cb70 --- /dev/null +++ b/lib/docs/filters/fortran/entries.rb @@ -0,0 +1,34 @@ +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/scrapers/fortran.rb b/lib/docs/scrapers/fortran.rb new file mode 100644 index 00000000..4950769d --- /dev/null +++ b/lib/docs/scrapers/fortran.rb @@ -0,0 +1,32 @@ +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/public/icons/docs/fortran/SOURCE b/public/icons/docs/fortran/SOURCE new file mode 100644 index 00000000..2d711c0c --- /dev/null +++ b/public/icons/docs/fortran/SOURCE @@ -0,0 +1 @@ +https://commons.wikimedia.org/wiki/File:Fortran.png diff --git a/public/icons/docs/fortran/fortran.png b/public/icons/docs/fortran/fortran.png new file mode 100644 index 00000000..ebe9ec88 Binary files /dev/null and b/public/icons/docs/fortran/fortran.png differ