diff --git a/assets/javascripts/views/pages/ramda.coffee b/assets/javascripts/views/pages/ramda.coffee new file mode 100644 index 00000000..449b5fd0 --- /dev/null +++ b/assets/javascripts/views/pages/ramda.coffee @@ -0,0 +1,6 @@ +#= require views/pages/base + +class app.views.RamdaPage extends app.views.BasePage + prepare: -> + @highlightCode @findAll('section > pre:last-child'), 'javascript' + return diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 5a047bb8..35e24aac 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -64,6 +64,7 @@ 'pages/phpunit', 'pages/postgres', 'pages/q', + 'pages/ramda', 'pages/rdoc', 'pages/react', 'pages/redis', diff --git a/assets/stylesheets/pages/_ramda.scss b/assets/stylesheets/pages/_ramda.scss new file mode 100644 index 00000000..573bc340 --- /dev/null +++ b/assets/stylesheets/pages/_ramda.scss @@ -0,0 +1,33 @@ +._ramda { + @extend %simple; + code { @extend %code; } + h2 + div > code { @extend %block-label, %label-blue; } + + h2 { + small { + font-size: small; + float: right; + } + } + + .see a { @extend %label; } + + .params { + .type { + font-style: italic; + text-transform: capitalize; + margin-right: 0.35em; + &::before { content: '<'; } + &::after { content: '>'; } + } + .panel-body { + margin-bottom: 1.5em; + .type { + padding: 0 0 0 2em; + } + .description > p { + display: inline-block; + } + } + } +} diff --git a/lib/docs/filters/ramda/clean_html.rb b/lib/docs/filters/ramda/clean_html.rb new file mode 100644 index 00000000..ec5ce5e8 --- /dev/null +++ b/lib/docs/filters/ramda/clean_html.rb @@ -0,0 +1,53 @@ +module Docs + class Ramda + class CleanHtmlFilter < Filter + def call + @doc = at_css('main') + + # Remove try in repl + css('.try-repl', '.pull-right').remove + + # Place 'Added in' in header + css('.card').each do |card| + title = card.at_css('h2') + added_in = card.at_css('small') + added_in.parent = title + end + + # Prepend links with 'R.' + css('h2 > a.name, .see a').each do |link| + link.content = 'R.' + link.content + end + + css('.params').each do |node| + # Remove params expand link + node.inner_html = node.at_css('.details').inner_html + node.prepend_child "
+ node.css('span.name').each do |n|
+ n.name = 'code'
+ n.remove_attribute 'class'
+ end
+
+ # change returns to to make consistant look with params header
+ if returns = node.at_css('span.returns')
+ returns.name = 'h4'
+ end
+ end
+
+ # Remove code highlighting
+ css('pre').each do |node|
+ node.content = node.content
+ end
+
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/ramda/entries.rb b/lib/docs/filters/ramda/entries.rb
new file mode 100644
index 00000000..72bfc313
--- /dev/null
+++ b/lib/docs/filters/ramda/entries.rb
@@ -0,0 +1,14 @@
+module Docs
+ class Ramda
+ class EntriesFilter < Docs::EntriesFilter
+ def additional_entries
+ css('ul.toc li').map do |item|
+ name = item['data-name']
+ category = item['data-category']
+
+ ['R.' + name, name, category]
+ end
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/ramda.rb b/lib/docs/scrapers/ramda.rb
new file mode 100644
index 00000000..d9424958
--- /dev/null
+++ b/lib/docs/scrapers/ramda.rb
@@ -0,0 +1,22 @@
+module Docs
+ class Ramda < UrlScraper
+ self.name = 'Ramda'
+ self.slug = 'ramda'
+ self.type = 'ramda'
+ self.release = '0.19.1'
+ self.base_url = 'http://ramdajs.com/docs'
+ self.links = {
+ home: 'http://ramdajs.com/',
+ code: 'https://github.com/ramda/ramda/'
+ }
+
+ html_filters.push 'ramda/entries', 'ramda/clean_html', 'title'
+
+ options[:title] = 'Ramda'
+ options[:attribution] = <<-HTML
+ © 2013–2014 Scott Sauyet and Michael Hurley
+ Licensed under the MIT License.
+ HTML
+ end
+end
+
diff --git a/public/icons/docs/ramda/SOURCE b/public/icons/docs/ramda/SOURCE
new file mode 100644
index 00000000..4ac07377
--- /dev/null
+++ b/public/icons/docs/ramda/SOURCE
@@ -0,0 +1 @@
+https://camo.githubusercontent.com/0b4c12a5daec02b72e6e6879861ac70f75046e65/687474703a2f2f72616d64612e6a637068696c6c697070732e636f6d2f6c6f676f2f72616d646146696c6c65645f323030783233352e706e67
diff --git a/public/icons/docs/ramda/ramda-16.png b/public/icons/docs/ramda/ramda-16.png
new file mode 100644
index 00000000..7ebe9cbc
Binary files /dev/null and b/public/icons/docs/ramda/ramda-16.png differ
diff --git a/public/icons/docs/ramda/ramda-32.png b/public/icons/docs/ramda/ramda-32.png
new file mode 100644
index 00000000..536d0231
Binary files /dev/null and b/public/icons/docs/ramda/ramda-32.png differ