onebox 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +7 -452
  4. data/Gemfile +1 -1
  5. data/README.md +23 -45
  6. data/lib/onebox.rb +21 -13
  7. data/lib/onebox/engine.rb +53 -43
  8. data/lib/onebox/engine/amazon_onebox.rb +34 -7
  9. data/lib/onebox/engine/classic_google_maps_onebox.rb +37 -0
  10. data/lib/onebox/engine/github_blob_onebox.rb +27 -7
  11. data/lib/onebox/engine/github_commit_onebox.rb +8 -15
  12. data/lib/onebox/engine/github_gist_onebox.rb +10 -10
  13. data/lib/onebox/engine/github_pullrequest_onebox.rb +7 -15
  14. data/lib/onebox/engine/google_play_app_onebox.rb +30 -0
  15. data/lib/onebox/engine/html.rb +10 -1
  16. data/lib/onebox/engine/image_onebox.rb +13 -0
  17. data/lib/onebox/engine/stack_exchange_onebox.rb +25 -11
  18. data/lib/onebox/engine/standard_embed.rb +48 -0
  19. data/lib/onebox/engine/twitter_status_onebox.rb +100 -0
  20. data/lib/onebox/engine/whitelisted_generic_onebox.rb +223 -0
  21. data/lib/onebox/engine/wikipedia_onebox.rb +27 -5
  22. data/lib/onebox/engine/youtube_onebox.rb +22 -0
  23. data/lib/onebox/helpers.rb +24 -0
  24. data/lib/onebox/layout.rb +67 -0
  25. data/lib/onebox/layout_support.rb +16 -0
  26. data/lib/onebox/matcher.rb +6 -1
  27. data/lib/onebox/preview.rb +19 -6
  28. data/lib/onebox/version.rb +1 -1
  29. data/lib/onebox/view.rb +7 -12
  30. data/onebox.gemspec +7 -5
  31. data/spec/fixtures/amazon.response +1336 -2971
  32. data/spec/fixtures/githubblob.response +49 -921
  33. data/spec/fixtures/{android.response → googleplayapp.response} +1 -1
  34. data/spec/fixtures/stackexchange.response +1 -1889
  35. data/spec/fixtures/twitterstatus.response +3006 -0
  36. data/spec/fixtures/youtube-json.response +1 -0
  37. data/spec/fixtures/youtube.response +1625 -0
  38. data/spec/lib/onebox/engine/amazon_onebox_spec.rb +5 -20
  39. data/spec/lib/onebox/engine/classic_google_maps_onebox_spec.rb +28 -0
  40. data/spec/lib/onebox/engine/github_blob_onebox_spec.rb +6 -15
  41. data/spec/lib/onebox/engine/github_commit_onebox_spec.rb +14 -22
  42. data/spec/lib/onebox/engine/github_gist_onebox_spec.rb +6 -14
  43. data/spec/lib/onebox/engine/github_pullrequest_onebox_spec.rb +14 -26
  44. data/spec/lib/onebox/engine/google_play_app_onebox_spec.rb +28 -0
  45. data/spec/lib/onebox/engine/html_spec.rb +4 -6
  46. data/spec/lib/onebox/engine/json_spec.rb +4 -6
  47. data/spec/lib/onebox/engine/stack_exchange_onebox_spec.rb +4 -17
  48. data/spec/lib/onebox/engine/twitter_status_onebox_spec.rb +103 -0
  49. data/spec/lib/onebox/engine/whitelisted_generic_onebox_spec.rb +51 -0
  50. data/spec/lib/onebox/engine/wikipedia_onebox_spec.rb +4 -17
  51. data/spec/lib/onebox/engine/youtube_onebox_spec.rb +17 -0
  52. data/spec/lib/onebox/engine_spec.rb +35 -32
  53. data/spec/lib/onebox/layout_spec.rb +77 -0
  54. data/spec/lib/onebox/matcher_spec.rb +0 -15
  55. data/spec/lib/onebox/preview_spec.rb +39 -9
  56. data/spec/lib/onebox_spec.rb +15 -11
  57. data/spec/spec_helper.rb +60 -4
  58. data/spec/support/html_spec_helper.rb +2 -1
  59. data/templates/_layout.mustache +11 -4
  60. data/templates/amazon.mustache +4 -3
  61. data/templates/githubblob.mustache +7 -5
  62. data/templates/githubcommit.mustache +20 -11
  63. data/templates/githubpullrequest.mustache +19 -12
  64. data/templates/googleplayapp.mustache +4 -0
  65. data/templates/stackexchange.mustache +19 -3
  66. data/templates/twitterstatus.mustache +12 -0
  67. data/templates/whitelistedgeneric.mustache +5 -0
  68. data/templates/wikipedia.mustache +4 -3
  69. metadata +57 -166
  70. data/lib/onebox/engine/bliptv_onebox.rb +0 -28
  71. data/lib/onebox/engine/clikthrough_onebox.rb +0 -25
  72. data/lib/onebox/engine/college_humor_onebox.rb +0 -27
  73. data/lib/onebox/engine/dailymotion_onebox.rb +0 -28
  74. data/lib/onebox/engine/dotsub_onebox.rb +0 -27
  75. data/lib/onebox/engine/example_onebox.rb +0 -24
  76. data/lib/onebox/engine/flickr_onebox.rb +0 -26
  77. data/lib/onebox/engine/funny_or_die_onebox.rb +0 -28
  78. data/lib/onebox/engine/hulu_onebox.rb +0 -29
  79. data/lib/onebox/engine/imgur_image_onebox.rb +0 -26
  80. data/lib/onebox/engine/itunes_onebox.rb +0 -28
  81. data/lib/onebox/engine/kinomap_onebox.rb +0 -27
  82. data/lib/onebox/engine/nfb_onebox.rb +0 -28
  83. data/lib/onebox/engine/open_graph.rb +0 -11
  84. data/lib/onebox/engine/qik_onebox.rb +0 -25
  85. data/lib/onebox/engine/revision3_onebox.rb +0 -27
  86. data/lib/onebox/engine/slideshare_onebox.rb +0 -27
  87. data/lib/onebox/engine/sound_cloud_onebox.rb +0 -27
  88. data/lib/onebox/engine/spotify_onebox.rb +0 -27
  89. data/lib/onebox/engine/ted_onebox.rb +0 -28
  90. data/lib/onebox/engine/twitter_onebox.rb +0 -31
  91. data/lib/onebox/engine/viddler_onebox.rb +0 -28
  92. data/lib/onebox/engine/vimeo_onebox.rb +0 -27
  93. data/lib/onebox/engine/yfrog_onebox.rb +0 -28
  94. data/spec/fixtures/bliptv.response +0 -724
  95. data/spec/fixtures/clikthrough.response +0 -1472
  96. data/spec/fixtures/collegehumor.response +0 -1272
  97. data/spec/fixtures/dailymotion.response +0 -575
  98. data/spec/fixtures/dotsub.response +0 -1257
  99. data/spec/fixtures/example.response +0 -50
  100. data/spec/fixtures/flickr.response +0 -1292
  101. data/spec/fixtures/funnyordie.response +0 -2010
  102. data/spec/fixtures/githubgist.response +0 -468
  103. data/spec/fixtures/hulu.response +0 -339
  104. data/spec/fixtures/imguralbum.response +0 -941
  105. data/spec/fixtures/imgurimage.response +0 -872
  106. data/spec/fixtures/itunes.response +0 -402
  107. data/spec/fixtures/kinomap.response +0 -299
  108. data/spec/fixtures/nfb.response +0 -810
  109. data/spec/fixtures/opengraph.response +0 -27
  110. data/spec/fixtures/qik.response +0 -371
  111. data/spec/fixtures/revision3.response +0 -985
  112. data/spec/fixtures/rottentomatoesfresh.response +0 -3275
  113. data/spec/fixtures/rottentomatoesincomplete.response +0 -2313
  114. data/spec/fixtures/rottentomatoesrotten.response +0 -3549
  115. data/spec/fixtures/slideshare.response +0 -1745
  116. data/spec/fixtures/soundcloud.response +0 -1409
  117. data/spec/fixtures/spotify.response +0 -250
  118. data/spec/fixtures/ted.response +0 -1341
  119. data/spec/fixtures/twitter.response +0 -1712
  120. data/spec/fixtures/viddler.response +0 -442
  121. data/spec/fixtures/vimeo.response +0 -571
  122. data/spec/fixtures/yfrog.response +0 -464
  123. data/spec/lib/onebox/engine/bliptv_onebox_spec.rb +0 -37
  124. data/spec/lib/onebox/engine/clikthrough_onebox_spec.rb +0 -29
  125. data/spec/lib/onebox/engine/college_humor_onebox_spec.rb +0 -37
  126. data/spec/lib/onebox/engine/dailymotion_onebox_spec.rb +0 -39
  127. data/spec/lib/onebox/engine/dotsub_onebox_spec.rb +0 -39
  128. data/spec/lib/onebox/engine/example_onebox_spec.rb +0 -21
  129. data/spec/lib/onebox/engine/flickr_onebox_spec.rb +0 -33
  130. data/spec/lib/onebox/engine/funny_or_die_onebox_spec.rb +0 -37
  131. data/spec/lib/onebox/engine/hulu_onebox_spec.rb +0 -37
  132. data/spec/lib/onebox/engine/imgur_image_onebox_spec.rb +0 -29
  133. data/spec/lib/onebox/engine/itunes_onebox_spec.rb +0 -29
  134. data/spec/lib/onebox/engine/kinomap_onebox_spec.rb +0 -37
  135. data/spec/lib/onebox/engine/nfb_onebox_spec.rb +0 -38
  136. data/spec/lib/onebox/engine/open_graph_spec.rb +0 -27
  137. data/spec/lib/onebox/engine/qik_onebox_spec.rb +0 -38
  138. data/spec/lib/onebox/engine/revision3_onebox_spec.rb +0 -39
  139. data/spec/lib/onebox/engine/slideshare_onebox_spec.rb +0 -33
  140. data/spec/lib/onebox/engine/sound_cloud_onebox_spec.rb +0 -39
  141. data/spec/lib/onebox/engine/spotify_onebox_spec.rb +0 -36
  142. data/spec/lib/onebox/engine/ted_onebox_spec.rb +0 -33
  143. data/spec/lib/onebox/engine/twitter_onebox_spec.rb +0 -47
  144. data/spec/lib/onebox/engine/viddler_onebox_spec.rb +0 -39
  145. data/spec/lib/onebox/engine/vimeo_onebox_spec.rb +0 -37
  146. data/spec/lib/onebox/engine/yfrog_onebox_spec.rb +0 -33
  147. data/spec/lib/onebox/view_spec.rb +0 -16
  148. data/templates/bliptv.mustache +0 -5
  149. data/templates/clikthrough.mustache +0 -4
  150. data/templates/collegehumor.mustache +0 -5
  151. data/templates/dailymotion.mustache +0 -5
  152. data/templates/dotsub.mustache +0 -5
  153. data/templates/example.mustache +0 -2
  154. data/templates/flickr.mustache +0 -4
  155. data/templates/funnyordie.mustache +0 -6
  156. data/templates/githubgist.mustache +0 -3
  157. data/templates/hulu.mustache +0 -6
  158. data/templates/imgurimage.mustache +0 -3
  159. data/templates/itunes.mustache +0 -4
  160. data/templates/kinomap.mustache +0 -5
  161. data/templates/nfb.mustache +0 -5
  162. data/templates/qik.mustache +0 -4
  163. data/templates/revision3.mustache +0 -5
  164. data/templates/slideshare.mustache +0 -4
  165. data/templates/soundcloud.mustache +0 -5
  166. data/templates/spotify.mustache +0 -4
  167. data/templates/ted.mustache +0 -5
  168. data/templates/twitter.mustache +0 -7
  169. data/templates/viddler.mustache +0 -5
  170. data/templates/vimeo.mustache +0 -5
  171. data/templates/yfrog.mustache +0 -4
