mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Merge branch 'contributors'
This commit is contained in:
commit
f46fb407eb
4 changed files with 118 additions and 0 deletions
45
_config.yml
Normal file
45
_config.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
safe: false
|
||||
auto: false
|
||||
server: false
|
||||
server_port: 4000
|
||||
base-url: /
|
||||
|
||||
source: .
|
||||
destination: ./_site
|
||||
plugins: ./_plugins
|
||||
|
||||
future: true
|
||||
lsi: false
|
||||
pygments: false
|
||||
markdown: maruku
|
||||
permalink: date
|
||||
|
||||
maruku:
|
||||
use_tex: false
|
||||
use_divs: false
|
||||
png_engine: blahtex
|
||||
png_dir: images/latex
|
||||
png_url: /images/latex
|
||||
|
||||
rdiscount:
|
||||
extensions: []
|
||||
|
||||
kramdown:
|
||||
auto_ids: true,
|
||||
footnote_nr: 1
|
||||
entity_output: as_char
|
||||
toc_levels: 1..6
|
||||
use_coderay: false
|
||||
|
||||
coderay:
|
||||
coderay_wrap: div
|
||||
coderay_line_numbers: inline
|
||||
coderay_line_numbers_start: 1
|
||||
coderay_tab_width: 4
|
||||
coderay_bold_every: 10
|
||||
coderay_css: style
|
||||
|
||||
aliases:
|
||||
s_nakamoto: Satoshi Nakamoto
|
||||
--author=Satoshi Nakamoto: Satoshi Nakamoto
|
||||
gavinandresen: Gavin Andresen
|
55
_plugins/contributors.rb
Normal file
55
_plugins/contributors.rb
Normal file
|
@ -0,0 +1,55 @@
|
|||
require 'open-uri'
|
||||
require 'json'
|
||||
require 'aquarium'
|
||||
require 'yaml'
|
||||
|
||||
module Jekyll
|
||||
|
||||
class CategoryGenerator < Generator
|
||||
def fetch_contributors
|
||||
contributors = JSON.parse(open("http://github.com/api/v2/json/repos/show/bitcoin/bitcoin/contributors/anon").read)["contributors"]
|
||||
|
||||
contributors.map do |x|
|
||||
x['name'] = x['login'] unless x.has_key?('name')
|
||||
x['name'] = x['login'] if x['name'] == ""
|
||||
|
||||
x
|
||||
end
|
||||
end
|
||||
|
||||
def merge_contributors(contributors, aliases)
|
||||
contributors = contributors.map do |c|
|
||||
c['name'] = aliases[c['name']] if aliases.has_key?(c['name'])
|
||||
|
||||
c
|
||||
end
|
||||
|
||||
hoaoh = contributors.reduce({}) do |result, item|
|
||||
result.merge({ item['name'] => [item] }) { |key, old, new| old[0]['contributions'] += new[0]['contributions']; old }
|
||||
end
|
||||
|
||||
hoaoh.values.map { |sublist|
|
||||
sublist.reduce({}) do |merged,h|
|
||||
merged.merge(h) do |key,old,new| (key=='name' ? old : old+new) end
|
||||
end
|
||||
}.flatten
|
||||
end
|
||||
|
||||
def generate(site)
|
||||
@contributors = merge_contributors(fetch_contributors(), site.config['aliases']).sort_by{|c| - c['contributions']}
|
||||
@primary_devs = JSON.parse(open("http://github.com/api/v2/json/repos/show/bitcoin/bitcoin/collaborators").read)["collaborators"]
|
||||
|
||||
Aquarium::Aspects::Aspect.new :around, :invoking => :site_payload, :on_type => Site do |execution_point, site, *args|
|
||||
result = execution_point.proceed
|
||||
result['site']['project'] = {
|
||||
"primary_devs" => @primary_devs,
|
||||
"contributors" => @contributors
|
||||
}
|
||||
result
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
14
index.html
14
index.html
|
@ -14,6 +14,7 @@ ALERT:
|
|||
<li><a href="#news">News</a></li>
|
||||
<li><a href="#about">About</a></li>
|
||||
<li><a href="#features">Features</a></li>
|
||||
<li><a href="#contributors">Contributors</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -208,4 +209,17 @@ ALERT:
|
|||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="contributors">
|
||||
<h1>Contributors <small>ordered by number of commits</small></h1>
|
||||
|
||||
<table class="unstyled">
|
||||
<tr>
|
||||
{% for c in site.project.contributors %}
|
||||
<td>{{ c.name }} ({{ c.contributions }})</td>
|
||||
{% cycle nil, nil, nil, nil, '</tr><tr>' %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -92,3 +92,7 @@ section {
|
|||
vertical-align: top;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
table.unstyled td {
|
||||
border: none;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue