Skip to content

Commit 56d9398

Browse files
Phil SchererThibaut
authored andcommitted
Add Fortran documentation
1 parent f7a381c commit 56d9398

6 files changed

Lines changed: 86 additions & 0 deletions

File tree

assets/stylesheets/pages/_base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818

1919
._cordova,
20+
._fortran,
2021
._grunt,
2122
._haxe,
2223
._influxdata,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Docs
2+
class Fortran
3+
class CleanHtmlFilter < Filter
4+
def call
5+
css('h2', 'h3', 'h4').each do |node|
6+
node.name = 'h1'
7+
end
8+
9+
# Move page anchor to page title
10+
at_css('h1')['id'] = at_css('.node > a')['name']
11+
12+
css('.node', 'br').remove
13+
14+
doc
15+
end
16+
end
17+
end
18+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module Docs
2+
class Fortran
3+
class EntriesFilter < Docs::EntriesFilter
4+
REPLACE_TYPES = {
5+
1 => 'Introduction',
6+
2 => 'GNU Fortran Command Options',
7+
3 => 'Runtime Environment Variables',
8+
4 => 'Fortran 2003 and 2008 Status',
9+
5 => 'Compiler Characteristics',
10+
6 => 'Extensions',
11+
7 => 'Mixed Language Programming',
12+
8 => 'Coarray Programming',
13+
9 => 'Intrinsic Procedures',
14+
10 => 'Intrinsic Modules' }
15+
16+
def chapter_number
17+
at_css('h1').content.to_i
18+
end
19+
20+
def include_default_entry?
21+
REPLACE_TYPES[chapter_number] and not at_css('ul.menu')
22+
end
23+
24+
def get_name
25+
at_css('h1').content.split(' ').drop(1).join(' ').split('—').first
26+
end
27+
28+
def get_type
29+
REPLACE_TYPES[chapter_number]
30+
end
31+
32+
end
33+
end
34+
end

lib/docs/scrapers/fortran.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module Docs
2+
class Fortran < FileScraper
3+
self.name = 'GNU Fortran'
4+
self.slug = 'fortran'
5+
self.type = 'fortran'
6+
self.release = '5.3.0'
7+
self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/"
8+
self.dir = ''
9+
self.root_path = 'index.html'
10+
11+
self.links = {
12+
home: 'https://gcc.gnu.org/fortran/'
13+
}
14+
15+
html_filters.push 'fortran/clean_html', 'fortran/entries'
16+
17+
options[:skip_patterns] = [
18+
/Funding/,
19+
/Projects/,
20+
/Copying/,
21+
/License/,
22+
/Proposed/,
23+
/Contribut/,
24+
/Index/
25+
]
26+
27+
options[:attribution] = <<-HTML
28+
&copy; Free Software Foundation<br>
29+
Licensed under the GNU Free Documentation License version 1.3.
30+
HTML
31+
end
32+
end

public/icons/docs/fortran/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://commons.wikimedia.org/wiki/File:Fortran.png
2.1 KB
Loading

0 commit comments

Comments
 (0)