Skip to content

Commit 34dc221

Browse files
jmerlej-f1
andauthored
Add pony (#952)
Add pony Co-authored-by: Jed Fox <[email protected]>
2 parents e760db2 + eb82f60 commit 34dc221

File tree

7 files changed

+84
-0
lines changed

7 files changed

+84
-0
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,12 @@ credits = [
568568
'CC BY',
569569
'https://creativecommons.org/licenses/by/3.0/'
570570
], [
571+
'Pony',
572+
'2016-2018, The Pony Developers & 2014-2015, Causality Ltd.',
573+
'BSD',
574+
'https://raw.githubusercontent.com/ponylang/ponyc/master/LICENSE'
575+
],
576+
[
571577
'PostgreSQL',
572578
'1996-2018 The PostgreSQL Global Development Group<br>&copy; 1994 The Regents of the University of California',
573579
'PostgreSQL',

lib/docs/filters/pony/clean_html.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Docs
2+
class Pony
3+
class CleanHtmlFilter < Filter
4+
def call
5+
css('.headerlink').remove
6+
7+
css('pre').each do |node|
8+
node.content = node.content
9+
end
10+
11+
doc
12+
end
13+
end
14+
end
15+
end

lib/docs/filters/pony/entries.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module Docs
2+
class Pony
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
title = context[:html_title].sub(/ - .*/, '').split(' ').last
6+
title = "1. #{type}" if title == 'Package'
7+
title
8+
end
9+
10+
def get_type
11+
subpath.split(/-([^a-z])/)[0][0..-1].sub('-', '/')
12+
end
13+
14+
def additional_entries
15+
return [] if root_page? || name.start_with?("1. ")
16+
17+
entries = []
18+
19+
css('h3').each do |node|
20+
member_name = node.content
21+
22+
is_field = member_name.start_with?('let ')
23+
member_name = member_name[4..-1] if is_field
24+
25+
member_name = member_name.scan(/^([a-zA-Z0-9_]+)/)[0][0]
26+
member_name += '()' unless is_field
27+
28+
entries << ["#{name}.#{member_name}", node['id']]
29+
end
30+
31+
entries
32+
end
33+
end
34+
end
35+
end

lib/docs/scrapers/pony.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Docs
2+
class Pony < UrlScraper
3+
self.type = 'simple'
4+
self.release = '0.30.0'
5+
self.base_url = 'https://stdlib.ponylang.io/'
6+
self.links = {
7+
home: 'https://www.ponylang.io/',
8+
code: 'https://github.com/ponylang/ponyc'
9+
}
10+
11+
html_filters.push 'pony/clean_html', 'pony/entries'
12+
13+
options[:attribution] = <<-HTML
14+
&copy; 2016-2018, The Pony Developers<br>
15+
&copy; 2014-2015, Causality Ltd.<br>
16+
Licensed under the BSD 2-Clause License.
17+
HTML
18+
19+
options[:container] = 'article'
20+
options[:trailing_slash] = false
21+
options[:skip_patterns] = [/src/, /stdlib--index/]
22+
23+
def get_latest_version(opts)
24+
get_latest_github_release('ponylang', 'ponyc', opts)
25+
end
26+
end
27+
end

public/icons/docs/pony/16.png

1.33 KB
Loading
1.93 KB
Loading

public/icons/docs/pony/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://raw.githubusercontent.com/ponylang/ponylang-website/master/static/images/logo.png

0 commit comments

Comments
 (0)