onebox 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +4 -0
  3. data/.travis.yml +4 -0
  4. data/README.md +154 -113
  5. data/lib/onebox.rb +6 -3
  6. data/lib/onebox/engine.rb +28 -26
  7. data/lib/onebox/engine/amazon_onebox.rb +4 -2
  8. data/lib/onebox/engine/bliptv_onebox.rb +4 -2
  9. data/lib/onebox/engine/clikthrough_onebox.rb +4 -2
  10. data/lib/onebox/engine/college_humor_onebox.rb +3 -2
  11. data/lib/onebox/engine/dailymotion_onebox.rb +4 -2
  12. data/lib/onebox/engine/dotsub_onebox.rb +4 -2
  13. data/lib/onebox/engine/example_onebox.rb +4 -5
  14. data/lib/onebox/engine/flickr_onebox.rb +3 -2
  15. data/lib/onebox/engine/funny_or_die_onebox.rb +4 -2
  16. data/lib/onebox/engine/github_blob_onebox.rb +28 -0
  17. data/lib/onebox/engine/github_commit_onebox.rb +43 -0
  18. data/lib/onebox/engine/github_gist_onebox.rb +33 -0
  19. data/lib/onebox/engine/github_pullrequest_onebox.rb +43 -0
  20. data/lib/onebox/engine/html.rb +1 -1
  21. data/lib/onebox/engine/hulu_onebox.rb +5 -2
  22. data/lib/onebox/engine/imgur_image_onebox.rb +26 -0
  23. data/lib/onebox/engine/itunes_onebox.rb +28 -0
  24. data/lib/onebox/engine/json.rb +11 -0
  25. data/lib/onebox/engine/kinomap_onebox.rb +27 -0
  26. data/lib/onebox/engine/nfb_onebox.rb +5 -2
  27. data/lib/onebox/engine/open_graph.rb +1 -1
  28. data/lib/onebox/engine/qik_onebox.rb +4 -2
  29. data/lib/onebox/engine/revision3_onebox.rb +3 -2
  30. data/lib/onebox/engine/slideshare_onebox.rb +4 -2
  31. data/lib/onebox/engine/sound_cloud_onebox.rb +4 -2
  32. data/lib/onebox/engine/spotify_onebox.rb +27 -0
  33. data/lib/onebox/engine/stack_exchange_onebox.rb +4 -2
  34. data/lib/onebox/engine/ted_onebox.rb +5 -2
  35. data/lib/onebox/engine/twitter_onebox.rb +31 -0
  36. data/lib/onebox/engine/viddler_onebox.rb +5 -3
  37. data/lib/onebox/engine/vimeo_onebox.rb +3 -2
  38. data/lib/onebox/engine/wikipedia_onebox.rb +4 -2
  39. data/lib/onebox/engine/yfrog_onebox.rb +5 -2
  40. data/lib/onebox/version.rb +1 -1
  41. data/lib/onebox/view.rb +21 -0
  42. data/onebox.gemspec +1 -1
  43. data/spec/fixtures/githubblob.response +922 -0
  44. data/spec/fixtures/githubcommit.response +87 -0
  45. data/spec/fixtures/githubgist.response +468 -0
  46. data/spec/fixtures/githubpullrequest.response +216 -0
  47. data/spec/fixtures/imguralbum.response +941 -0
  48. data/spec/fixtures/{imgur.response → imgurimage.response} +870 -890
  49. data/spec/fixtures/itunes.response +402 -0
  50. data/spec/fixtures/{rottentomatoes_fresh.response → rottentomatoesfresh.response} +0 -0
  51. data/spec/fixtures/{rottentomatoes_incomplete.response → rottentomatoesincomplete.response} +0 -0
  52. data/spec/fixtures/{rottentomatoes_rotten.response → rottentomatoesrotten.response} +0 -0
  53. data/spec/fixtures/spotify.response +250 -0
  54. data/spec/fixtures/{wikipedia_redirected.response → wikipediaredirected.response} +0 -0
  55. data/spec/lib/onebox/engine/{amazon_spec.rb → amazon_onebox_spec.rb} +7 -4
  56. data/spec/lib/onebox/engine/{bliptv_spec.rb → bliptv_onebox_spec.rb} +7 -4
  57. data/spec/lib/onebox/engine/{clikthrough_spec.rb → clikthrough_onebox_spec.rb} +7 -4
  58. data/spec/lib/onebox/engine/{college_humor_spec.rb → college_humor_onebox_spec.rb} +7 -4
  59. data/spec/lib/onebox/engine/{dailymotion_spec.rb → dailymotion_onebox_spec.rb} +7 -4
  60. data/spec/lib/onebox/engine/{dotsub_spec.rb → dotsub_onebox_spec.rb} +7 -4
  61. data/spec/lib/onebox/engine/example_onebox_spec.rb +21 -0
  62. data/spec/lib/onebox/engine/{flickr_spec.rb → flickr_onebox_spec.rb} +7 -4
  63. data/spec/lib/onebox/engine/{funny_or_die_spec.rb → funny_or_die_onebox_spec.rb} +7 -4
  64. data/spec/lib/onebox/engine/github_blob_onebox_spec.rb +30 -0
  65. data/spec/lib/onebox/engine/github_commit_onebox_spec.rb +61 -0
  66. data/spec/lib/onebox/engine/github_gist_onebox_spec.rb +29 -0
  67. data/spec/lib/onebox/engine/github_pullrequest_onebox_spec.rb +58 -0
  68. data/spec/lib/onebox/engine/html_spec.rb +27 -0
  69. data/spec/lib/onebox/engine/{hulu_spec.rb → hulu_onebox_spec.rb} +7 -4
  70. data/spec/lib/onebox/engine/imgur_image_onebox_spec.rb +29 -0
  71. data/spec/lib/onebox/engine/itunes_onebox_spec.rb +29 -0
  72. data/spec/lib/onebox/engine/json_spec.rb +27 -0
  73. data/spec/lib/onebox/engine/kinomap_onebox_spec.rb +37 -0
  74. data/spec/lib/onebox/engine/{nfb_spec.rb → nfb_onebox_spec.rb} +7 -4
  75. data/spec/lib/onebox/engine/open_graph_spec.rb +27 -0
  76. data/spec/lib/onebox/engine/{qik_spec.rb → qik_onebox_spec.rb} +7 -4
  77. data/spec/lib/onebox/engine/{revision3_spec.rb → revision3_onebox_spec.rb} +7 -4
  78. data/spec/lib/onebox/engine/{slideshare_spec.rb → slideshare_onebox_spec.rb} +7 -4
  79. data/spec/lib/onebox/engine/{sound_cloud_spec.rb → sound_cloud_onebox_spec.rb} +7 -4
  80. data/spec/lib/onebox/engine/spotify_onebox_spec.rb +36 -0
  81. data/spec/lib/onebox/engine/{stack_exchange_spec.rb → stack_exchange_onebox_spec.rb} +7 -4
  82. data/spec/lib/onebox/engine/{ted_spec.rb → ted_onebox_spec.rb} +7 -4
  83. data/spec/lib/onebox/engine/twitter_onebox_spec.rb +47 -0
  84. data/spec/lib/onebox/engine/{viddler_spec.rb → viddler_onebox_spec.rb} +7 -4
  85. data/spec/lib/onebox/engine/{vimeo_spec.rb → vimeo_onebox_spec.rb} +7 -4
  86. data/spec/lib/onebox/engine/{wikipedia_spec.rb → wikipedia_onebox_spec.rb} +7 -4
  87. data/spec/lib/onebox/engine/{yfrog_spec.rb → yfrog_onebox_spec.rb} +7 -4
  88. data/spec/lib/onebox/engine_spec.rb +38 -27
  89. data/spec/lib/onebox/preview_spec.rb +3 -1
  90. data/spec/lib/onebox/view_spec.rb +16 -0
  91. data/spec/lib/onebox_spec.rb +1 -1
  92. data/spec/spec_helper.rb +8 -3
  93. data/spec/support/html_spec_helper.rb +1 -1
  94. data/templates/_layout.mustache +4 -0
  95. data/templates/amazon.mustache +5 -0
  96. data/templates/bliptv.mustache +5 -0
  97. data/templates/clikthrough.mustache +4 -0
  98. data/templates/collegehumor.mustache +5 -0
  99. data/templates/dailymotion.mustache +5 -0
  100. data/templates/dotsub.mustache +5 -0
  101. data/templates/example.mustache +2 -0
  102. data/templates/flickr.mustache +4 -0
  103. data/templates/funnyordie.mustache +6 -0
  104. data/templates/githubblob.mustache +5 -0
  105. data/templates/githubcommit.mustache +11 -0
  106. data/templates/githubgist.mustache +3 -0
  107. data/templates/githubpullrequest.mustache +14 -0
  108. data/templates/hulu.mustache +6 -0
  109. data/templates/imgurimage.mustache +3 -0
  110. data/templates/itunes.mustache +4 -0
  111. data/templates/kinomap.mustache +5 -0
  112. data/templates/nfb.mustache +5 -0
  113. data/templates/qik.mustache +4 -0
  114. data/templates/revision3.mustache +5 -0
  115. data/templates/slideshare.mustache +4 -0
  116. data/templates/soundcloud.mustache +5 -0
  117. data/templates/spotify.mustache +4 -0
  118. data/templates/stackexchange.mustache +3 -0
  119. data/templates/ted.mustache +5 -0
  120. data/templates/twitter.mustache +7 -0
  121. data/templates/viddler.mustache +5 -0
  122. data/templates/vimeo.mustache +5 -0
  123. data/templates/wikipedia.mustache +4 -0
  124. data/templates/yfrog.mustache +4 -0
  125. metadata +139 -90
  126. data/spec/fixtures/apple.response +0 -391
  127. data/spec/fixtures/clickthrough.response +0 -1472
  128. data/spec/fixtures/gist.response +0 -282
  129. data/spec/fixtures/github_blob.response +0 -706
  130. data/spec/fixtures/github_commit.response +0 -881
  131. data/spec/fixtures/github_pullrequest.response +0 -1619
  132. data/spec/lib/onebox/engine/example_spec.rb +0 -18
  133. data/templates/amazon.handlebars +0 -9
  134. data/templates/bliptv.handlebars +0 -10
  135. data/templates/clickthrough.handlebars +0 -8
  136. data/templates/clikthrough.handlebars +0 -8
  137. data/templates/collegehumor.handlebars +0 -9
  138. data/templates/dailymotion.handlebars +0 -9
  139. data/templates/dotsub.handlebars +0 -9
  140. data/templates/flickr.handlebars +0 -8
  141. data/templates/funnyordie.handlebars +0 -9
  142. data/templates/hulu.handlebars +0 -9
  143. data/templates/nfb.handlebars +0 -8
  144. data/templates/qik.handlebars +0 -7
  145. data/templates/revision3.handlebars +0 -9
  146. data/templates/slideshare.handlebars +0 -8
  147. data/templates/soundcloud.handlebars +0 -9
  148. data/templates/stackexchange.handlebars +0 -7
  149. data/templates/ted.handlebars +0 -8
  150. data/templates/viddler.handlebars +0 -9
  151. data/templates/vimeo.handlebars +0 -9
  152. data/templates/wikipedia.handlebars +0 -8
  153. data/templates/yfrog.handlebars +0 -8
