mirror of https://github.com/freeCodeCamp/devdocs
parent
74323fda3e
commit
6614375671
@ -1,32 +0,0 @@
|
||||
module Docs
|
||||
class Scala
|
||||
class CleanHtml210Filter < Filter
|
||||
def call
|
||||
definition = at_css('#definition')
|
||||
begin
|
||||
type = definition.at_css('.img_kind').text
|
||||
name = definition.at_css('h1').text.strip
|
||||
|
||||
package = definition.at_css('#owner').text rescue ''
|
||||
package = package + '.' unless name.empty? || name.start_with?('root')
|
||||
|
||||
other = definition.at_css('.morelinks').dup
|
||||
other_content = other ? "<h3>#{other.to_html}</h3>" : ''
|
||||
|
||||
definition.replace %Q|
|
||||
<h1><small>#{type} #{package}</small>#{name}</h1>
|
||||
#{other_content}
|
||||
|
|
||||
end if definition
|
||||
|
||||
doc
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def change_tag!(new_tag, node)
|
||||
node.replace %Q|<#{new_tag}>#{node.inner_html}</#{new_tag}>|
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,36 +0,0 @@
|
||||
module Docs
|
||||
class Scala
|
||||
class CleanHtml212Filter < Filter
|
||||
def call
|
||||
css('.permalink').remove
|
||||
|
||||
definition = at_css('#definition')
|
||||
begin
|
||||
type_full_name = {c: 'class', t: 'trait', o: 'object', 'p': 'package'}
|
||||
type = type_full_name[definition.at_css('.big-circle').text.to_sym]
|
||||
name = definition.at_css('h1').text
|
||||
|
||||
package = definition.at_css('#owner').text rescue ''
|
||||
package = package + '.' unless name.empty? || package.empty?
|
||||
|
||||
other = definition.at_css('.morelinks').dup
|
||||
other_content = other ? "<h3>#{other.to_html}</h3>" : ''
|
||||
|
||||
definition.replace %Q|
|
||||
<h1><small>#{type} #{package}</small>#{name}</h1>
|
||||
#{other_content}
|
||||
|
|
||||
|
||||
end if definition
|
||||
|
||||
doc
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def change_tag!(new_tag, node)
|
||||
node.replace %Q|<#{new_tag}>#{node.inner_html}</#{new_tag}>|
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,80 +1,60 @@
|
||||
module Docs
|
||||
class Scala < FileScraper
|
||||
include FixInternalUrlsBehavior
|
||||
|
||||
self.name = 'scala'
|
||||
self.name = 'Scala'
|
||||
self.type = 'scala'
|
||||
self.links = {
|
||||
home: 'http://www.scala-lang.org/',
|
||||
code: 'https://github.com/scala/scala'
|
||||
}
|
||||
|
||||
version '2.12 Library' do
|
||||
self.release = '2.12.3'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala212/api/scala-library' # https://downloads.lightbend.com/scala/2.12.3/scala-docs-2.12.3.zip
|
||||
self.base_url = 'http://www.scala-lang.org/api/2.12.3/'
|
||||
self.root_path = 'index.html'
|
||||
options[:container] = '#content-container'
|
||||
options[:attribution] = <<-HTML
|
||||
Scala programming documentation. Copyright (c) 2003-2017 <a
|
||||
href="http://www.epfl.ch" target="_blank">EPFL</a>, with contributions from <a
|
||||
href="http://www.lightbend.com" target="_blank">Lightbend</a>.
|
||||
© 2002-2019 EPFL, with contributions from Lightbend.
|
||||
HTML
|
||||
html_filters.push 'scala/entries', 'scala/clean_html', 'scala/clean_html_212'
|
||||
|
||||
# https://downloads.lightbend.com/scala/2.13.0/scala-docs-2.13.0.zip
|
||||
# Extract api/scala-library into docs/scala~2.13_library
|
||||
version '2.13 Library' do
|
||||
self.release = '2.13.0'
|
||||
self.base_url = 'https://www.scala-lang.org/api/2.13.0/'
|
||||
self.root_path = 'index.html'
|
||||
|
||||
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||
end
|
||||
|
||||
version '2.12 Reflection' do
|
||||
self.release = '2.12.3'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala212/api/scala-reflect' # https://downloads.lightbend.com/scala/2.12.3/scala-docs-2.12.3.zip
|
||||
self.base_url = 'http://www.scala-lang.org/api/2.12.3/scala-reflect/'
|
||||
# https://downloads.lightbend.com/scala/2.13.0/scala-docs-2.13.0.zip
|
||||
# Extract api/scala-reflect into docs/scala~2.13_reflection
|
||||
version '2.13 Reflection' do
|
||||
self.release = '2.13.0'
|
||||
self.base_url = 'https://www.scala-lang.org/api/2.13.0/scala-reflect/'
|
||||
self.root_path = 'index.html'
|
||||
options[:attribution] = <<-HTML
|
||||
Scala programming documentation. Copyright (c) 2003-2017 <a
|
||||
href="http://www.epfl.ch" target="_blank">EPFL</a>, with contributions from <a
|
||||
href="http://www.lightbend.com" target="_blank">Lightbend</a>.
|
||||
HTML
|
||||
html_filters.push 'scala/entries', 'scala/clean_html', 'scala/clean_html_212'
|
||||
|
||||
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||
end
|
||||
|
||||
version '2.11 Library' do
|
||||
self.release = '2.11.8'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala211/api/scala-library' # https://downloads.lightbend.com/scala/2.11.8/scala-docs-2.11.8.zip
|
||||
self.base_url = 'http://www.scala-lang.org/api/2.11.8/'
|
||||
self.root_path = 'package.html'
|
||||
options[:skip_patterns] = [/^index.html/, /index\/index-/]
|
||||
options[:attribution] = <<-HTML
|
||||
Scala programming documentation. Copyright (c) 2003-2016 <a
|
||||
href="http://www.epfl.ch" target="_blank">EPFL</a>, with contributions from <a
|
||||
href="http://www.lightbend.com" target="_blank">Lightbend</a>.
|
||||
HTML
|
||||
html_filters.push 'scala/entries', 'scala/clean_html', 'scala/clean_html_210'
|
||||
# https://downloads.lightbend.com/scala/2.12.6/scala-docs-2.12.6.zip
|
||||
# Extract api/scala-library into docs/scala~2.12_library
|
||||
version '2.12 Library' do
|
||||
self.release = '2.12.6'
|
||||
self.base_url = 'https://www.scala-lang.org/api/2.12.6/'
|
||||
self.root_path = 'index.html'
|
||||
|
||||
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||
end
|
||||
|
||||
version '2.11 Reflection' do
|
||||
self.release = '2.11.8'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala211/api/scala-reflect' # https://downloads.lightbend.com/scala/2.11.8/scala-docs-2.11.8.zip
|
||||
self.base_url = 'http://www.scala-lang.org/api/2.11.8/scala-reflect/'
|
||||
self.root_path = 'package.html'
|
||||
options[:skip_patterns] = [/^index.html/, /index\/index-/]
|
||||
options[:attribution] = <<-HTML
|
||||
Scala programming documentation. Copyright (c) 2003-2016 <a
|
||||
href="http://www.epfl.ch" target="_blank">EPFL</a>, with contributions from <a
|
||||
href="http://www.lightbend.com" target="_blank">Lightbend</a>.
|
||||
HTML
|
||||
html_filters.push 'scala/entries', 'scala/clean_html', 'scala/clean_html_210'
|
||||
# https://downloads.lightbend.com/scala/2.12.6/scala-docs-2.12.6.zip
|
||||
# Extract api/scala-reflect into docs/scala~2.12_reflection
|
||||
version '2.12 Reflection' do
|
||||
self.release = '2.12.6'
|
||||
self.base_url = 'https://www.scala-lang.org/api/2.12.6/scala-reflect/'
|
||||
self.root_path = 'index.html'
|
||||
|
||||
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||
end
|
||||
|
||||
version '2.10' do
|
||||
self.release = '2.10.6'
|
||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala210' # https://downloads.lightbend.com/scala/2.10.6/scala-docs-2.10.6.zip
|
||||
self.base_url = 'http://www.scala-lang.org/api/2.10.6/'
|
||||
self.root_path = 'package.html'
|
||||
options[:skip_patterns] = [/^index.html/, /index\/index-/]
|
||||
options[:attribution] = <<-HTML
|
||||
Scala programming documentation. Copyright (c) 2003-2013 <a
|
||||
href="http://www.epfl.ch" target="_blank">EPFL</a>, with contributions from <a
|
||||
href="http://typesafe.com" target="_blank">Typesafe</a>.
|
||||
HTML
|
||||
html_filters.push 'scala/entries', 'scala/clean_html', 'scala/clean_html_210'
|
||||
def get_latest_version(opts)
|
||||
doc = fetch_doc('https://www.scala-lang.org/api/current/', opts)
|
||||
doc.at_css('#doc-version').content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue