Showing the changes to lib/docs (3 of 9 files). Show all
Unified · Split
| @@ -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 | ||
| @@ -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 | ||
| @@ -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 | © 2013–2014 Scott Sauyet and Michael Hurley<br> | ||
| 18 | Licensed under the MIT License. | ||
| 19 | HTML | ||
| 20 | end | ||
| 21 | end | ||
| 22 | |||