Skip to content

Commit ad9e7a6

Browse files
committed
Add Octave Documentation
1 parent 85d591e commit ad9e7a6

File tree

8 files changed

+114
-0
lines changed

8 files changed

+114
-0
lines changed

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
'pages/nginx',
7676
'pages/node',
7777
'pages/npm',
78+
'pages/octave',
7879
'pages/openjdk',
7980
'pages/perl',
8081
'pages/phalcon',

assets/stylesheets/pages/_octave.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
._octave {
2+
@extend %simple;
3+
4+
dl:not([compact]) > dt { @extend %block-label, %label-blue; }
5+
6+
dl[compact] > dt { @extend %block-label; }
7+
8+
.footnotes-heading { @extend %block-heading; }
9+
}

lib/docs/filters/octave/clean_html.rb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module Docs
2+
class Octave
3+
class CleanHtmlFilter < Filter
4+
def call
5+
root_page? ? root : other
6+
doc
7+
end
8+
9+
def root
10+
@doc = at_css('.contents')
11+
end
12+
13+
def other
14+
css('.header', 'hr').remove
15+
16+
css('.footnote > h3').each do |node|
17+
node.name = 'h5'
18+
end
19+
20+
at_css('h2, h3, h4').name = 'h1'
21+
22+
css('.example').each do |node|
23+
node.name = 'pre'
24+
node['data-language'] = 'matlab'
25+
node.content = node.content
26+
end
27+
28+
css('a[name] + dl').each do |node|
29+
node['id'] = node.previous['name']
30+
end
31+
32+
css('dt > a[name]', 'th > a[name]').each do |node|
33+
node.parent['id'] = node['name']
34+
node.parent.content = node.parent.content.strip
35+
end
36+
37+
css('h5 > a').each do |node|
38+
node.parent['id'] = node['name']
39+
node.parent.content = node.content
40+
end
41+
42+
end
43+
end
44+
end
45+
end

lib/docs/filters/octave/entries.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module Docs
2+
class Octave
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
at_css('h1').content
6+
end
7+
8+
def get_type
9+
'Manual'
10+
end
11+
12+
def additional_entries
13+
css('dl:not([compact]) > dt').each_with_object [] do |node, entries|
14+
name = node.content.gsub(/[A-z0-9\,… ]*\=/,'').strip
15+
entries << [name, node['id'], 'Functions']
16+
end
17+
end
18+
end
19+
end
20+
end

lib/docs/scrapers/octave.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module Docs
2+
class Octave < UrlScraper
3+
self.name = 'Octave'
4+
self.type = 'octave'
5+
self.release = '5.1.0'
6+
self.base_url = 'https://octave.org/doc/interpreter/'
7+
self.root_path = 'index.html'
8+
self.links = {
9+
home: 'http://www.octave.org/',
10+
code: 'http://www.octave.org/hg/octave'
11+
}
12+
13+
html_filters.push 'octave/clean_html', 'octave/entries', 'title'
14+
15+
options[:skip] = %w(
16+
Copying.html
17+
Preface.html
18+
Acknowledgements.html
19+
Citing-Octave-in-Publications.html
20+
How-You-Can-Contribute-to-Octave.html
21+
Distribution.html)
22+
23+
options[:title] = false
24+
options[:root_title] = 'GNU Octave'
25+
26+
options[:attribution] = <<-HTML
27+
&copy; 1996&ndash;2018 John W. Eaton<br>
28+
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.<br/>
29+
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.</br>
30+
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.</br>
31+
HTML
32+
33+
def get_latest_version(opts)
34+
doc = fetch_doc('https://octave.org/doc/interpreter/', opts)
35+
doc.at_css('h1').content.scan(/([0-9.]+)/)[0][0]
36+
end
37+
end
38+
end

public/icons/docs/octave/16.png

1.28 KB
Loading
1.89 KB
Loading

public/icons/docs/octave/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.gnu.org/software/octave/img/octave-logo.svg

0 commit comments

Comments
 (0)