History

Add RDoc scraper and Ruby documentation

Thibaut committed 12 years ago

Commit 30931041 parent f5eb54717 files · +337 −-3Browse files

Showing the changes to assets/javascripts (3 of 17 files). Show all

Unified · Split

3 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  2. assets/javascripts/templates/pages/news_tmpl.coffee +4 −1
  3. assets/javascripts/views/pages/rdoc.coffee +20 −0
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -138,6 +138,11 @@ credits = [ · 137 unmodified lines
138 '1997-2013 The PHP Documentation Group',138 '1997-2013 The PHP Documentation Group',
139 'CC BY',139 'CC BY',
140 'http://creativecommons.org/licenses/by/3.0/'140 'http://creativecommons.org/licenses/by/3.0/'
141 ], [
142 'Ruby',
143 '1993-2013 Yukihiro Matsumoto',
144 'Ruby',
145 'https://www.ruby-lang.org/en/about/license.txt'
141 ], [146 ], [
142 'Sass',147 'Sass',
143 '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',148 '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
24 result24 result
25 25
26app.news = [26app.news = [
27 [ 1382572800000, # October 24, 201327 [ 1384560000000, # November 16, 2013
28 """ New <a href="/ruby/">Ruby</a> documentation """
29 ], [
30 1382572800000, # October 24, 2013
28 """ DevDocs is now <a href="https://github.com/Thibaut/devdocs">open source</a>. """31 """ DevDocs is now <a href="https://github.com/Thibaut/devdocs">open source</a>. """
29 ], [32 ], [
30 1381276800000, # October 9, 201333 1381276800000, # October 9, 2013
assets/javascripts/views/pages/rdoc.coffee+20−0
@@ -0,0 +1,20 @@
1#= require views/pages/base
2
3class app.views.RdocPage extends app.views.BasePage
4 @events:
5 click: 'onClick'
6
7 afterRender: ->
8 @highlightCode @findAll('pre.ruby'), 'ruby'
9 @highlightCode @findAll('pre.c'), 'clike'
10 return
11
12 onClick: (event) ->
13 return unless event.target.classList.contains 'method-click-advice'
14 $.stopEvent(event)
15
16 source = $ '.method-source-code', event.target.parentNode.parentNode
17 isShown = source.style.display is 'block'
18
19 source.style.display = if isShown then 'none' else 'block'
20 event.target.textContent = if isShown then 'Show source' else 'Hide source'