From 56d9398148ee71fb018a5eec0ba0db8f3a795c65 Mon Sep 17 00:00:00 2001 From: Phil Scherer Date: Fri, 1 Apr 2016 18:05:04 -0400 Subject: [PATCH] Add Fortran documentation --- assets/stylesheets/pages/_base.scss | 1 + lib/docs/filters/fortran/clean_html.rb | 18 +++++++++++++ lib/docs/filters/fortran/entries.rb | 34 +++++++++++++++++++++++++ lib/docs/scrapers/fortran.rb | 32 +++++++++++++++++++++++ public/icons/docs/fortran/SOURCE | 1 + public/icons/docs/fortran/fortran.png | Bin 0 -> 2148 bytes 6 files changed, 86 insertions(+) create mode 100644 lib/docs/filters/fortran/clean_html.rb create mode 100644 lib/docs/filters/fortran/entries.rb create mode 100644 lib/docs/scrapers/fortran.rb create mode 100644 public/icons/docs/fortran/SOURCE create mode 100644 public/icons/docs/fortran/fortran.png 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 0000000000000000000000000000000000000000..ebe9ec8880ca8529e647ce956ee90d109637e3b2 GIT binary patch literal 2148 zcmZuzc~FyC692xBL~c+B5;=w=uqG&%A|e|JU@#F3B;ist%DEh47BGOIfI%XMoJv6P z2$110G7?0|a0|j15eE=lPPs%mLtA(ubt>7JpeUyy z2LOQL2_l{<(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