Unified · Split
| @@ -1,14 +0,0 @@ | |||
| 1 | #= require views/pages/base | ||
| 2 | |||
| 3 | class app.views.AngularPage extends app.views.BasePage | ||
| 4 | prepare: -> | ||
| 5 | for el in @findAllByTag('pre') | ||
| 6 | lang = if el.classList.contains('lang-html') or el.textContent[0] is '<' | ||
| 7 | 'markup' | ||
| 8 | else if el.classList.contains('lang-css') | ||
| 9 | 'css' | ||
| 10 | else | ||
| 11 | 'javascript' | ||
| 12 | el.setAttribute('class', '') | ||
| 13 | @highlightCode el, lang | ||
| 14 | return | ||
| @@ -6,6 +6,7 @@ class app.views.SimplePage extends app.views.BasePage · 5 unmodified lines | |||
| 6 | @highlightCode el, el.getAttribute('data-language') | 6 | @highlightCode el, el.getAttribute('data-language') |
| 7 | return | 7 | return |
| 8 | 8 | ||
| 9 | app.views.AngularPage = | ||
| 9 | app.views.EmberPage = | 10 | app.views.EmberPage = |
| 10 | app.views.GoPage = | 11 | app.views.GoPage = |
| 11 | app.views.MeteorPage = | 12 | app.views.MeteorPage = |
| @@ -67,7 +67,16 @@ module Docs · 66 unmodified lines | |||
| 67 | end | 67 | end |
| 68 | 68 | ||
| 69 | css('pre > code').each do |node| | 69 | css('pre > code').each do |node| |
| 70 | node.parent['class'] = node['class'] | 70 | node['class'] ||= '' |
| 71 | lang = if node['class'].include?('lang-html') || node.content =~ /\A</ | ||
| 72 | 'html' | ||
| 73 | elsif node['class'].include?('lang-css') | ||
| 74 | 'css' | ||
| 75 | elsif node['class'].include?('lang-js') || node['class'].include?('lang-javascript') | ||
| 76 | 'javascript' | ||
| 77 | end | ||
| 78 | node.parent['data-language'] = lang if lang | ||
| 79 | |||
| 71 | node.before(node.children).remove | 80 | node.before(node.children).remove |
| 72 | end | 81 | end |
| 73 | 82 | ||
| @@ -37,8 +37,17 @@ module Docs · 36 unmodified lines | |||
| 37 | Licensed under the Creative Commons Attribution License 4.0. | 37 | Licensed under the Creative Commons Attribution License 4.0. |
| 38 | HTML | 38 | HTML |
| 39 | 39 | ||
| 40 | stub '' do | ||
| 41 | require 'capybara/dsl' | ||
| 42 | Capybara.current_driver = :selenium | ||
| 43 | Capybara.run_server = false | ||
| 44 | Capybara.app_host = 'https://code.angularjs.org' | ||
| 45 | Capybara.visit("/#{self.class.release}/docs/api") | ||
| 46 | Capybara.find('.side-navigation')['innerHTML'] | ||
| 47 | end | ||
| 48 | |||
| 40 | version '1.5' do | 49 | version '1.5' do |
| 41 | self.release = '1.5.3' | 50 | self.release = '1.5.5' |
| 42 | self.base_url = "https://code.angularjs.org/#{release}/docs/partials/" | 51 | self.base_url = "https://code.angularjs.org/#{release}/docs/partials/" |
| 43 | end | 52 | end |
| 44 | 53 | ||
| @@ -56,14 +65,5 @@ module Docs · 11 unmodified lines | |||
| 56 | self.release = '1.2.29' | 65 | self.release = '1.2.29' |
| 57 | self.base_url = "https://code.angularjs.org/#{release}/docs/partials/" | 66 | self.base_url = "https://code.angularjs.org/#{release}/docs/partials/" |
| 58 | end | 67 | end |
| 59 | |||
| 60 | stub '' do | ||
| 61 | require 'capybara/dsl' | ||
| 62 | Capybara.current_driver = :selenium | ||
| 63 | Capybara.run_server = false | ||
| 64 | Capybara.app_host = 'https://code.angularjs.org' | ||
| 65 | Capybara.visit("/#{self.class.release}/docs/api") | ||
| 66 | Capybara.find('.side-navigation')['innerHTML'] | ||
| 67 | end | ||
| 68 | end | 68 | end |
| 69 | end | 69 | end |