@@ -5,8 +5,9 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^http\:\/\/(.*\.)?revision3\.com\/.*$/
9
- find "revision3.com"
8
+ http
9
+ domain("revision3")
10
+ tld("com")
10
11
  end
11
12
 
12
13
  private
@@ -5,8 +5,10 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?\:\/\/(www\.)?slideshare\.net\/*\/.*$/
9
- find "slideshare.net"
8
+ http
9
+ maybe("www.")
10
+ domain("slideshare")
11
+ tld("net")
10
12
  end
11
13
 
12
14
  private
@@ -5,8 +5,10 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?:\/\/(?:www\.)?soundcloud\.com\/.+$/
9
- find "soundcloud.com"
8
+ http
9
+ maybe("www.")
10
+ domain("soundcloud")
11
+ tld("com")
10
12
  end
11
13
 
12
14
  private
@@ -0,0 +1,27 @@
1
+ module Onebox
2
+ module Engine
3
+ class SpotifyOnebox
4
+ include Engine
5
+ include OpenGraph
6
+
7
+ matches do
8
+ http
9
+ with("open.")
10
+ domain("spotify")
11
+ tld("com")
12
+ end
13
+
14
+ private
15
+
16
+ def data
17
+ {
18
+ url: @url,
19
+ title: raw.title,
20
+ image: raw.images.first,
21
+ description: raw.description
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -5,8 +5,10 @@ module Onebox
5
5
  include HTML
6
6
 
7
7
  matches do
8
- # /^http:\/\/(?:(?:(?<subsubdomain>\w*)\.)?(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
9
- find "stackexchange.com"
8
+ http
9
+ domain("stackoverflow")
10
+ tld("com")
11
+ with("/questions/")
10
12
  end
11
13
 
12
14
  private
@@ -5,8 +5,11 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?\:\/\/(www\.)?ted\.com\/talks\/.*$/
9
- find "ted.com"
8
+ http
9
+ maybe("www.")
10
+ domain("ted")
11
+ tld("com")
12
+ with("/talks/")
10
13
  end
11
14
 
12
15
  private
@@ -0,0 +1,31 @@
1
+ module Onebox
2
+ module Engine
3
+ class TwitterOnebox
4
+ include Engine
5
+ include HTML
6
+
7
+ matches do
8
+ http
9
+ maybe("www.")
10
+ domain("twitter")
11
+ tld("com")
12
+ anything
13
+ has("/status/")
14
+ end
15
+
16
+ private
17
+
18
+ def data
19
+ {
20
+ url: @url,
21
+ tweet_text: raw.css(".tweet-text").inner_text,
22
+ time_date: raw.css(".metadata span").inner_text,
23
+ user: raw.css(".stream-item-header .username").inner_text,
24
+ avatar: raw.css(".avatar")[2]["src"],
25
+ favorites: raw.css(".stats li .request-favorited-popup").inner_text,
26
+ retweets: raw.css(".stats li .request-retweeted-popup").inner_text
27
+ }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,12 +1,14 @@
1
- module Onebox
1
+ module Onebox
2
2
  module Engine
3
3
  class ViddlerOnebox
4
4
  include Engine
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?:\/\/(?:www\.)?viddler\.com\/.+$/
9
- find "viddler.com"
8
+ http
9
+ maybe("www.")
10
+ domain("viddler")
11
+ tld("com")
10
12
  end
11
13
 
12
14
  private
@@ -5,8 +5,9 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?\:\/\/vimeo\.com\/.*$/
9
- find "vimeo.com"
8
+ http
9
+ domain("vimeo")
10
+ tld("com")
10
11
  end
11
12
 
12
13
  private
@@ -5,8 +5,10 @@ module Onebox
5
5
  include HTML
6
6
 
7
7
  matches do
8
- # /^https?:\/\/.*wikipedia\.(com|org)\/.*$/
9
- find "wikipedia.com"
8
+ http
9
+ anything
10
+ domain("wikipedia")
11
+ either(".com", ".org")
10
12
  end
11
13
 
12
14
  private
@@ -5,8 +5,11 @@ module Onebox
5
5
  include OpenGraph
6
6
 
7
7
  matches do
8
- # /^https?:\/\/(?:www\.)?yfrog\.(com|ru|com\.tr|it|fr|co\.il|co\.uk|com\.pl|pl|eu|us)\/[a-zA-Z0-9]+/
9
- find "yfrog.com"
8
+ http
9
+ maybe("www.")
10
+ maybe("twitter.")
11
+ domain("yfrog")
12
+ either(".com", ".ru", ".tr", ".it", ".fr", ".co", ".uk", ".pl", ".eu", ".us")
10
13
  end
11
14
 
12
15
  private
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,21 @@
1
+ module Onebox
2
+ class View < Mustache
3
+ attr_reader :view
4
+
5
+ self.template_path = File.join(Gem::Specification.find_by_name("onebox").gem_dir, "templates")
6
+
7
+ def initialize(name, layout = false)
8
+ @layout = layout
9
+ self.template_name = unless @layout then name else "_layout" end
10
+ @view = View.new(name) if @layout
11
+ end
12
+
13
+ def to_html(record)
14
+ if @layout
15
+ render(url: record[:url], view: @view.to_html(record))
16
+ else
17
+ render(record)
18
+ end
19
+ end
20
+ end
21
+ end
data/onebox.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "mustache", "~> 0.99"
23
23
  spec.add_runtime_dependency "nokogiri", "~> 1.4"
24
24
  spec.add_runtime_dependency "opengraph_parser", "~> 0.2"
25
- spec.add_runtime_dependency "verbal_expressions", "~> 0.1"
25
+ spec.add_runtime_dependency "hexpress", "~> 1.2"
26
26
  spec.add_runtime_dependency "moneta", "~> 0.7"
27
27
  spec.add_development_dependency "bundler", "~> 1.3"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -0,0 +1,922 @@
1
+
2
+
3
+
4
+ <!DOCTYPE html>
5
+ <html>
6
+ <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
7
+ <meta charset='utf-8'>
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
+ <title>discourse/lib/oneboxer/github_blob_onebox.rb at master · discourse/discourse · GitHub</title>
10
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
11
+ <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
12
+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
13
+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
14
+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
15
+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
16
+ <link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
17
+ <meta property="og:image" content="https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png">
18
+ <meta name="hostname" content="github-fe121-cp1-prd.iad.github.net">
19
+ <meta name="ruby" content="ruby 1.9.3p194-tcs-github-tcmalloc (2012-05-25, TCS patched 2012-05-27, GitHub v1.0.36) [x86_64-linux]">
20
+ <link rel="assets" href="https://github.global.ssl.fastly.net/">
21
+ <link rel="conduit-xhr" href="https://ghconduit.com:25035/">
22
+ <link rel="xhr-socket" href="/_sockets" />
23
+
24
+
25
+
26
+ <meta name="msapplication-TileImage" content="/windows-tile.png" />
27
+ <meta name="msapplication-TileColor" content="#ffffff" />
28
+ <meta name="selected-link" value="repo_source" data-pjax-transient />
29
+ <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="4C576AE2:34F1:250FD3C:524BA190" name="octolytics-dimension-request_id" />
30
+
31
+
32
+
33
+
34
+ <link rel="icon" type="image/x-icon" href="/favicon.ico" />
35
+
36
+ <meta content="authenticity_token" name="csrf-param" />
37
+ <meta content="JdJTjxytA2XtJT0oxb+vwcdzMb0csOQRNtwyfZ2++0M=" name="csrf-token" />
38
+
39
+ <link href="https://github.global.ssl.fastly.net/assets/github-33cf54e1c25c41c1bb09506a6e93ef032819ce2c.css" media="all" rel="stylesheet" type="text/css" />
40
+ <link href="https://github.global.ssl.fastly.net/assets/github2-4e9347ae8f53d7710a27ba7dfdfb83229471a306.css" media="all" rel="stylesheet" type="text/css" />
41
+
42
+
43
+
44
+
45
+ <script src="https://github.global.ssl.fastly.net/assets/frameworks-4e5aeedcc7a86dcff8294cb84644a333b46202a2.js" type="text/javascript"></script>
46
+ <script src="https://github.global.ssl.fastly.net/assets/github-d7ac31eea49e88b740350eb21b88f43c6d4762e4.js" type="text/javascript"></script>
47
+
48
+ <meta http-equiv="x-pjax-version" content="e2af00064d49e9cdb439af3ae2437345">
49
+
50
+ <link data-pjax-transient rel='permalink' href='/discourse/discourse/blob/af467a16755d9d0b5cea325fd4503a5648ca5f8c/lib/oneboxer/github_blob_onebox.rb'>
51
+ <meta property="og:title" content="discourse"/>
52
+ <meta property="og:type" content="githubog:gitrepository"/>
53
+ <meta property="og:url" content="https://github.com/discourse/discourse"/>
54
+ <meta property="og:image" content="https://github.global.ssl.fastly.net/images/gravatars/gravatar-user-420.png"/>
55
+ <meta property="og:site_name" content="GitHub"/>
56
+ <meta property="og:description" content="discourse - A platform for community discussion. Free, open, simple."/>
57
+
58
+ <meta name="description" content="discourse - A platform for community discussion. Free, open, simple." />
59
+
60
+ <meta content="3220138" name="octolytics-dimension-user_id" /><meta content="discourse" name="octolytics-dimension-user_login" /><meta content="7569578" name="octolytics-dimension-repository_id" /><meta content="discourse/discourse" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="7569578" name="octolytics-dimension-repository_network_root_id" /><meta content="discourse/discourse" name="octolytics-dimension-repository_network_root_nwo" />
61
+ <link href="https://github.com/discourse/discourse/commits/master.atom" rel="alternate" title="Recent Commits to discourse:master" type="application/atom+xml" />
62
+
63
+ </head>
64
+
65
+
66
+ <body class="logged_out env-production vis-public page-blob">
67
+ <div class="wrapper">
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <div class="header header-logged-out">
75
+ <div class="container clearfix">
76
+
77
+ <a class="header-logo-wordmark" href="https://github.com/">
78
+ <span class="mega-octicon octicon-logo-github"></span>
79
+ </a>
80
+
81
+ <div class="header-actions">
82
+ <a class="button primary" href="/signup">Sign up</a>
83
+ <a class="button signin" href="/login?return_to=%2Fdiscourse%2Fdiscourse%2Fblob%2Fmaster%2Flib%2Foneboxer%2Fgithub_blob_onebox.rb">Sign in</a>
84
+ </div>
85
+
86
+ <div class="command-bar js-command-bar in-repository">
87
+
88
+ <ul class="top-nav">
89
+ <li class="explore"><a href="/explore">Explore</a></li>
90
+ <li class="features"><a href="/features">Features</a></li>
91
+ <li class="enterprise"><a href="https://enterprise.github.com/">Enterprise</a></li>
92
+ <li class="blog"><a href="/blog">Blog</a></li>
93
+ </ul>
94
+ <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
95
+
96
+ <input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
97
+
98
+
99
+ data-repo="discourse/discourse"
100
+ data-branch="master"
101
+ data-sha="9e03da6523981fcfd64e0864e61f25713b2e1af7"
102
+ >
103
+
104
+ <input type="hidden" name="nwo" value="discourse/discourse" />
105
+
106
+ <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
107
+ <span class="minibutton select-menu-button js-menu-target">
108
+ <span class="js-select-button">This repository</span>
109
+ </span>
110
+
111
+ <div class="select-menu-modal-holder js-menu-content js-navigation-container">
112
+ <div class="select-menu-modal">
113
+
114
+ <div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
115
+ <span class="select-menu-item-icon octicon octicon-check"></span>
116
+ <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
117
+ <div class="select-menu-item-text js-select-button-text">This repository</div>
118
+ </div> <!-- /.select-menu-item -->
119
+
120
+ <div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
121
+ <span class="select-menu-item-icon octicon octicon-check"></span>
122
+ <input type="radio" name="search_target" value="global" />
123
+ <div class="select-menu-item-text js-select-button-text">All repositories</div>
124
+ </div> <!-- /.select-menu-item -->
125
+
126
+ </div>
127
+ </div>
128
+ </div>
129
+
130
+ <span class="octicon help tooltipped downwards" title="Show command bar help">
131
+ <span class="octicon octicon-question"></span>
132
+ </span>
133
+
134
+
135
+ <input type="hidden" name="ref" value="cmdform">
136
+
137
+ </form>
138
+ </div>
139
+
140
+ </div>
141
+ </div>
142
+
143
+
144
+
145
+
146
+
147
+ <div class="site" itemscope itemtype="http://schema.org/WebPage">
148
+
149
+ <div class="pagehead repohead instapaper_ignore readability-menu">
150
+ <div class="container">
151
+
152
+
153
+ <ul class="pagehead-actions">
154
+
155
+
156
+ <li>
157
+ <a href="/login?return_to=%2Fdiscourse%2Fdiscourse"
158
+ class="minibutton with-count js-toggler-target star-button entice tooltipped upwards"
159
+ title="You must be signed in to use this feature" rel="nofollow">
160
+ <span class="octicon octicon-star"></span>Star
161
+ </a>
162
+ <a class="social-count js-social-count" href="/discourse/discourse/stargazers">
163
+ 7,869
164
+ </a>
165
+
166
+ </li>
167
+
168
+ <li>
169
+ <a href="/login?return_to=%2Fdiscourse%2Fdiscourse"
170
+ class="minibutton with-count js-toggler-target fork-button entice tooltipped upwards"
171
+ title="You must be signed in to fork a repository" rel="nofollow">
172
+ <span class="octicon octicon-git-branch"></span>Fork
173
+ </a>
174
+ <a href="/discourse/discourse/network" class="social-count">
175
+ 1,882
176
+ </a>
177
+ </li>
178
+ </ul>
179
+
180
+ <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
181
+ <span class="repo-label"><span>public</span></span>
182
+ <span class="mega-octicon octicon-repo"></span>
183
+ <span class="author">
184
+ <a href="/discourse" class="url fn" itemprop="url" rel="author"><span itemprop="title">discourse</span></a></span
185
+ ><span class="repohead-name-divider">/</span><strong
186
+ ><a href="/discourse/discourse" class="js-current-repository js-repo-home-link">discourse</a></strong>
187
+
188
+ <span class="page-context-loader">
189
+ <img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
190
+ </span>
191
+
192
+ </h1>
193
+ </div><!-- /.container -->
194
+ </div><!-- /.repohead -->
195
+
196
+ <div class="container">
197
+
198
+ <div class="repository-with-sidebar repo-container ">
199
+
200
+ <div class="repository-sidebar">
201
+
202
+
203
+ <div class="repo-nav repo-nav-full js-repository-container-pjax js-octicon-loaders">
204
+ <div class="repo-nav-contents">
205
+ <ul class="repo-menu">
206
+ <li class="tooltipped leftwards" title="Code">
207
+ <a href="/discourse/discourse" aria-label="Code" class="js-selected-navigation-item selected" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /discourse/discourse">
208
+ <span class="octicon octicon-code"></span> <span class="full-word">Code</span>
209
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
210
+ </a> </li>
211
+
212
+ <li class="tooltipped leftwards" title="Issues">
213
+ <a href="/discourse/discourse/issues" aria-label="Issues" class="js-selected-navigation-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /discourse/discourse/issues">
214
+ <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
215
+ <span class='counter'>40</span>
216
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
217
+ </a> </li>
218
+
219
+ <li class="tooltipped leftwards" title="Pull Requests"><a href="/discourse/discourse/pulls" aria-label="Pull Requests" class="js-selected-navigation-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /discourse/discourse/pulls">
220
+ <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
221
+ <span class='counter'>10</span>
222
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
223
+ </a> </li>
224
+
225
+
226
+ <li class="tooltipped leftwards" title="Wiki">
227
+ <a href="/discourse/discourse/wiki" aria-label="Wiki" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_wiki /discourse/discourse/wiki">
228
+ <span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>
229
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
230
+ </a> </li>
231
+ </ul>
232
+ <div class="repo-menu-separator"></div>
233
+ <ul class="repo-menu">
234
+
235
+ <li class="tooltipped leftwards" title="Pulse">
236
+ <a href="/discourse/discourse/pulse" aria-label="Pulse" class="js-selected-navigation-item " data-pjax="true" data-selected-links="pulse /discourse/discourse/pulse">
237
+ <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
238
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
239
+ </a> </li>
240
+
241
+ <li class="tooltipped leftwards" title="Graphs">
242
+ <a href="/discourse/discourse/graphs" aria-label="Graphs" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_graphs repo_contributors /discourse/discourse/graphs">
243
+ <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
244
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
245
+ </a> </li>
246
+
247
+ <li class="tooltipped leftwards" title="Network">
248
+ <a href="/discourse/discourse/network" aria-label="Network" class="js-selected-navigation-item js-disable-pjax" data-selected-links="repo_network /discourse/discourse/network">
249
+ <span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
250
+ <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
251
+ </a> </li>
252
+ </ul>
253
+
254
+
255
+ </div>
256
+ </div>
257
+
258
+ <div class="only-with-full-nav">
259
+
260
+
261
+
262
+
263
+ <div class="clone-url open"
264
+ data-protocol-type="http"
265
+ data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">
266
+ <h3><strong>HTTPS</strong> clone URL</h3>
267
+ <div class="clone-url-box">
268
+ <input type="text" class="clone js-url-field"
269
+ value="https://github.com/discourse/discourse.git" readonly="readonly">
270
+
271
+ <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/discourse/discourse.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
272
+ </div>
273
+ </div>
274
+
275
+
276
+
277
+ <div class="clone-url "
278
+ data-protocol-type="subversion"
279
+ data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
280
+ <h3><strong>Subversion</strong> checkout URL</h3>
281
+ <div class="clone-url-box">
282
+ <input type="text" class="clone js-url-field"
283
+ value="https://github.com/discourse/discourse" readonly="readonly">
284
+
285
+ <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/discourse/discourse" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
286
+ </div>
287
+ </div>
288
+
289
+
290
+ <p class="clone-options">You can clone with
291
+ <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
292
+ or <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>.
293
+ <span class="octicon help tooltipped upwards" title="Get help on which URL is right for you.">
294
+ <a href="https://help.github.com/articles/which-remote-url-should-i-use">
295
+ <span class="octicon octicon-question"></span>
296
+ </a>
297
+ </span>
298
+ </p>
299
+
300
+
301
+
302
+ <a href="/discourse/discourse/archive/master.zip"
303
+ class="minibutton sidebar-button"
304
+ title="Download this repository as a zip file"
305
+ rel="nofollow">
306
+ <span class="octicon octicon-cloud-download"></span>
307
+ Download ZIP
308
+ </a>
309
+ </div>
310
+ </div><!-- /.repository-sidebar -->
311
+
312
+ <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
313
+
314
+
315
+
316
+ <!-- blob contrib key: blob_contributors:v21:6d5b6c2c96d010ae9f2e5c516e200612 -->
317
+
318
+ <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
319
+
320
+ <a href="/discourse/discourse/find/master" data-pjax data-hotkey="t" class="js-show-file-finder" style="display:none">Show File Finder</a>
321
+
322
+ <div class="file-navigation">
323
+
324
+
325
+
326
+ <div class="select-menu js-menu-container js-select-menu" >
327
+ <span class="minibutton select-menu-button js-menu-target" data-hotkey="w"
328
+ data-master-branch="master"
329
+ data-ref="master"
330
+ role="button" aria-label="Switch branches or tags" tabindex="0">
331
+ <span class="octicon octicon-git-branch"></span>
332
+ <i>branch:</i>
333
+ <span class="js-select-button">master</span>
334
+ </span>
335
+
336
+ <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>
337
+
338
+ <div class="select-menu-modal">
339
+ <div class="select-menu-header">
340
+ <span class="select-menu-title">Switch branches/tags</span>
341
+ <span class="octicon octicon-remove-close js-menu-close"></span>
342
+ </div> <!-- /.select-menu-header -->
343
+
344
+ <div class="select-menu-filters">
345
+ <div class="select-menu-text-filter">
346
+ <input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
347
+ </div>
348
+ <div class="select-menu-tabs">
349
+ <ul>
350
+ <li class="select-menu-tab">
351
+ <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
352
+ </li>
353
+ <li class="select-menu-tab">
354
+ <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
355
+ </li>
356
+ </ul>
357
+ </div><!-- /.select-menu-tabs -->
358
+ </div><!-- /.select-menu-filters -->
359
+
360
+ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
361
+
362
+ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
363
+
364
+
365
+ <div class="select-menu-item js-navigation-item ">
366
+ <span class="select-menu-item-icon octicon octicon-check"></span>
367
+ <a href="/discourse/discourse/blob/auth_work/lib/oneboxer/github_blob_onebox.rb"
368
+ data-name="auth_work"
369
+ data-skip-pjax="true"
370
+ rel="nofollow"
371
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
372
+ title="auth_work">auth_work</a>
373
+ </div> <!-- /.select-menu-item -->
374
+ <div class="select-menu-item js-navigation-item ">
375
+ <span class="select-menu-item-icon octicon octicon-check"></span>
376
+ <a href="/discourse/discourse/blob/bus/lib/oneboxer/github_blob_onebox.rb"
377
+ data-name="bus"
378
+ data-skip-pjax="true"
379
+ rel="nofollow"
380
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
381
+ title="bus">bus</a>
382
+ </div> <!-- /.select-menu-item -->
383
+ <div class="select-menu-item js-navigation-item ">
384
+ <span class="select-menu-item-icon octicon octicon-check"></span>
385
+ <a href="/discourse/discourse/blob/ember-1.0/lib/oneboxer/github_blob_onebox.rb"
386
+ data-name="ember-1.0"
387
+ data-skip-pjax="true"
388
+ rel="nofollow"
389
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
390
+ title="ember-1.0">ember-1.0</a>
391
+ </div> <!-- /.select-menu-item -->
392
+ <div class="select-menu-item js-navigation-item ">
393
+ <span class="select-menu-item-icon octicon octicon-check"></span>
394
+ <a href="/discourse/discourse/blob/listview/lib/oneboxer/github_blob_onebox.rb"
395
+ data-name="listview"
396
+ data-skip-pjax="true"
397
+ rel="nofollow"
398
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
399
+ title="listview">listview</a>
400
+ </div> <!-- /.select-menu-item -->
401
+ <div class="select-menu-item js-navigation-item ">
402
+ <span class="select-menu-item-icon octicon octicon-check"></span>
403
+ <a href="/discourse/discourse/blob/markdown.js/lib/oneboxer/github_blob_onebox.rb"
404
+ data-name="markdown.js"
405
+ data-skip-pjax="true"
406
+ rel="nofollow"
407
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
408
+ title="markdown.js">markdown.js</a>
409
+ </div> <!-- /.select-menu-item -->
410
+ <div class="select-menu-item js-navigation-item selected">
411
+ <span class="select-menu-item-icon octicon octicon-check"></span>
412
+ <a href="/discourse/discourse/blob/master/lib/oneboxer/github_blob_onebox.rb"
413
+ data-name="master"
414
+ data-skip-pjax="true"
415
+ rel="nofollow"
416
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
417
+ title="master">master</a>
418
+ </div> <!-- /.select-menu-item -->
419
+ <div class="select-menu-item js-navigation-item ">
420
+ <span class="select-menu-item-icon octicon octicon-check"></span>
421
+ <a href="/discourse/discourse/blob/mdtest/lib/oneboxer/github_blob_onebox.rb"
422
+ data-name="mdtest"
423
+ data-skip-pjax="true"
424
+ rel="nofollow"
425
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
426
+ title="mdtest">mdtest</a>
427
+ </div> <!-- /.select-menu-item -->
428
+ <div class="select-menu-item js-navigation-item ">
429
+ <span class="select-menu-item-icon octicon octicon-check"></span>
430
+ <a href="/discourse/discourse/blob/mobile/lib/oneboxer/github_blob_onebox.rb"
431
+ data-name="mobile"
432
+ data-skip-pjax="true"
433
+ rel="nofollow"
434
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
435
+ title="mobile">mobile</a>
436
+ </div> <!-- /.select-menu-item -->
437
+ <div class="select-menu-item js-navigation-item ">
438
+ <span class="select-menu-item-icon octicon octicon-check"></span>
439
+ <a href="/discourse/discourse/blob/rails4/lib/oneboxer/github_blob_onebox.rb"
440
+ data-name="rails4"
441
+ data-skip-pjax="true"
442
+ rel="nofollow"
443
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
444
+ title="rails4">rails4</a>
445
+ </div> <!-- /.select-menu-item -->
446
+ <div class="select-menu-item js-navigation-item ">
447
+ <span class="select-menu-item-icon octicon octicon-check"></span>
448
+ <a href="/discourse/discourse/blob/security_changes/lib/oneboxer/github_blob_onebox.rb"
449
+ data-name="security_changes"
450
+ data-skip-pjax="true"
451
+ rel="nofollow"
452
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
453
+ title="security_changes">security_changes</a>
454
+ </div> <!-- /.select-menu-item -->
455
+ </div>
456
+
457
+ <div class="select-menu-no-results">Nothing to show</div>
458
+ </div> <!-- /.select-menu-list -->
459
+
460
+ <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
461
+ <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
462
+
463
+
464
+ <div class="select-menu-item js-navigation-item ">
465
+ <span class="select-menu-item-icon octicon octicon-check"></span>
466
+ <a href="/discourse/discourse/tree/v0.9.6.3/lib/oneboxer/github_blob_onebox.rb"
467
+ data-name="v0.9.6.3"
468
+ data-skip-pjax="true"
469
+ rel="nofollow"
470
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
471
+ title="v0.9.6.3">v0.9.6.3</a>
472
+ </div> <!-- /.select-menu-item -->
473
+ <div class="select-menu-item js-navigation-item ">
474
+ <span class="select-menu-item-icon octicon octicon-check"></span>
475
+ <a href="/discourse/discourse/tree/v0.9.6.2/lib/oneboxer/github_blob_onebox.rb"
476
+ data-name="v0.9.6.2"
477
+ data-skip-pjax="true"
478
+ rel="nofollow"
479
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
480
+ title="v0.9.6.2">v0.9.6.2</a>
481
+ </div> <!-- /.select-menu-item -->
482
+ <div class="select-menu-item js-navigation-item ">
483
+ <span class="select-menu-item-icon octicon octicon-check"></span>
484
+ <a href="/discourse/discourse/tree/v0.9.6.1/lib/oneboxer/github_blob_onebox.rb"
485
+ data-name="v0.9.6.1"
486
+ data-skip-pjax="true"
487
+ rel="nofollow"
488
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
489
+ title="v0.9.6.1">v0.9.6.1</a>
490
+ </div> <!-- /.select-menu-item -->
491
+ <div class="select-menu-item js-navigation-item ">
492
+ <span class="select-menu-item-icon octicon octicon-check"></span>
493
+ <a href="/discourse/discourse/tree/v0.9.6/lib/oneboxer/github_blob_onebox.rb"
494
+ data-name="v0.9.6"
495
+ data-skip-pjax="true"
496
+ rel="nofollow"
497
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
498
+ title="v0.9.6">v0.9.6</a>
499
+ </div> <!-- /.select-menu-item -->
500
+ <div class="select-menu-item js-navigation-item ">
501
+ <span class="select-menu-item-icon octicon octicon-check"></span>
502
+ <a href="/discourse/discourse/tree/v0.9.5.2/lib/oneboxer/github_blob_onebox.rb"
503
+ data-name="v0.9.5.2"
504
+ data-skip-pjax="true"
505
+ rel="nofollow"
506
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
507
+ title="v0.9.5.2">v0.9.5.2</a>
508
+ </div> <!-- /.select-menu-item -->
509
+ <div class="select-menu-item js-navigation-item ">
510
+ <span class="select-menu-item-icon octicon octicon-check"></span>
511
+ <a href="/discourse/discourse/tree/v0.9.5.1/lib/oneboxer/github_blob_onebox.rb"
512
+ data-name="v0.9.5.1"
513
+ data-skip-pjax="true"
514
+ rel="nofollow"
515
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
516
+ title="v0.9.5.1">v0.9.5.1</a>
517
+ </div> <!-- /.select-menu-item -->
518
+ <div class="select-menu-item js-navigation-item ">
519
+ <span class="select-menu-item-icon octicon octicon-check"></span>
520
+ <a href="/discourse/discourse/tree/v0.9.5/lib/oneboxer/github_blob_onebox.rb"
521
+ data-name="v0.9.5"
522
+ data-skip-pjax="true"
523
+ rel="nofollow"
524
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
525
+ title="v0.9.5">v0.9.5</a>
526
+ </div> <!-- /.select-menu-item -->
527
+ <div class="select-menu-item js-navigation-item ">
528
+ <span class="select-menu-item-icon octicon octicon-check"></span>
529
+ <a href="/discourse/discourse/tree/v0.9.4/lib/oneboxer/github_blob_onebox.rb"
530
+ data-name="v0.9.4"
531
+ data-skip-pjax="true"
532
+ rel="nofollow"
533
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
534
+ title="v0.9.4">v0.9.4</a>
535
+ </div> <!-- /.select-menu-item -->
536
+ <div class="select-menu-item js-navigation-item ">
537
+ <span class="select-menu-item-icon octicon octicon-check"></span>
538
+ <a href="/discourse/discourse/tree/v0.9.3.5/lib/oneboxer/github_blob_onebox.rb"
539
+ data-name="v0.9.3.5"
540
+ data-skip-pjax="true"
541
+ rel="nofollow"
542
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
543
+ title="v0.9.3.5">v0.9.3.5</a>
544
+ </div> <!-- /.select-menu-item -->
545
+ <div class="select-menu-item js-navigation-item ">
546
+ <span class="select-menu-item-icon octicon octicon-check"></span>
547
+ <a href="/discourse/discourse/tree/v0.9.3/lib/oneboxer/github_blob_onebox.rb"
548
+ data-name="v0.9.3"
549
+ data-skip-pjax="true"
550
+ rel="nofollow"
551
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
552
+ title="v0.9.3">v0.9.3</a>
553
+ </div> <!-- /.select-menu-item -->
554
+ <div class="select-menu-item js-navigation-item ">
555
+ <span class="select-menu-item-icon octicon octicon-check"></span>
556
+ <a href="/discourse/discourse/tree/v0.9.2.6/lib/oneboxer/github_blob_onebox.rb"
557
+ data-name="v0.9.2.6"
558
+ data-skip-pjax="true"
559
+ rel="nofollow"
560
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
561
+ title="v0.9.2.6">v0.9.2.6</a>
562
+ </div> <!-- /.select-menu-item -->
563
+ <div class="select-menu-item js-navigation-item ">
564
+ <span class="select-menu-item-icon octicon octicon-check"></span>
565
+ <a href="/discourse/discourse/tree/v0.9.2.5/lib/oneboxer/github_blob_onebox.rb"
566
+ data-name="v0.9.2.5"
567
+ data-skip-pjax="true"
568
+ rel="nofollow"
569
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
570
+ title="v0.9.2.5">v0.9.2.5</a>
571
+ </div> <!-- /.select-menu-item -->
572
+ <div class="select-menu-item js-navigation-item ">
573
+ <span class="select-menu-item-icon octicon octicon-check"></span>
574
+ <a href="/discourse/discourse/tree/v0.9.2/lib/oneboxer/github_blob_onebox.rb"
575
+ data-name="v0.9.2"
576
+ data-skip-pjax="true"
577
+ rel="nofollow"
578
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
579
+ title="v0.9.2">v0.9.2</a>
580
+ </div> <!-- /.select-menu-item -->
581
+ <div class="select-menu-item js-navigation-item ">
582
+ <span class="select-menu-item-icon octicon octicon-check"></span>
583
+ <a href="/discourse/discourse/tree/v0.9.1/lib/oneboxer/github_blob_onebox.rb"
584
+ data-name="v0.9.1"
585
+ data-skip-pjax="true"
586
+ rel="nofollow"
587
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
588
+ title="v0.9.1">v0.9.1</a>
589
+ </div> <!-- /.select-menu-item -->
590
+ <div class="select-menu-item js-navigation-item ">
591
+ <span class="select-menu-item-icon octicon octicon-check"></span>
592
+ <a href="/discourse/discourse/tree/v0.9.0/lib/oneboxer/github_blob_onebox.rb"
593
+ data-name="v0.9.0"
594
+ data-skip-pjax="true"
595
+ rel="nofollow"
596
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
597
+ title="v0.9.0">v0.9.0</a>
598
+ </div> <!-- /.select-menu-item -->
599
+ <div class="select-menu-item js-navigation-item ">
600
+ <span class="select-menu-item-icon octicon octicon-check"></span>
601
+ <a href="/discourse/discourse/tree/v0.8.9/lib/oneboxer/github_blob_onebox.rb"
602
+ data-name="v0.8.9"
603
+ data-skip-pjax="true"
604
+ rel="nofollow"
605
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
606
+ title="v0.8.9">v0.8.9</a>
607
+ </div> <!-- /.select-menu-item -->
608
+ <div class="select-menu-item js-navigation-item ">
609
+ <span class="select-menu-item-icon octicon octicon-check"></span>
610
+ <a href="/discourse/discourse/tree/v0.8.8/lib/oneboxer/github_blob_onebox.rb"
611
+ data-name="v0.8.8"
612
+ data-skip-pjax="true"
613
+ rel="nofollow"
614
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
615
+ title="v0.8.8">v0.8.8</a>
616
+ </div> <!-- /.select-menu-item -->
617
+ <div class="select-menu-item js-navigation-item ">
618
+ <span class="select-menu-item-icon octicon octicon-check"></span>
619
+ <a href="/discourse/discourse/tree/v0.8.7/lib/oneboxer/github_blob_onebox.rb"
620
+ data-name="v0.8.7"
621
+ data-skip-pjax="true"
622
+ rel="nofollow"
623
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
624
+ title="v0.8.7">v0.8.7</a>
625
+ </div> <!-- /.select-menu-item -->
626
+ <div class="select-menu-item js-navigation-item ">
627
+ <span class="select-menu-item-icon octicon octicon-check"></span>
628
+ <a href="/discourse/discourse/tree/v0.8.6/lib/oneboxer/github_blob_onebox.rb"
629
+ data-name="v0.8.6"
630
+ data-skip-pjax="true"
631
+ rel="nofollow"
632
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
633
+ title="v0.8.6">v0.8.6</a>
634
+ </div> <!-- /.select-menu-item -->
635
+ <div class="select-menu-item js-navigation-item ">
636
+ <span class="select-menu-item-icon octicon octicon-check"></span>
637
+ <a href="/discourse/discourse/tree/v0.8.5/lib/oneboxer/github_blob_onebox.rb"
638
+ data-name="v0.8.5"
639
+ data-skip-pjax="true"
640
+ rel="nofollow"
641
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
642
+ title="v0.8.5">v0.8.5</a>
643
+ </div> <!-- /.select-menu-item -->
644
+ <div class="select-menu-item js-navigation-item ">
645
+ <span class="select-menu-item-icon octicon octicon-check"></span>
646
+ <a href="/discourse/discourse/tree/v0.8.4/lib/oneboxer/github_blob_onebox.rb"
647
+ data-name="v0.8.4"
648
+ data-skip-pjax="true"
649
+ rel="nofollow"
650
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
651
+ title="v0.8.4">v0.8.4</a>
652
+ </div> <!-- /.select-menu-item -->
653
+ <div class="select-menu-item js-navigation-item ">
654
+ <span class="select-menu-item-icon octicon octicon-check"></span>
655
+ <a href="/discourse/discourse/tree/v0.8.3/lib/oneboxer/github_blob_onebox.rb"
656
+ data-name="v0.8.3"
657
+ data-skip-pjax="true"
658
+ rel="nofollow"
659
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
660
+ title="v0.8.3">v0.8.3</a>
661
+ </div> <!-- /.select-menu-item -->
662
+ <div class="select-menu-item js-navigation-item ">
663
+ <span class="select-menu-item-icon octicon octicon-check"></span>
664
+ <a href="/discourse/discourse/tree/v0.8.2/lib/oneboxer/github_blob_onebox.rb"
665
+ data-name="v0.8.2"
666
+ data-skip-pjax="true"
667
+ rel="nofollow"
668
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
669
+ title="v0.8.2">v0.8.2</a>
670
+ </div> <!-- /.select-menu-item -->
671
+ <div class="select-menu-item js-navigation-item ">
672
+ <span class="select-menu-item-icon octicon octicon-check"></span>
673
+ <a href="/discourse/discourse/tree/v0.8.1/lib/oneboxer/github_blob_onebox.rb"
674
+ data-name="v0.8.1"
675
+ data-skip-pjax="true"
676
+ rel="nofollow"
677
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
678
+ title="v0.8.1">v0.8.1</a>
679
+ </div> <!-- /.select-menu-item -->
680
+ <div class="select-menu-item js-navigation-item ">
681
+ <span class="select-menu-item-icon octicon octicon-check"></span>
682
+ <a href="/discourse/discourse/tree/v0.8.0/lib/oneboxer/github_blob_onebox.rb"
683
+ data-name="v0.8.0"
684
+ data-skip-pjax="true"
685
+ rel="nofollow"
686
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
687
+ title="v0.8.0">v0.8.0</a>
688
+ </div> <!-- /.select-menu-item -->
689
+ <div class="select-menu-item js-navigation-item ">
690
+ <span class="select-menu-item-icon octicon octicon-check"></span>
691
+ <a href="/discourse/discourse/tree/latest-release/lib/oneboxer/github_blob_onebox.rb"
692
+ data-name="latest-release"
693
+ data-skip-pjax="true"
694
+ rel="nofollow"
695
+ class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
696
+ title="latest-release">latest-release</a>
697
+ </div> <!-- /.select-menu-item -->
698
+ </div>
699
+
700
+ <div class="select-menu-no-results">Nothing to show</div>
701
+ </div> <!-- /.select-menu-list -->
702
+
703
+ </div> <!-- /.select-menu-modal -->
704
+ </div> <!-- /.select-menu-modal-holder -->
705
+ </div> <!-- /.select-menu -->
706
+
707
+ <div class="breadcrumb">
708
+ <span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/discourse/discourse" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">discourse</span></a></span></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/discourse/discourse/tree/master/lib" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">lib</span></a></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/discourse/discourse/tree/master/lib/oneboxer" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">oneboxer</span></a></span><span class="separator"> / </span><strong class="final-path">github_blob_onebox.rb</strong> <span class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="lib/oneboxer/github_blob_onebox.rb" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
709
+ </div>
710
+ </div>
711
+
712
+
713
+
714
+ <div class="commit file-history-tease">
715
+ <img class="main-avatar" height="24" src="https://2.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9?d=https%3A%2F%2Fidenticons.github.com%2Fba01baa4856d494a66a0d5eca39f5418.png&amp;s=140" width="24" />
716
+ <span class="author"><a href="/eviltrout" rel="author">eviltrout</a></span>
717
+ <time class="js-relative-date" datetime="2013-02-26T07:42:49-08:00" title="2013-02-26 07:42:49">February 26, 2013</time>
718
+ <div class="commit-title">
719
+ <a href="/discourse/discourse/commit/1221c393a37177658b8103699cc71e05bd5345a1" class="message" data-pjax="true" title="Merge branch &#39;whitespace-cleanese&#39; of git://github.com/goshakkk/discours...
720
+
721
+ ...e
722
+
723
+ Conflicts:
724
+ lib/oneboxer.rb
725
+ lib/oneboxer/whitelist.rb
726
+ spec/controllers/robots_txt_controller_spec.rb">Merge branch 'whitespace-cleanese' of git://github.com/goshakkk/disco…</a>
727
+ </div>
728
+
729
+ <div class="participation">
730
+ <p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>3</strong> contributors</a></p>
731
+ <a class="avatar tooltipped downwards" title="eviltrout" href="/discourse/discourse/commits/master/lib/oneboxer/github_blob_onebox.rb?author=eviltrout"><img height="20" src="https://2.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9?d=https%3A%2F%2Fidenticons.github.com%2Fba01baa4856d494a66a0d5eca39f5418.png&amp;s=140" width="20" /></a>
732
+ <a class="avatar tooltipped downwards" title="jeremybanks" href="/discourse/discourse/commits/master/lib/oneboxer/github_blob_onebox.rb?author=jeremybanks"><img height="20" src="https://0.gravatar.com/avatar/bd192f0a40308fe9ecb9aa2a72ee8d81?d=https%3A%2F%2Fidenticons.github.com%2F540cfc2804c3f507c28c8942f1e90343.png&amp;s=140" width="20" /></a>
733
+ <a class="avatar tooltipped downwards" title="goshakkk" href="/discourse/discourse/commits/master/lib/oneboxer/github_blob_onebox.rb?author=goshakkk"><img height="20" src="https://0.gravatar.com/avatar/477dc65c2083c0aea87485b399372db0?d=https%3A%2F%2Fidenticons.github.com%2F8e6fe8f267d3b31fe2e5b5da1787a120.png&amp;s=140" width="20" /></a>
734
+
735
+
736
+ </div>
737
+ <div id="blob_contributors_box" style="display:none">
738
+ <h2 class="facebox-header">Users who have contributed to this file</h2>
739
+ <ul class="facebox-user-list">
740
+ <li class="facebox-user-list-item">
741
+ <img height="24" src="https://2.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9?d=https%3A%2F%2Fidenticons.github.com%2Fba01baa4856d494a66a0d5eca39f5418.png&amp;s=140" width="24" />
742
+ <a href="/eviltrout">eviltrout</a>
743
+ </li>
744
+ <li class="facebox-user-list-item">
745
+ <img height="24" src="https://0.gravatar.com/avatar/bd192f0a40308fe9ecb9aa2a72ee8d81?d=https%3A%2F%2Fidenticons.github.com%2F540cfc2804c3f507c28c8942f1e90343.png&amp;s=140" width="24" />
746
+ <a href="/jeremybanks">jeremybanks</a>
747
+ </li>
748
+ <li class="facebox-user-list-item">
749
+ <img height="24" src="https://0.gravatar.com/avatar/477dc65c2083c0aea87485b399372db0?d=https%3A%2F%2Fidenticons.github.com%2F8e6fe8f267d3b31fe2e5b5da1787a120.png&amp;s=140" width="24" />
750
+ <a href="/goshakkk">goshakkk</a>
751
+ </li>
752
+ </ul>
753
+ </div>
754
+ </div>
755
+
756
+ <div id="files" class="bubble">
757
+ <div class="file">
758
+ <div class="meta">
759
+ <div class="info">
760
+ <span class="icon"><b class="octicon octicon-file-text"></b></span>
761
+ <span class="mode" title="File Mode">file</span>
762
+ <span>50 lines (40 sloc)</span>
763
+ <span>1.262 kb</span>
764
+ </div>
765
+ <div class="actions">
766
+ <div class="button-group">
767
+ <a class="minibutton disabled js-entice" href=""
768
+ data-entice="You must be signed in to make or propose changes">Edit</a>
769
+ <a href="/discourse/discourse/raw/master/lib/oneboxer/github_blob_onebox.rb" class="button minibutton " id="raw-url">Raw</a>
770
+ <a href="/discourse/discourse/blame/master/lib/oneboxer/github_blob_onebox.rb" class="button minibutton ">Blame</a>
771
+ <a href="/discourse/discourse/commits/master/lib/oneboxer/github_blob_onebox.rb" class="button minibutton " rel="nofollow">History</a>
772
+ </div><!-- /.button-group -->
773
+ <a class="minibutton danger empty-icon js-entice" href=""
774
+ data-entice="You must be signed in and on a branch to make or propose changes">
775
+ Delete
776
+ </a>
777
+ </div><!-- /.actions -->
778
+
779
+ </div>
780
+ <div class="blob-wrapper data type-ruby js-blob-data">
781
+ <table class="file-code file-diff">
782
+ <tr class="file-code-line">
783
+ <td class="blob-line-nums">
784
+ <span id="L1" rel="#L1">1</span>
785
+ <span id="L2" rel="#L2">2</span>
786
+ <span id="L3" rel="#L3">3</span>
787
+ <span id="L4" rel="#L4">4</span>
788
+ <span id="L5" rel="#L5">5</span>
789
+ <span id="L6" rel="#L6">6</span>
790
+ <span id="L7" rel="#L7">7</span>
791
+ <span id="L8" rel="#L8">8</span>
792
+ <span id="L9" rel="#L9">9</span>
793
+ <span id="L10" rel="#L10">10</span>
794
+ <span id="L11" rel="#L11">11</span>
795
+ <span id="L12" rel="#L12">12</span>
796
+ <span id="L13" rel="#L13">13</span>
797
+ <span id="L14" rel="#L14">14</span>
798
+ <span id="L15" rel="#L15">15</span>
799
+ <span id="L16" rel="#L16">16</span>
800
+ <span id="L17" rel="#L17">17</span>
801
+ <span id="L18" rel="#L18">18</span>
802
+ <span id="L19" rel="#L19">19</span>
803
+ <span id="L20" rel="#L20">20</span>
804
+ <span id="L21" rel="#L21">21</span>
805
+ <span id="L22" rel="#L22">22</span>
806
+ <span id="L23" rel="#L23">23</span>
807
+ <span id="L24" rel="#L24">24</span>
808
+ <span id="L25" rel="#L25">25</span>
809
+ <span id="L26" rel="#L26">26</span>
810
+ <span id="L27" rel="#L27">27</span>
811
+ <span id="L28" rel="#L28">28</span>
812
+ <span id="L29" rel="#L29">29</span>
813
+ <span id="L30" rel="#L30">30</span>
814
+ <span id="L31" rel="#L31">31</span>
815
+ <span id="L32" rel="#L32">32</span>
816
+ <span id="L33" rel="#L33">33</span>
817
+ <span id="L34" rel="#L34">34</span>
818
+ <span id="L35" rel="#L35">35</span>
819
+ <span id="L36" rel="#L36">36</span>
820
+ <span id="L37" rel="#L37">37</span>
821
+ <span id="L38" rel="#L38">38</span>
822
+ <span id="L39" rel="#L39">39</span>
823
+ <span id="L40" rel="#L40">40</span>
824
+ <span id="L41" rel="#L41">41</span>
825
+ <span id="L42" rel="#L42">42</span>
826
+ <span id="L43" rel="#L43">43</span>
827
+ <span id="L44" rel="#L44">44</span>
828
+ <span id="L45" rel="#L45">45</span>
829
+ <span id="L46" rel="#L46">46</span>
830
+ <span id="L47" rel="#L47">47</span>
831
+ <span id="L48" rel="#L48">48</span>
832
+ <span id="L49" rel="#L49">49</span>
833
+
834
+ </td>
835
+ <td class="blob-line-code">
836
+ <div class="highlight"><pre><div class='line' id='LC1'><span class="n">require_dependency</span> <span class="s1">&#39;oneboxer/handlebars_onebox&#39;</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="k">module</span> <span class="nn">Oneboxer</span></div><div class='line' id='LC4'>&nbsp;&nbsp;<span class="k">class</span> <span class="nc">GithubBlobOnebox</span> <span class="o">&lt;</span> <span class="no">HandlebarsOnebox</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">matcher</span> <span class="sr">/^https?:\/\/(?:www\.)?github\.com\/[^\/]+\/[^\/]+\/blob\/.*/</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">favicon</span> <span class="s1">&#39;github.png&#39;</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">translate_url</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">m</span> <span class="o">=</span> <span class="vi">@url</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="sr">/github\.com\/(?&lt;user&gt;[^\/]+)\/(?&lt;repo&gt;[^\/]+)\/blob\/(?&lt;sha1&gt;[^\/]+)\/(?&lt;file&gt;[^#]+)(#(L(?&lt;from&gt;[^-]*)(-L(?&lt;to&gt;.*))?))?/mi</span><span class="p">)</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="n">m</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@from</span> <span class="o">=</span> <span class="p">(</span><span class="n">m</span><span class="o">[</span><span class="ss">:from</span><span class="o">]</span> <span class="o">||</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">to_i</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@to</span> <span class="o">=</span> <span class="p">(</span><span class="n">m</span><span class="o">[</span><span class="ss">:to</span><span class="o">]</span> <span class="o">||</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">to_i</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@file</span> <span class="o">=</span> <span class="n">m</span><span class="o">[</span><span class="ss">:file</span><span class="o">]</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="s2">&quot;https://raw.github.com/</span><span class="si">#{</span><span class="n">m</span><span class="o">[</span><span class="ss">:user</span><span class="o">]</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">m</span><span class="o">[</span><span class="ss">:repo</span><span class="o">]</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">m</span><span class="o">[</span><span class="ss">:sha1</span><span class="o">]</span><span class="si">}</span><span class="s2">/</span><span class="si">#{</span><span class="n">m</span><span class="o">[</span><span class="ss">:file</span><span class="o">]</span><span class="si">}</span><span class="s2">&quot;</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kp">nil</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">data</span><span class="p">)</span></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="vi">@from</span> <span class="o">&gt;</span> <span class="mi">0</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="vi">@to</span> <span class="o">&lt;</span> <span class="mi">0</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@from</span> <span class="o">=</span> <span class="vi">@from</span> <span class="o">-</span> <span class="mi">10</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@to</span> <span class="o">=</span> <span class="vi">@from</span> <span class="o">+</span> <span class="mi">20</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="vi">@to</span> <span class="o">&gt;</span> <span class="vi">@from</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span><span class="o">[</span><span class="vi">@from</span><span class="o">.</span><span class="n">.</span><span class="vi">@to</span><span class="o">].</span><span class="n">join</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC31'><br/></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">extension</span> <span class="o">=</span> <span class="vi">@file</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">)</span><span class="o">[-</span><span class="mi">1</span><span class="o">]</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="vi">@lang</span> <span class="o">=</span> <span class="k">case</span> <span class="n">extension</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">when</span> <span class="s2">&quot;rb&quot;</span> <span class="k">then</span> <span class="s2">&quot;ruby&quot;</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">when</span> <span class="s2">&quot;js&quot;</span> <span class="k">then</span> <span class="s2">&quot;javascript&quot;</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="n">extension</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC38'><br/></div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">truncated</span> <span class="o">=</span> <span class="kp">false</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">length</span> <span class="o">&gt;</span> <span class="no">SiteSetting</span><span class="o">.</span><span class="n">onebox_max_chars</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">[</span><span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="no">SiteSetting</span><span class="o">.</span><span class="n">onebox_max_chars</span><span class="o">-</span><span class="mi">1</span><span class="o">]</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">truncated</span> <span class="o">=</span> <span class="kp">true</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC44'><br/></div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span><span class="ss">content</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span> <span class="ss">truncated</span><span class="p">:</span> <span class="n">truncated</span><span class="p">}</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'>&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC49'><span class="k">end</span></div></pre></div>
837
+ </td>
838
+ </tr>
839
+ </table>
840
+ </div>
841
+
842
+ </div>
843
+ </div>
844
+
845
+ <a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
846
+ <div id="jump-to-line" style="display:none">
847
+ <form accept-charset="UTF-8" class="js-jump-to-line-form">
848
+ <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" autofocus>
849
+ <button type="submit" class="button">Go</button>
850
+ </form>
851
+ </div>
852
+
853
+ </div>
854
+
855
+ </div><!-- /.repo-container -->
856
+ <div class="modal-backdrop"></div>
857
+ </div><!-- /.container -->
858
+ </div><!-- /.site -->
859
+
860
+
861
+ </div><!-- /.wrapper -->
862
+
863
+ <div class="container">
864
+ <div class="site-footer">
865
+ <ul class="site-footer-links right">
866
+ <li><a href="https://status.github.com/">Status</a></li>
867
+ <li><a href="http://developer.github.com">API</a></li>
868
+ <li><a href="http://training.github.com">Training</a></li>
869
+ <li><a href="http://shop.github.com">Shop</a></li>
870
+ <li><a href="/blog">Blog</a></li>
871
+ <li><a href="/about">About</a></li>
872
+
873
+ </ul>
874
+
875
+ <a href="/">
876
+ <span class="mega-octicon octicon-mark-github"></span>
877
+ </a>
878
+
879
+ <ul class="site-footer-links">
880
+ <li>&copy; 2013 <span title="0.02166s from github-fe121-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
881
+ <li><a href="/site/terms">Terms</a></li>
882
+ <li><a href="/site/privacy">Privacy</a></li>
883
+ <li><a href="/security">Security</a></li>
884
+ <li><a href="/contact">Contact</a></li>
885
+ </ul>
886
+ </div><!-- /.site-footer -->
887
+ </div><!-- /.container -->
888
+
889
+
890
+ <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
891
+ <div class="fullscreen-container js-fullscreen-container">
892
+ <div class="textarea-wrap">
893
+ <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
894
+ <div class="suggester-container">
895
+ <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
896
+ data-url="/discourse/discourse/suggestions/commit">
897
+ </div>
898
+ </div>
899
+ </div>
900
+ </div>
901
+ <div class="fullscreen-sidebar">
902
+ <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
903
+ <span class="mega-octicon octicon-screen-normal"></span>
904
+ </a>
905
+ <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
906
+ title="Switch themes">
907
+ <span class="octicon octicon-color-mode"></span>
908
+ </a>
909
+ </div>
910
+ </div>
911
+
912
+
913
+
914
+ <div id="ajax-error-message" class="flash flash-error">
915
+ <span class="octicon octicon-alert"></span>
916
+ <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
917
+ Something went wrong with that request. Please try again.
918
+ </div>
919
+
920
+ </body>
921
+ </html>
922
+