@@ -1,922 +1,50 @@
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>
1
+ require_dependency 'oneboxer/handlebars_onebox'
2
+
3
+ module Oneboxer
4
+ class GithubBlobOnebox < HandlebarsOnebox
5
+
6
+ matcher /^https?:\/\/(?:www\.)?github\.com\/[^\/]+\/[^\/]+\/blob\/.*/
7
+ favicon 'github.png'
8
+
9
+ def translate_url
10
+ m = @url.match(/github\.com\/(?<user>[^\/]+)\/(?<repo>[^\/]+)\/blob\/(?<sha1>[^\/]+)\/(?<file>[^#]+)(#(L(?<from>[^-]*)(-L(?<to>.*))?))?/mi)
11
+ if m
12
+ @from = (m[:from] || -1).to_i
13
+ @to = (m[:to] || -1).to_i
14
+ @file = m[:file]
15
+ return "https://raw.github.com/#{m[:user]}/#{m[:repo]}/#{m[:sha1]}/#{m[:file]}"
16
+ end
17
+ nil
18
+ end
19
+
20
+ def parse(data)
21
+
22
+ if @from > 0
23
+ if @to < 0
24
+ @from = @from - 10
25
+ @to = @from + 20
26
+ end
27
+ if @to > @from
28
+ data = data.split("\n")[@from..@to].join("\n")
29
+ end
30
+ end
31
+
32
+ extension = @file.split(".")[-1]
33
+ @lang = case extension
34
+ when "rb" then "ruby"
35
+ when "js" then "javascript"
36
+ else extension
37
+ end
38
+
39
+ truncated = false
40
+ if data.length > SiteSetting.onebox_max_chars
41
+ data = data[0..SiteSetting.onebox_max_chars-1]
42
+ truncated = true
43
+ end
44
+
45
+ {content: data, truncated: truncated}
46
+ end
47
+
48
+ end
49
+ end
922
50