Update Three.js documentation (173)

pull/2392/head
Simon Legner 1 month ago
parent 74aa661e3a
commit 6dbe834e57

@ -1,4 +1,8 @@
[
[
"2025-02-23",
"New documentation: <a href=\"/threejs/\">Three.js</a>"
],
[
"2025-02-16",
"New documentation: <a href=\"/openlayers/\">OpenLayers</a>"

@ -36,8 +36,8 @@ module Docs
def wrap_code_blocks
css('code').each do |node|
next if node.parent.name == 'pre'
pre = node.wrap('<pre>')
pre['data-language'] = pre['class'] = 'language-javascript'
node.wrap('<pre>')
node.parent['data-language'] = 'javascript'
end
end
@ -45,7 +45,8 @@ module Docs
# Handle source links
css('h2').each do |node|
next unless node.content.strip == 'Source'
handle_source_link(node)
node.next_element.remove
node.remove
end
# Handle method signatures and properties
@ -65,17 +66,6 @@ module Docs
end
end
def handle_source_link(node)
content = node.next_element&.inner_html
return unless content
content = content.gsub(/<[^>]+>/, '')
if content =~ /src\/(.*?)\.js/
path = "/#{$1}.js"
formatted_link = %Q(<a class="reference external" href="https://github.com/mrdoob/three.js/blob/master/src#{path}">src#{path}</a>)
node.next_element.inner_html = formatted_link if node.next_element
end
end
def handle_method_signatures(content)
content
.gsub(PATTERNS[:method_this]) { format_method_signature('this', $1, $2) }

@ -1,5 +1,5 @@
module Docs
class Threejs < FileScraper
class Threejs < UrlScraper
self.name = 'Three.js'
self.type = 'simple'
self.slug = 'threejs'
@ -40,20 +40,18 @@ module Docs
Licensed under the MIT License.
HTML
version '171' do
self.release = '171'
self.base_url = "https://threejs.org/docs"
end
self.release = '173'
self.base_url = "https://threejs.org/docs"
def get_latest_version(opts)
get_latest_github_release('mrdoob', 'three.js', opts)
get_latest_github_release('mrdoob', 'three.js', opts)[1..]
end
def initial_paths
paths = []
json_path = File.expand_path("/tmp/list.json")
json_content = File.read(json_path)
json_data = JSON.parse(json_content)
url = 'https://threejs.org/docs/list.json'
response = Request.run(url)
json_data = JSON.parse(response.body)
# Process both API and manual sections
process_documentation(json_data['en'], paths)

Loading…
Cancel
Save