mirror of https://github.com/freeCodeCamp/devdocs
Merge pull request #982 from scherepn/octave
Add Octave Documentation Co-authored-by: Phil Scherer <pnscher@evoforge.org> Co-authored-by: Jasper van Merle <jaspervmerle@gmail.com>pull/1061/head
commit
a625ae141b
File diff suppressed because one or more lines are too long
@ -0,0 +1,9 @@
|
||||
._octave {
|
||||
@extend %simple;
|
||||
|
||||
dl:not([compact]) > dt { @extend %block-label, %label-blue; }
|
||||
|
||||
dl[compact] > dt { @extend %block-label; }
|
||||
|
||||
.footnotes-heading { @extend %block-heading; }
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
module Docs
|
||||
class Octave
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
root_page? ? root : other
|
||||
doc
|
||||
end
|
||||
|
||||
def root
|
||||
@doc = at_css('.contents')
|
||||
end
|
||||
|
||||
def other
|
||||
css('.header', 'hr').remove
|
||||
|
||||
css('.footnote > h3').each do |node|
|
||||
node.name = 'h5'
|
||||
end
|
||||
|
||||
at_css('h2, h3, h4').name = 'h1'
|
||||
|
||||
css('.example').each do |node|
|
||||
node.name = 'pre'
|
||||
node['data-language'] = 'matlab'
|
||||
node.content = node.content.strip
|
||||
end
|
||||
|
||||
css('a[name] + dl, a[name] + h4').each do |node|
|
||||
node['id'] = node.previous_element['name']
|
||||
end
|
||||
|
||||
css('dt > a[name]', 'th > a[name]').each do |node|
|
||||
node.parent['id'] = node['name']
|
||||
node.parent.content = node.parent.content.strip
|
||||
end
|
||||
|
||||
css('h5 > a').each do |node|
|
||||
node.parent['id'] = node['name']
|
||||
node.parent.content = node.content
|
||||
end
|
||||
|
||||
xpath('//td[text()=" " and not(descendant::*)]').remove
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
module Docs
|
||||
class Octave
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content.sub(/(A?[0-9.]+ )/, '')
|
||||
end
|
||||
|
||||
def get_type
|
||||
return 'Manual: Appendices' if name.start_with?('Appendix')
|
||||
return 'Manual: Indexes' if name.end_with?('Index')
|
||||
'Manual'
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('dl:not([compact]) > dt').each_with_object [] do |node, entries|
|
||||
name = node.content.gsub(/[A-z0-9\,… ]*\=/, '').strip.split(' ')[0]
|
||||
entries << [name, node['id'], 'Functions'] unless node['id'] =~ /-\d+\Z/
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,38 @@
|
||||
module Docs
|
||||
class Octave < UrlScraper
|
||||
self.name = 'Octave'
|
||||
self.type = 'octave'
|
||||
self.release = '5.1.0'
|
||||
self.base_url = 'https://octave.org/doc/interpreter/'
|
||||
self.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'http://www.octave.org/',
|
||||
code: 'http://www.octave.org/hg/octave'
|
||||
}
|
||||
|
||||
html_filters.push 'octave/clean_html', 'octave/entries', 'title'
|
||||
|
||||
options[:skip] = %w(
|
||||
Copying.html
|
||||
Preface.html
|
||||
Acknowledgements.html
|
||||
Citing-Octave-in-Publications.html
|
||||
How-You-Can-Contribute-to-Octave.html
|
||||
Distribution.html)
|
||||
|
||||
options[:title] = false
|
||||
options[:root_title] = 'GNU Octave'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 1996–2018 John W. Eaton<br>
|
||||
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/>
|
||||
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>
|
||||
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
|
||||
HTML
|
||||
|
||||
def get_latest_version(opts)
|
||||
doc = fetch_doc('https://octave.org/doc/interpreter/', opts)
|
||||
doc.at_css('h1').content.scan(/([0-9.]+)/)[0][0]
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1 @@
|
||||
https://www.gnu.org/software/octave/img/octave-logo.svg
|
Loading…
Reference in new issue