Skip to content

Commit 35c70b8

Browse files
committed
Add GCC documentation
1 parent 9951428 commit 35c70b8

15 files changed

Lines changed: 149 additions & 59 deletions

File tree

assets/images/icons.png

327 Bytes
Loading

assets/images/[email protected]

888 Bytes
Loading

assets/javascripts/news.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
[
33
"2016-04-10",
4-
"New documentations: <a href=\"/browser_support_tables/\">Support tables (caniuse.com)</a> and <a href=\"/gnu_fortran/\">GNU Fortran</a>"
4+
"New documentations: <a href=\"/browser_support_tables/\">Support tables (caniuse.com)</a>, <a href=\"/gcc/\">GCC</a> and <a href=\"/gnu_fortran/\">GNU Fortran</a>"
55
], [
66
"2016-03-27",
77
"New documentation: <a href=\"/typescript/\">TypeScript</a>"

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,16 @@ credits = [
194194
'2009-2015 TJ Holowaychuk',
195195
'MIT',
196196
'https://raw.githubusercontent.com/visionmedia/express/master/LICENSE'
197+
], [
198+
'GCC<br>GNU Fortran',
199+
'Free Software Foundation',
200+
'GFDL',
201+
'https://www.gnu.org/licenses/fdl-1.3.en.html'
197202
], [
198203
'Git',
199204
'2005-2016 Linus Torvalds and others',
200205
'GPLv2',
201206
'https://raw.githubusercontent.com/git/git/master/COPYING'
202-
], [
203-
'GNU Fortran',
204-
'Free Software Foundation',
205-
'GFDL',
206-
'https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/GNU-Free-Documentation-License.html'
207207
], [
208208
'Go',
209209
'Google, Inc.',

assets/stylesheets/global/_icons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@
135135
._icon-typescript:before { background-position: -9rem -10rem; }
136136
._icon-browser_support_tables:before { background-position: 0rem -11rem; }
137137
._icon-gnu_fortran:before { background-position: -1rem -11rem; }
138+
._icon-gcc:before { background-position: -2rem -11rem; }

assets/stylesheets/pages/_simple.scss

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

1919
._cordova,
20-
._gnu_fortran,
20+
._gnu,
2121
._grunt,
2222
._haxe,
2323
._influxdata,

lib/docs/filters/gnu_fortran/clean_html.rb renamed to lib/docs/filters/gnu/clean_html.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Docs
2-
class GnuFortran
2+
class Gnu
33
class CleanHtmlFilter < Filter
44
def call
55
heading = at_css('h1, h2, h3, h4, h5')
@@ -26,11 +26,11 @@ def call
2626
node.inner_html = node.inner_html.strip_heredoc.strip
2727
end
2828

29-
css('dt > em', 'acronym', 'dfn').each do |node|
29+
css('dt > em', 'acronym', 'dfn', 'cite').each do |node|
3030
node.before(node.children).remove
3131
end
3232

33-
css('.node', 'br').remove
33+
css('.node', 'br', 'hr').remove
3434

3535
doc
3636
end
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Docs
2-
class GnuFortran
2+
class Gnu
33
class EntriesFilter < Docs::EntriesFilter
44
TYPE_BY_CHAPTER = { }
55

@@ -9,32 +9,32 @@ def initialize(*)
99
end
1010

1111
def get_name
12-
at_css('h1').content.split(' ').drop(1).join(' ').split('—').first
12+
name = at_css('h1').content
13+
name.remove! %r{\A[\d\.]*}
14+
name.split('—').first.strip
1315
end
1416

1517
def get_type
1618
"#{chapter_number}. #{TYPE_BY_CHAPTER[chapter_number]}"
1719
end
1820

19-
def include_default_entry?
20-
!at_css('ul.menu')
21-
end
22-
2321
private
2422

2523
def detect_chapters
24+
TYPE_BY_CHAPTER.clear # YOLO
2625
css('.contents > ul > li > a').each do |node|
2726
index = node.content.strip.to_i
2827
next unless index > 0
2928
name = node.content.split(' ').drop(1).join(' ')
3029
name.remove! 'GNU Fortran '
31-
name.remove! %r{:.*}
32-
TYPE_BY_CHAPTER[index] = name # YOLO
30+
name.remove! 'with GCC'
31+
name.remove! %r{[\:\u{2013}\u{2014}].*}
32+
TYPE_BY_CHAPTER[index] = name
3333
end
3434
end
3535

3636
def chapter_number
37-
at_css('h1').content.to_i
37+
[at_css('h1').content.to_i, 1].max
3838
end
3939
end
4040
end

lib/docs/scrapers/gnu.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Docs
2+
class Gnu < FileScraper
3+
self.type = 'gnu'
4+
self.root_path = 'index.html'
5+
self.abstract = 'true'
6+
7+
html_filters.push 'gnu/clean_html', 'gnu/entries'
8+
9+
options[:skip] = %w(
10+
GNU-Project.html
11+
Service.html
12+
)
13+
14+
options[:skip_patterns] = [
15+
/Funding/,
16+
/Projects/,
17+
/Copying/,
18+
/License/,
19+
/Proposed/,
20+
/Contribut/,
21+
/Index/,
22+
/\ABug/
23+
]
24+
25+
options[:attribution] = <<-HTML
26+
&copy; Free Software Foundation<br>
27+
Licensed under the GNU Free Documentation License, Version 1.3.
28+
HTML
29+
end
30+
end

lib/docs/scrapers/gnu/gcc.rb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
module Docs
2+
class Gcc < Gnu
3+
self.name = 'GCC'
4+
self.slug = 'gcc'
5+
self.links = {
6+
home: 'https://gcc.gnu.org/'
7+
}
8+
9+
html_filters.push 'title'
10+
11+
options[:root_title] = 'Using the GNU Compiler Collection (GCC)'
12+
options[:title] = false
13+
14+
options[:replace_paths] = {
15+
'AssemblerTemplate.html' => 'Extended-Asm.html',
16+
'AVR-Named-Address-Spaces.html' => 'Named-Address-Spaces.html',
17+
'AVR-Variable-Attributes.html' => 'Variable-Attributes.html',
18+
'Clobbers.html' => 'Extended-Asm.html',
19+
'dashMF.html' => 'Preprocessor-Options.html',
20+
'GotoLabels.html' => 'Extended-Asm.html',
21+
'InputOperands.html' => 'Extended-Asm.html',
22+
'OutputOperands.html' => 'Extended-Asm.html',
23+
'PowerPC-Type-Attributes.html' => 'Type-Attributes.html',
24+
'SPU-Type-Attributes.html' => 'Type-Attributes.html',
25+
'Type_002dpunning.html' => 'Optimize-Options.html',
26+
'Volatile.html' => 'Extended-Asm.html',
27+
'Wtrigraphs.html' => 'Preprocessor-Options.html',
28+
'x86-Type-Attributes.html' => 'Type-Attributes.html',
29+
'x86-Variable-Attributes.html' => 'Variable-Attributes.html',
30+
'x86floatingpointasmoperands.html' => 'Extended-Asm.html',
31+
'x86Operandmodifiers.html' => 'Extended-Asm.html',
32+
33+
'Example-of-asm-with-clobbered-asm-reg.html' => 'Extended-Asm.html',
34+
'Extended-asm-with-goto.html' => 'Extended-Asm.html',
35+
'fdollars_002din_002didentifiers.html' => 'Preprocessor-Options.html',
36+
'i386-Type-Attributes.html' => 'Variable-Attributes.html',
37+
'i386-Variable-Attributes.html' => 'Variable-Attributes.html'
38+
}
39+
40+
CPP_PATHS = {
41+
'dashMF.html' => 'Invocation.html',
42+
'fdollars_002din_002didentifiers.html' => 'Invocation.html',
43+
'Identifier-characters.html' => 'Implementation_002ddefined-behavior.html',
44+
'trigraphs.html' => 'Initial-processing.html',
45+
'Wtrigraphs.html' => 'Invocation.html'
46+
}
47+
48+
version '5' do
49+
self.release = '5.3.0'
50+
self.dir = '/Users/Thibaut/DevDocs/Docs/gcc5'
51+
self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
52+
end
53+
54+
version '5 CPP' do
55+
self.release = '5.3.0'
56+
self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp5'
57+
self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
58+
59+
options[:root_title] = false
60+
options[:replace_paths] = CPP_PATHS
61+
end
62+
63+
version '4' do
64+
self.release = '4.9.3'
65+
self.dir = '/Users/Thibaut/DevDocs/Docs/gcc4'
66+
self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/"
67+
end
68+
69+
version '4 CPP' do
70+
self.release = '4.9.3'
71+
self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp4'
72+
self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/"
73+
74+
options[:root_title] = false
75+
options[:replace_paths] = CPP_PATHS
76+
end
77+
end
78+
end

0 commit comments

Comments
 (0)