[devdocsgjs/main: 820/1867] pony: finish scraper and filters
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 820/1867] pony: finish scraper and filters
- Date: Fri, 19 Nov 2021 23:47:31 +0000 (UTC)
commit eb82f6024cf25e8c468b5198404b75f7015fe457
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Wed Aug 14 02:28:43 2019 +0200
pony: finish scraper and filters
.../javascripts/templates/pages/about_tmpl.coffee | 6 +++++
lib/docs/filters/pony/clean_html.rb | 15 ++++++++++++
lib/docs/filters/pony/container.rb | 9 -------
lib/docs/filters/pony/entries.rb | 26 +++++++++++++++++++--
lib/docs/scrapers/pony.rb | 19 +++++++++++----
public/icons/docs/pony/16.png | Bin 1979 -> 1360 bytes
6 files changed, 59 insertions(+), 16 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 07c92ad8..ac86b701 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -568,6 +568,12 @@ credits = [
'CC BY',
'https://creativecommons.org/licenses/by/3.0/'
], [
+ 'Pony',
+ '2016-2018, The Pony Developers & 2014-2015, Causality Ltd.',
+ 'BSD',
+ 'https://raw.githubusercontent.com/ponylang/ponyc/master/LICENSE'
+ ],
+ [
'PostgreSQL',
'1996-2018 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of
California',
'PostgreSQL',
diff --git a/lib/docs/filters/pony/clean_html.rb b/lib/docs/filters/pony/clean_html.rb
new file mode 100644
index 00000000..665d1048
--- /dev/null
+++ b/lib/docs/filters/pony/clean_html.rb
@@ -0,0 +1,15 @@
+module Docs
+ class Pony
+ class CleanHtmlFilter < Filter
+ def call
+ css('.headerlink').remove
+
+ css('pre').each do |node|
+ node.content = node.content
+ end
+
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/pony/entries.rb b/lib/docs/filters/pony/entries.rb
index 0dbc81c8..296f2090 100644
--- a/lib/docs/filters/pony/entries.rb
+++ b/lib/docs/filters/pony/entries.rb
@@ -2,11 +2,33 @@ module Docs
class Pony
class EntriesFilter < Docs::EntriesFilter
def get_name
- context[:html_title].sub(/ - .*/, '')
+ title = context[:html_title].sub(/ - .*/, '').split(' ').last
+ title = "1. #{type}" if title == 'Package'
+ title
end
def get_type
- subpath.split('-')[0][0..-1]
+ subpath.split(/-([^a-z])/)[0][0..-1].sub('-', '/')
+ end
+
+ def additional_entries
+ return [] if root_page? || name.start_with?("1. ")
+
+ entries = []
+
+ css('h3').each do |node|
+ member_name = node.content
+
+ is_field = member_name.start_with?('let ')
+ member_name = member_name[4..-1] if is_field
+
+ member_name = member_name.scan(/^([a-zA-Z0-9_]+)/)[0][0]
+ member_name += '()' unless is_field
+
+ entries << ["#{name}.#{member_name}", node['id']]
+ end
+
+ entries
end
end
end
diff --git a/lib/docs/scrapers/pony.rb b/lib/docs/scrapers/pony.rb
index 5f1bbc04..24df881d 100644
--- a/lib/docs/scrapers/pony.rb
+++ b/lib/docs/scrapers/pony.rb
@@ -1,18 +1,27 @@
module Docs
class Pony < UrlScraper
- self.type = 'pony'
- self.release = '0.25.0'
+ self.type = 'simple'
+ self.release = '0.30.0'
self.base_url = 'https://stdlib.ponylang.io/'
+ self.links = {
+ home: 'https://www.ponylang.io/',
+ code: 'https://github.com/ponylang/ponyc'
+ }
- html_filters.push 'pony/container', 'pony/entries'
+ html_filters.push 'pony/clean_html', 'pony/entries'
options[:attribution] = <<-HTML
© 2016-2018, The Pony Developers<br>
© 2014-2015, Causality Ltd.<br>
- Licensed under the <a href="https://github.com/ponylang/ponyc/blob/master/LICENSE">BSD 2-Clause
License</a>
+ Licensed under the BSD 2-Clause License.
HTML
+ options[:container] = 'article'
options[:trailing_slash] = false
- options[:skip_patterns] = [/src/]
+ options[:skip_patterns] = [/src/, /stdlib--index/]
+
+ def get_latest_version(opts)
+ get_latest_github_release('ponylang', 'ponyc', opts)
+ end
end
end
diff --git a/public/icons/docs/pony/16.png b/public/icons/docs/pony/16.png
index daed6509..c5b30dad 100644
Binary files a/public/icons/docs/pony/16.png and b/public/icons/docs/pony/16.png differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]