History

Add Laravel documentation

Thibaut committed 12 years ago

Commit 060052b1 parent 20b1c0213 files · +151 −-2Browse files

Unified · Split

13 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  4. assets/javascripts/templates/pages/news_tmpl.coffee +4 −1
  5. assets/stylesheets/application.css.scss +1 −0
  6. assets/stylesheets/global/_icons.scss +2 −1
  7. assets/stylesheets/pages/_laravel.scss +8 −0
  8. lib/docs/filters/laravel/clean_html.rb +55 −0
  9. lib/docs/filters/laravel/entries.rb +40 −0
  10. lib/docs/scrapers/laravel.rb +39 −0
  11. public/icons/docs/laravel/16.png +0 −0
  12. public/icons/docs/laravel/16@2x.png +0 −0
  13. public/icons/docs/laravel/SOURCE +1 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -155,6 +155,11 @@ credits = [ · 154 unmodified lines
155155 'Steven Sanderson, the Knockout.js team, and other contributors',
156156 'MIT',
157157 'https://raw.github.com/knockout/knockout/master/LICENSE'
158+ ], [
159+ 'Laravel',
160+ 'Taylor Otwell',
161+ 'MIT',
162+ 'https://raw.githubusercontent.com/laravel/framework/master/LICENSE.txt'
158163 ], [
159164 'Less',
160165 '2009-2014 The Core Less Team',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
2424 result
2525
2626 app.news = [
27− [ 1399161600000, # May 4, 2014
27+ [ 1400976000000, # May 25, 2014
28+ """ New <a href="/laravel/">Laravel</a> documentation """,
29+ ], [
30+ 1399161600000, # May 4, 2014
2831 """ New <a href="/express/">Express</a>, <a href="/grunt/">Grunt</a>, and <a href="/maxcdn/">MaxCDN</a> documentations """,
2932 ], [
3033 1396742400000, # April 6, 2014
assets/stylesheets/application.css.scss+1−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 'pages/knockout',
4040 'pages/git',
4141 'pages/grunt',
42+ 'pages/laravel',
4243 'pages/less',
4344 'pages/lodash',
4445 'pages/maxcdn',
assets/stylesheets/global/_icons.scss+2−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 width: 1rem;
55 height: 1rem;
66 background-image: image-url('icons.png');
7− background-size: 5rem 9rem;
7+ background-size: 5rem 10rem;
88 }
99
1010 @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
@@ -56,3 +56,4 @@ · 45 unmodified lines
5656 ._icon-express:before { background-position: -2rem -8rem; }
5757 ._icon-grunt:before { background-position: -3rem -8rem; }
5858 ._icon-maxcdn:before { background-position: -4rem -8rem; }
59+._icon-laravel:before { background-position: 0 -9rem; }
assets/stylesheets/pages/_laravel.scss+8−0
@@ -0,0 +1,8 @@
1+._sami {
2+ h2 { @extend %block-heading; }
3+ h3 { @extend %block-label, %label-blue; }
4+ h4 { font-size: 1em; }
5+
6+ blockquote { @extend %note; }
7+ p > code { @extend %label; }
8+}
lib/docs/filters/laravel/clean_html.rb+55−0
@@ -0,0 +1,55 @@
1+module Docs
2+ class Laravel
3+ class CleanHtmlFilter < Filter
4+ def call
5+ if subpath.start_with?('/api')
6+ api
7+ else
8+ other
9+ end
10+
11+ doc
12+ end
13+
14+ def api
15+ css('#footer', '.location').remove
16+
17+ # Replace .header with <h1>
18+ css('.header > h1').each do |node|
19+ node.parent.before(node).remove
20+ node.content = 'Laravel' if root_page?
21+ end
22+
23+ # Remove <abbr>
24+ css('a > abbr').each do |node|
25+ node.parent['title'] = node['title']
26+ node.before(node.children).remove
27+ end
28+
29+ # Clean up headings
30+ css('h1 > a', '.content', 'h3 > code', 'h3 strong', 'abbr').each do |node|
31+ node.before(node.children).remove
32+ end
33+
34+ # Remove empty <td>
35+ css('td').each do |node|
36+ node.remove if node.content =~ /\A\s+\z/
37+ end
38+ end
39+
40+ def other
41+ @doc = at_css('#docs-content')
42+
43+ # Clean up headings
44+ css('h2 > a').each do |node|
45+ node.before(node.children).remove
46+ end
47+
48+ # Remove code highlighting
49+ css('pre').each do |node|
50+ node.content = node.content
51+ end
52+ end
53+ end
54+ end
55+end
lib/docs/filters/laravel/entries.rb+40−0
@@ -0,0 +1,40 @@
1+module Docs
2+ class Laravel
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ if api_page?
6+ at_css('h1').content.strip.split('\\').last
7+ else
8+ at_css('h1').content.strip
9+ end
10+ end
11+
12+ def get_type
13+ if api_page?
14+ type = at_css('h1').content.strip.remove('Illuminate\\').remove(/\\\w+?\z/)
15+ type.end_with?('Console') ? type.split('\\').first : type
16+ else
17+ 'Guides'
18+ end
19+ end
20+
21+ def additional_entries
22+ return [] unless api_page?
23+
24+ css('h3[id^="method_"]').each_with_object [] do |node, entries|
25+ next if node.at_css('.location').content.start_with?('in')
26+
27+ name = node['id'].remove('method_')
28+ name.prepend "#{self.name}::"
29+ name << '()'
30+
31+ entries << [name, node['id']]
32+ end
33+ end
34+
35+ def api_page?
36+ subpath.start_with?('/api')
37+ end
38+ end
39+ end
40+end
lib/docs/scrapers/laravel.rb+39−0
@@ -0,0 +1,39 @@
1+module Docs
2+ class Laravel < UrlScraper
3+ self.name = 'Laravel'
4+ self.slug = 'laravel'
5+ self.type = 'laravel'
6+ self.version = '4.1.29'
7+ self.base_url = 'http://laravel.com'
8+ self.root_path = '/docs/introduction'
9+ self.initial_paths = %w(/api/4.1/namespaces.html)
10+
11+ html_filters.push 'laravel/entries', 'laravel/clean_html'
12+
13+ options[:container] = ->(filter) {
14+ filter.subpath.start_with?('/api') ? nil : '#documentation > article'
15+ }
16+
17+ options[:only_patterns] = [
18+ /\A\/api\/4\.1\//,
19+ /\A\/docs\//]
20+
21+ options[:skip] = %w(
22+ /docs/quick
23+ /docs/releases
24+ /docs/upgrade
25+ /docs/artisan
26+ /docs/commands
27+ /api/4.1/panel.html
28+ /api/4.1/classes.html
29+ /api/4.1/interfaces.html
30+ /api/4.1/traits.html
31+ /api/4.1/doc-index.html
32+ /api/4.1/Illuminate.html)
33+
34+ options[:attribution] = <<-HTML
35+ &copy; Taylor Otwell<br>
36+ Licensed under the MIT License.
37+ HTML
38+ end
39+end
public/icons/docs/laravel/16.png+0−0

Binary file not shown.

public/icons/docs/laravel/16@2x.png+0−0

Binary file not shown.

public/icons/docs/laravel/SOURCE+1−0
@@ -0,0 +1 @@
1+https://github.com/laravel/art

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t