From 12c5fde792708064f3865b5be09cb7db311f89db Mon Sep 17 00:00:00 2001 From: edno Date: Mon, 1 Dec 2014 20:35:32 +0530 Subject: [PATCH] Add Selenium 1.0 documentation --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_selenium.scss | 14 +++++++ lib/docs/filters/selenium/clean_html.rb | 51 ++++++++++++++++++++++++ lib/docs/filters/selenium/entries.rb | 21 ++++++++++ lib/docs/scrapers/selenium.rb | 19 +++++++++ public/icons/docs/selenium/16.png | Bin 0 -> 894 bytes public/icons/docs/selenium/16@2.png | Bin 0 -> 2245 bytes 7 files changed, 106 insertions(+) create mode 100644 assets/stylesheets/pages/_selenium.scss create mode 100644 lib/docs/filters/selenium/clean_html.rb create mode 100644 lib/docs/filters/selenium/entries.rb create mode 100644 lib/docs/scrapers/selenium.rb create mode 100644 public/icons/docs/selenium/16.png create mode 100644 public/icons/docs/selenium/16@2.png diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index eedd9700..9c26b7ec 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -60,6 +60,7 @@ 'pages/redis', 'pages/requirejs', 'pages/rfc', + 'pages/selenium', 'pages/sinon', 'pages/sphinx', 'pages/underscore', diff --git a/assets/stylesheets/pages/_selenium.scss b/assets/stylesheets/pages/_selenium.scss new file mode 100644 index 00000000..1ce52983 --- /dev/null +++ b/assets/stylesheets/pages/_selenium.scss @@ -0,0 +1,14 @@ +._selenium { + h1 { + margin-top: 0; + @extend %lined-heading; + } + + h2 { @extend %block-heading; } + + h3 { @extend %note, %note-green; } + + code { @extend %label; } + + .synopsis { @extend %note, %note-blue; } +} diff --git a/lib/docs/filters/selenium/clean_html.rb b/lib/docs/filters/selenium/clean_html.rb new file mode 100644 index 00000000..d5b42414 --- /dev/null +++ b/lib/docs/filters/selenium/clean_html.rb @@ -0,0 +1,51 @@ +module Docs + class Selenium + class CleanHtmlFilter < Filter + def call + + # remove nodes before Actions documentation + node = css('h2:contains("Selenium Actions")') + node.xpath('preceding-sibling::*').remove + + # remove nodes after Accessors documentation + node = css('h2:contains("Selenium Accessors")').xpath('following-sibling::h2') + node.xpath('following-sibling::*').remove + node.remove + + # remove body node and untagged text + css('body').children.each do |node| + node.parent = node.parent.parent unless node.name == 'text' + end + css('body').remove + + # set anchor for internal references + css('dt > strong').each do |node| + anchor = Nokogiri::XML::Node.new "a", @doc + anchor.content = node.content + anchor['id'] = anchor.content[/\w+/].downcase + node.content = '' + node.name = 'h3' + anchor.parent = node + end + + # include arguments into colored note + css('p:contains("Arguments")').each do |node| + node.name = "div" + node['class'] = "synopsis" + node.next_element.parent = node + end + + # fix external links + css('a').each do |node| + if node['href'] + unless ['actions', 'accessors'].include? node['href'][/#(.*)/, 1] + node['href'] = Selenium.base_url + node['href'] + end + end + end + + doc + end + end + end +end diff --git a/lib/docs/filters/selenium/entries.rb b/lib/docs/filters/selenium/entries.rb new file mode 100644 index 00000000..51c8396e --- /dev/null +++ b/lib/docs/filters/selenium/entries.rb @@ -0,0 +1,21 @@ +module Docs + class Selenium + class EntriesFilter < Docs::EntriesFilter + def additional_entries + entries = [] + + types = ['actions', 'accessors'] + + types.each do |type| + node = doc.css("a[name='#{type}'] + h2 + dl") + node.css('strong > a').each do |node| + name = node['name'] + id = name.downcase + entries << [name, id, type] + end + end + entries + end + end + end +end diff --git a/lib/docs/scrapers/selenium.rb b/lib/docs/scrapers/selenium.rb new file mode 100644 index 00000000..34549706 --- /dev/null +++ b/lib/docs/scrapers/selenium.rb @@ -0,0 +1,19 @@ +module Docs + class Selenium < UrlScraper + self.name = 'Selenium' + self.type = 'selenium' + self.slug = 'selenium' + self.version = '1.0.1' + self.base_url = 'http://release.seleniumhq.org/selenium-core/1.0.1/reference.html' + + html_filters.push 'selenium/entries', 'selenium/clean_html', 'title' + + options[:skip_links] = true + options[:title] = self.name + + options[:attribution] = <<-HTML + © 2006–2014 Selenium Project + Licensed under the Apache 2.0 License + HTML + end +end diff --git a/public/icons/docs/selenium/16.png b/public/icons/docs/selenium/16.png new file mode 100644 index 0000000000000000000000000000000000000000..b0f4eaa1cf9c47ea81b588a8401a379139c2dac2 GIT binary patch literal 894 zcmV-^1A+XBP)%xiKF)?mk8df7ACK3~1rbJf~;y|E) zBo>-dc<^4^N5kv8_qt#tvM})^-_1EE=bQ6A-vj?6j4}U)c=E+#7QbJ>7;~#H38eoE zy7^65Mo>8V;D=wo zs{8^7nM@{=olXa>^)1G|zp9-2r`#`0)4XW%+^gVq&Ug@gOy-qW56RF0v<$w@DrIF3WLTBX%$F*rEL@W?QZ<6tLkwzjqqLU4I`c{2b& zHX03Zyb&5ecDr4aQYwy z5X-U%f}mNi*T1>Cx~kV|HN@oPWLXIDwGiT-lu{;>Nm8j4wryis7E(%H=8RIR;d$QU zN~Q9h>$+-hZ;!tLFXX4DqzH7U0000PbVXQnQ*UN;cVTj60C#tHE@^ISb7Ns}WiD@W UXPfRk8UO$Q07*qoM6N<$f|A0h3IG5A literal 0 HcmV?d00001 diff --git a/public/icons/docs/selenium/16@2.png b/public/icons/docs/selenium/16@2.png new file mode 100644 index 0000000000000000000000000000000000000000..6fcbedc37a194046b7d16ebf3dcf0e4c3c9505e4 GIT binary patch literal 2245 zcmV;$2s-zPP){rEy3xrBxcLhPGp+Th}r!HY!cK=!7)H#sF#6gmy7@1sXR5HgEX{hQ|xp}nuIuQYWsEUIJV!9vy0ZoY0^qV9O=<}eBL8J|MNWm=RE&c z@Er~*<^Q!`2!Zll0$9xlpxiPcgjfMsD_`jB?EKazR}=*yL@^5Gj#YqHUi`Du@AYpy z^4yUNue|z-0elm#P$)zw6r#JkySSu&3)52Mxq?AZ0g_IJpVZ#R6+S-UjBJEzUcfZf)3%gvd>f(kwnQhz4axR2G zQ4};y6E2radOV&)Lqo%bNB2BB^wJwI@16_CkGNXhRmr#J-+VZ|KyZ7FE|FnJk_KmHrtyET40$^Ddwryis*0Oo|Q%YHKehUCX2y(d`iFm^L=<|;! zMmI+5JX_XO3suO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