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
|
module Docs
|
||||||
class Scala < FileScraper
|
class Scala < FileScraper
|
||||||
include FixInternalUrlsBehavior
|
self.name = 'Scala'
|
||||||
|
|
||||||
self.name = 'scala'
|
|
||||||
self.type = 'scala'
|
self.type = 'scala'
|
||||||
self.links = {
|
self.links = {
|
||||||
home: 'http://www.scala-lang.org/',
|
home: 'http://www.scala-lang.org/',
|
||||||
code: 'https://github.com/scala/scala'
|
code: 'https://github.com/scala/scala'
|
||||||
}
|
}
|
||||||
|
|
||||||
version '2.12 Library' do
|
options[:container] = '#content-container'
|
||||||
self.release = '2.12.3'
|
options[:attribution] = <<-HTML
|
||||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala212/api/scala-library' # https://downloads.lightbend.com/scala/2.12.3/scala-docs-2.12.3.zip
|
© 2002-2019 EPFL, with contributions from Lightbend.
|
||||||
self.base_url = 'http://www.scala-lang.org/api/2.12.3/'
|
HTML
|
||||||
|
|
||||||
|
# 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'
|
self.root_path = 'index.html'
|
||||||
options[:attribution] = <<-HTML
|
|
||||||
Scala programming documentation. Copyright (c) 2003-2017 <a
|
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
version '2.12 Reflection' do
|
# https://downloads.lightbend.com/scala/2.13.0/scala-docs-2.13.0.zip
|
||||||
self.release = '2.12.3'
|
# Extract api/scala-reflect into docs/scala~2.13_reflection
|
||||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala212/api/scala-reflect' # https://downloads.lightbend.com/scala/2.12.3/scala-docs-2.12.3.zip
|
version '2.13 Reflection' do
|
||||||
self.base_url = 'http://www.scala-lang.org/api/2.12.3/scala-reflect/'
|
self.release = '2.13.0'
|
||||||
|
self.base_url = 'https://www.scala-lang.org/api/2.13.0/scala-reflect/'
|
||||||
self.root_path = 'index.html'
|
self.root_path = 'index.html'
|
||||||
options[:attribution] = <<-HTML
|
|
||||||
Scala programming documentation. Copyright (c) 2003-2017 <a
|
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
version '2.11 Library' do
|
# https://downloads.lightbend.com/scala/2.12.6/scala-docs-2.12.6.zip
|
||||||
self.release = '2.11.8'
|
# Extract api/scala-library into docs/scala~2.12_library
|
||||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala211/api/scala-library' # https://downloads.lightbend.com/scala/2.11.8/scala-docs-2.11.8.zip
|
version '2.12 Library' do
|
||||||
self.base_url = 'http://www.scala-lang.org/api/2.11.8/'
|
self.release = '2.12.6'
|
||||||
self.root_path = 'package.html'
|
self.base_url = 'https://www.scala-lang.org/api/2.12.6/'
|
||||||
options[:skip_patterns] = [/^index.html/, /index\/index-/]
|
self.root_path = 'index.html'
|
||||||
options[:attribution] = <<-HTML
|
|
||||||
Scala programming documentation. Copyright (c) 2003-2016 <a
|
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
version '2.11 Reflection' do
|
# https://downloads.lightbend.com/scala/2.12.6/scala-docs-2.12.6.zip
|
||||||
self.release = '2.11.8'
|
# Extract api/scala-reflect into docs/scala~2.12_reflection
|
||||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala211/api/scala-reflect' # https://downloads.lightbend.com/scala/2.11.8/scala-docs-2.11.8.zip
|
version '2.12 Reflection' do
|
||||||
self.base_url = 'http://www.scala-lang.org/api/2.11.8/scala-reflect/'
|
self.release = '2.12.6'
|
||||||
self.root_path = 'package.html'
|
self.base_url = 'https://www.scala-lang.org/api/2.12.6/scala-reflect/'
|
||||||
options[:skip_patterns] = [/^index.html/, /index\/index-/]
|
self.root_path = 'index.html'
|
||||||
options[:attribution] = <<-HTML
|
|
||||||
Scala programming documentation. Copyright (c) 2003-2016 <a
|
html_filters.push 'scala/entries', 'scala/clean_html'
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
version '2.10' do
|
def get_latest_version(opts)
|
||||||
self.release = '2.10.6'
|
doc = fetch_doc('https://www.scala-lang.org/api/current/', opts)
|
||||||
self.dir = '/Users/Thibaut/DevDocs/Docs/Scala210' # https://downloads.lightbend.com/scala/2.10.6/scala-docs-2.10.6.zip
|
doc.at_css('#doc-version').content
|
||||||
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'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in new issue