History

add ramda.js

Hassan Zamani committed 10 years ago

Commit 38f100f1 parent 1fa82439 files · +128 −-2Browse files

Unified · Split

9 files
  1. assets/javascripts/views/pages/ramda.coffee +6 −0
  2. assets/stylesheets/application.css.scss +1 −0
  3. assets/stylesheets/pages/_ramda.scss +33 −0
  4. lib/docs/filters/ramda/clean_html.rb +53 −0
  5. lib/docs/filters/ramda/entries.rb +14 −0
  6. lib/docs/scrapers/ramda.rb +22 −0
  7. public/icons/docs/ramda/SOURCE +1 −0
  8. public/icons/docs/ramda/ramda-16.png +0 −0
  9. public/icons/docs/ramda/ramda-32.png +0 −0
assets/javascripts/views/pages/ramda.coffee+6−0
@@ -0,0 +1,6 @@
1+#= require views/pages/base
2+
3+class app.views.RamdaPage extends app.views.BasePage
4+ prepare: ->
5+ @highlightCode @findAll('section > pre:last-child'), 'javascript'
6+ return
assets/stylesheets/application.css.scss+1−0
@@ -64,6 +64,7 @@ · 63 unmodified lines
6464 'pages/phpunit',
6565 'pages/postgres',
6666 'pages/q',
67+ 'pages/ramda',
6768 'pages/rdoc',
6869 'pages/react',
6970 'pages/redis',
assets/stylesheets/pages/_ramda.scss+33−0
@@ -0,0 +1,33 @@
1+._ramda {
2+ @extend %simple;
3+ code { @extend %code; }
4+ h2 + div > code { @extend %block-label, %label-blue; }
5+
6+ h2 {
7+ small {
8+ font-size: small;
9+ float: right;
10+ }
11+ }
12+
13+ .see a { @extend %label; }
14+
15+ .params {
16+ .type {
17+ font-style: italic;
18+ text-transform: capitalize;
19+ margin-right: 0.35em;
20+ &::before { content: '<'; }
21+ &::after { content: '>'; }
22+ }
23+ .panel-body {
24+ margin-bottom: 1.5em;
25+ .type {
26+ padding: 0 0 0 2em;
27+ }
28+ .description > p {
29+ display: inline-block;
30+ }
31+ }
32+ }
33+}
lib/docs/filters/ramda/clean_html.rb+53−0
@@ -0,0 +1,53 @@
1+module Docs
2+ class Ramda
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('main')
6+
7+ # Remove try in repl
8+ css('.try-repl', '.pull-right').remove
9+
10+ # Place 'Added in' in header
11+ css('.card').each do |card|
12+ title = card.at_css('h2')
13+ added_in = card.at_css('small')
14+ added_in.parent = title
15+ end
16+
17+ # Prepend links with 'R.'
18+ css('h2 > a.name, .see a').each do |link|
19+ link.content = 'R.' + link.content
20+ end
21+
22+ css('.params').each do |node|
23+ # Remove params expand link
24+ node.inner_html = node.at_css('.details').inner_html
25+ node.prepend_child "<h4>Parameters</h4>"
26+
27+ # Count params
28+ if ul = node.at_css('ul')
29+ ul.name = 'ol'
30+ end
31+
32+ # change param names to <code>
33+ node.css('span.name').each do |n|
34+ n.name = 'code'
35+ n.remove_attribute 'class'
36+ end
37+
38+ # change returns to <h4> to make consistant look with params header
39+ if returns = node.at_css('span.returns')
40+ returns.name = 'h4'
41+ end
42+ end
43+
44+ # Remove code highlighting
45+ css('pre').each do |node|
46+ node.content = node.content
47+ end
48+
49+ doc
50+ end
51+ end
52+ end
53+end
lib/docs/filters/ramda/entries.rb+14−0
@@ -0,0 +1,14 @@
1+module Docs
2+ class Ramda
3+ class EntriesFilter < Docs::EntriesFilter
4+ def additional_entries
5+ css('ul.toc li').map do |item|
6+ name = item['data-name']
7+ category = item['data-category']
8+
9+ ['R.' + name, name, category]
10+ end
11+ end
12+ end
13+ end
14+end
lib/docs/scrapers/ramda.rb+22−0
@@ -0,0 +1,22 @@
1+module Docs
2+ class Ramda < UrlScraper
3+ self.name = 'Ramda'
4+ self.slug = 'ramda'
5+ self.type = 'ramda'
6+ self.release = '0.19.1'
7+ self.base_url = 'http://ramdajs.com/docs'
8+ self.links = {
9+ home: 'http://ramdajs.com/',
10+ code: 'https://github.com/ramda/ramda/'
11+ }
12+
13+ html_filters.push 'ramda/entries', 'ramda/clean_html', 'title'
14+
15+ options[:title] = 'Ramda'
16+ options[:attribution] = <<-HTML
17+ &copy; 2013&ndash;2014 Scott Sauyet and Michael Hurley<br>
18+ Licensed under the MIT License.
19+ HTML
20+ end
21+end
22+
public/icons/docs/ramda/SOURCE+1−0
@@ -0,0 +1 @@
1+https://camo.githubusercontent.com/0b4c12a5daec02b72e6e6879861ac70f75046e65/687474703a2f2f72616d64612e6a637068696c6c697070732e636f6d2f6c6f676f2f72616d646146696c6c65645f323030783233352e706e67
public/icons/docs/ramda/ramda-16.png+0−0

Binary file not shown.

public/icons/docs/ramda/ramda-32.png+0−0

Binary file not shown.