Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 110 KiB |
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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<br>
|
||||
Licensed under the GNU Free Documentation License version 1.3.
|
||||
HTML
|
||||
end
|
||||
end
|
@ -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<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
|
Before Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 656 B |
After Width: | Height: | Size: 1.5 KiB |