yard-slipstream 0.0.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,49 @@
1
1
  = yard-slipstream
2
2
 
3
- Description goes here.
3
+ Small-to-meduim facelift on the default yard template. This yard plugin aims is to make yard documentation as clear and concise as possible. If you ever found yard documents were a bit hard to read, but of a strain. There arent many new features in this template. A few bug fixes.
4
4
 
5
- == Note on Patches/Pull Requests
5
+ So go on, lets give yard a styleover.
6
+
7
+ == Demo
8
+
9
+ http://dreamcat4.github.com/plist4r/
10
+
11
+ == Usage
12
+
13
+ gem install yard-slipstream
14
+
15
+ * Generate your documentation with yard as per the nomal process. For jeweler, then `rake yard`. The plugin is auto-loaded from rubygems. If you use bundler in your project, Bundler wont load this plugin automatically. So it must be added it to your projects `Gemfile`.
16
+
17
+ * This template is 100% compatible with yard version `0.5.4`. So for the safe road, use with `yard 0.5.4`. Other versions of yard are also known to in variying degrees. (0.5.3, 0.5.5, etc).
18
+
19
+ * Yard-slipstream doesnt work on yardoc.org. Sorry. For technical reasons its not possible, although there may be future plans to eventually open up yardoc.org. We recommend to generate your docs locally, and push them up to github / gh-pages. Your docs should still do everything that they would on yardoc.org, including Search.
20
+
21
+ == Improvements
22
+
23
+ * Blue search box to replace 3 seperate drop-down menus (Files List, Methods List, Class List)
24
+ * The blue Search box is similar as per yardoc.org, but positioned in top-right corner
25
+ * New backend to power the search box (loads onfocus a local json file 'search_index.json')
26
+ * New Frames | No Frames hyperlinks bar. Top right, next to search.
27
+ * '_index.html' renamed to 'object_index.html' to avoid conflicts with jekyll / gh-pages
28
+ * The above fix allows yard docs to be nestable within gh-pages / jekyll website
29
+ * Better scrolling to embedded page links (yard issue-102)
30
+ * Certain object navigation links emphasized (easier to click on / better prominence)
31
+ * More rdoc-like method navigation (via the method ribbons)
32
+ * A couple of sections re-ordered to work better in the new layout
33
+
34
+ == Whats left the same?
35
+
36
+ * Same basic fundamental layout. Which was already good to begin with.
37
+ * Well, all of the other best aspects / detail from the original yard template. (We hope!)
38
+ * We havent unintentionally broken anything from yard 0.5.4. We promise.
39
+
40
+ == Future compatibility / Support
6
41
 
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
42
+ * The default yard template is a moving target, it changes on pretty much every new patch release.
43
+ * This is a plugin to change the asthetics, and therefore it depends heavily on overriding the default yard template.
44
+ * Some overrides may block future new features of yard becoming visible until the template is updated. This is usually pretty easy to fix. Just a straightforward merge of the new yard code.
45
+ * Send me a pull request. Bonus points for describing what it fixes.
46
+ * Of not, raise me an issue. Thanks.
14
47
 
15
48
  == Copyright
16
49
 
data/Rakefile CHANGED
@@ -10,6 +10,8 @@ begin
10
10
  gem.email = "dreamcat4@gmail.com"
11
11
  gem.homepage = "http://github.com/dreamcat4/yard-slipstream"
12
12
  gem.authors = ["Dreamcat4"]
13
+ gem.add_dependency 'yard', ">= 0"
14
+ gem.add_dependency "json", ">= 0"
13
15
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
16
  gem.add_development_dependency "yard", ">= 0"
15
17
  gem.add_development_dependency "cucumber", ">= 0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.1
@@ -3,16 +3,3 @@ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
3
 
4
4
  YARD::Templates::Engine.register_template_path dir + '/../templates'
5
5
 
6
- # require 'yard-slipstream/handler' if RUBY19
7
- # require 'yard-slipstream/legacy'
8
-
9
- # todo
10
-
11
- # * info box in top right
12
- # * search form in top right
13
-
14
- # rm -rf .yardoc doc ; /Users/id/tmp/yard/bin/yardoc -t "default" -p "/Users/id/tmp/yard/templates"
15
-
16
- # rm -rf .yardoc doc ; /Users/id/tmp/yard/bin/yardoc -t "default" -p "/Users/id/tmp/yard/templates" -e "/Users/id/tmp/yard-slipstream/lib/yard-slipstream.rb" lib/yard/templates/template.rb
17
-
18
-
@@ -0,0 +1,10 @@
1
+ <div id="subclasses">
2
+ <h3 class="inherited">Direct Known Subclasses</h3>
3
+ <ul id="classes_ribbon">
4
+ <% n = 1 %>
5
+ <% @subclasses.each do |name,child| %>
6
+ <li class="r<%= n %>"><%= linkify(child,name) %></li>
7
+ <% n = n == 2 ? 1 : 2 %>
8
+ <% end %>
9
+ </ul>
10
+ </div>
@@ -8,6 +8,52 @@
8
8
  #header { position: relative; }
9
9
 
10
10
 
11
+ /*.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; }*/
12
+ /*.method_details.first { position: relative; top: -15px; margin-bottom: -15px; border-top: transparent solid; }*/
13
+
14
+
15
+ /*#info_box { position: relative; float: right; top: 0px; }*/
16
+ #info_box { position: relative; float: left; top: 0px; }
17
+ /*#info_box { margin-top: 15px; margin-bottom: -30px; }*/
18
+
19
+ #info_box {
20
+ border: 1px solid #aaa;
21
+ border-width: 1px 1px 1px 1px;
22
+ }
23
+
24
+ #info_box a:hover { background: #eef; color: #06b; }
25
+ #info_box a.active {
26
+ background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
27
+ -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
28
+ -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
29
+ }
30
+ #info_box a.inactive { color: #999; }
31
+ /*.frames #info_box { display: none; }*/
32
+
33
+ dl.box { display: inline; }
34
+ dl.box dt { clear: both; }
35
+ dl.box dd { word-wrap: break-word; }
36
+
37
+ #files_ribbon { padding-left: 15px; font-size: 1.1em; padding: 0; }
38
+ #files_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
39
+
40
+ #methods_ribbon { padding-left: 15px; font-size: 1.1em; }
41
+ #methods_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
42
+
43
+ #classes_ribbon { padding-left: 15px; font-size: 1.1em; }
44
+ #classes_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
45
+
46
+ #modules_ribbon { padding-left: 15px; font-size: 1.1em; }
47
+ #modules_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
48
+
49
+ .method_details.first { position: relative; top: -15px; margin-bottom: -15px; border-top: transparent solid; }
50
+
51
+ #content { position: relative; }
52
+
53
+ #header { position: relative; }
54
+ #search { float: right; }
55
+
56
+
11
57
  form.search {
12
58
  /* position: relative;*/
13
59
  visibility: hidden;
@@ -19,14 +65,36 @@ form.search {
19
65
  }
20
66
  form.search input { margin-left: 5px; width: 250px; border: 1px solid #99f; -moz-border-radius: 3px; font-family: monospace; }
21
67
 
68
+ #menu .noframes { margin-right: 355px; float: right; }
69
+
70
+ /*#menu a.link_disabled:link { color: inherit; font-size:20;}*/
71
+ /*#menu a.link_disabled:visited { color: inherit; font-size:20;}*/
72
+ #menu a.link_disabled:hover { color: inherit; font-size:20;}
73
+
74
+ #search2 { float: right; z-index: 1; }
75
+ #search2 { position: absolute; right: 0px; top: 0px; }
76
+
77
+ div.search2_center {
78
+ position: relative;
79
+ text-align: center;
80
+ width: 350px;
81
+ }
82
+
22
83
  form.search2 {
23
84
  /* position: relative;*/
24
85
  color: #000;
25
- margin-top: 3px; padding: 7px; border: 1px solid #99f; width: 315px; background: #05a;
86
+ margin: 3px;
87
+ padding: 10px;
88
+ border: 1px solid #99f; background: #05a;
26
89
  -moz-border-radius: 4px; -webkit-border-radius: 4px;
27
- margin-bottom: 10px;
28
90
  }
29
- form.search2 input { margin-left: 5px; width: 250px; border: 1px solid #99f; -moz-border-radius: 3px; font-family: monospace; }
91
+
92
+ form.search2 input {
93
+ width: 300px;
94
+ height: 15px;
95
+ border: 1px solid #99f;
96
+ -moz-border-radius: 10px;
97
+ }
30
98
 
31
99
  #menu { padding-top: 5px; }
32
100
  #content h1 { margin-top: 0; border-top: 0; }
@@ -3,7 +3,7 @@ body {
3
3
  font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
4
4
  font-size: 13px;
5
5
  }
6
- body.frames { padding: 0 5px; }
6
+ /*body.frames { padding: 0 5px; }*/
7
7
  h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; }
8
8
  h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; }
9
9
  h1.title { margin-bottom: 10px; }
@@ -16,6 +16,8 @@ h2 {
16
16
  margin: 1.8em 0 0.5em;
17
17
  }
18
18
  .clear { clear: both; }
19
+ .inline { display: inline; }
20
+ .inline p:first-child { display: inline; }
19
21
  .docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; }
20
22
  .docstring h1 { font-size: 1.2em; }
21
23
  .docstring h2 { font-size: 1.1em; }
@@ -52,31 +54,6 @@ p.inherited {
52
54
  margin-left: 25px;
53
55
  }
54
56
 
55
-
56
- /*.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; }*/
57
- /*.method_details.first { position: relative; top: -15px; margin-bottom: -15px; border-top: transparent solid; }*/
58
-
59
-
60
- #info_box { position: relative; float: left; top: -20px; }
61
- #info_box { margin-top: 15px; margin-bottom: -30px; }
62
-
63
- /*#info_box a:link, #info_box a:visited {
64
- display: block; float: left; margin-right: 4px;
65
- padding: 8px 10px; text-decoration: none; color: #05a; background: #eaeaff;
66
- border: 1px solid #d8d8e5;
67
- -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px;
68
- -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px;
69
- }
70
- *//*#info_box a:hover { background: #eef; color: #06b; }
71
- *//*#info_box a.active {
72
- background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
73
- -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
74
- -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
75
- }
76
- *//*#info_box a.inactive { color: #999; }*/
77
- /*.frames #info_box { display: none; }*/
78
-
79
-
80
57
  dl.box {
81
58
  width: 520px;
82
59
  font-size: 1em;
@@ -88,8 +65,8 @@ dl.box dt {
88
65
  margin: 0;
89
66
  text-align: right;
90
67
  font-weight: bold;
91
- border: 1px solid #aaa;
92
- border-width: 1px 0px 0px 1px;
68
+ /* border: 1px solid #aaa;*/
69
+ /* border-width: 1px 0px 0px 1px;*/
93
70
  padding: 6px 0;
94
71
  padding-right: 10px;
95
72
  }
@@ -100,30 +77,19 @@ dl.box dd {
100
77
  margin: 0;
101
78
  padding: 6px 0;
102
79
  padding-right: 20px;
103
- border: 1px solid #aaa;
104
- border-width: 1px 1px 0 0;
80
+ /* border: 1px solid #aaa;*/
81
+ /* border-width: 1px 1px 0 0;*/
105
82
  }
106
83
  dl.box .last {
107
- border-bottom: 1px solid #aaa;
84
+ /* border-bottom: 1px solid #aaa;*/
108
85
  }
109
86
  dl.box .r1 { background: #eee; }
110
87
 
111
-
112
-
113
-
114
88
  ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; }
89
+ /*#files { padding-left: 15px; font-size: 1.1em; }*/
115
90
 
116
- #files_ribbon { padding-left: 15px; font-size: 1.1em; padding: 0; }
117
- #files_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
118
-
119
- #methods_ribbon { padding-left: 15px; font-size: 1.1em; }
120
- #methods_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
121
-
122
- #classes_ribbon { padding-left: 15px; font-size: 1.1em; }
123
- #classes_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
124
-
125
- #modules_ribbon { padding-left: 15px; font-size: 1.1em; }
126
- #modules_ribbon li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
91
+ /*#files { padding: 0; }*/
92
+ /*#files li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }*/
127
93
 
128
94
  dl.constants { margin-left: 40px; }
129
95
  dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; }
@@ -131,11 +97,12 @@ dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-b
131
97
 
132
98
  .summary_desc { margin-left: 32px; display: block; font-family: sans-serif; }
133
99
  .summary_desc tt { font-size: 0.9em; }
134
- dl.constants .summary_desc { font-size: 0.9em; font-weight: normal; }
100
+ dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; }
101
+ dl.constants .discussion *:first-child { margin-top: 0; }
102
+ dl.constants .discussion *:last-child { margin-bottom: 0; }
135
103
 
136
104
  .method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; }
137
- .method_details.first { position: relative; top: -15px; margin-bottom: -15px; border-top: transparent solid; }
138
-
105
+ /*.method_details.first { border: 0; }*/
139
106
  p.signature {
140
107
  font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
141
108
  padding: 6px 10px; margin-top: 18px;
@@ -172,7 +139,6 @@ p.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace;
172
139
  .showSource { font-size: 0.9em; }
173
140
  .showSource a:link, .showSource a:visited { text-decoration: none; color: #666; }
174
141
 
175
- #content { position: relative; }
176
142
  #content a:link, #content a:visited { text-decoration: none; color: #05a; }
177
143
  #content a:hover { background: #ffffa5; }
178
144
  .docstring { margin-right: 6em; }
@@ -212,10 +178,14 @@ ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; }
212
178
  ul.fullTree li { text-align: center; }
213
179
  ul.fullTree li.next:before { font-size: 1.2em; content: '\2B06'; color: #bbb; display: block; margin-top: 3px; }
214
180
 
215
- #header { position: relative; }
216
181
  #search { position: absolute; right: 14px; top: 0px; }
217
- #search { float: right; }
218
-
182
+ #search a:link, #search a:visited {
183
+ display: block; float: left; margin-right: 4px;
184
+ padding: 8px 10px; text-decoration: none; color: #05a; background: #eaeaff;
185
+ border: 1px solid #d8d8e5;
186
+ -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px;
187
+ -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px;
188
+ }
219
189
  #search a:hover { background: #eef; color: #06b; }
220
190
  #search a.active {
221
191
  background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
@@ -228,10 +198,11 @@ ul.fullTree li.next:before { font-size: 1.2em; content: '\2B06'; color: #bbb; di
228
198
 
229
199
  #menu { font-size: 1.3em; color: #bbb; top: -5px; position: relative; }
230
200
  #menu .title, #menu a { font-size: 0.7em; }
201
+ #menu .title a { font-size: 1em; }
231
202
  #menu .title { color: #555; }
232
203
  #menu a:link, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; }
233
204
  #menu a:hover { color: #05a; }
234
- #menu .noframes { display: none; }
205
+ /*#menu .noframes { display: none; }*/
235
206
  .frames #menu .noframes { display: inline; float: right; }
236
207
 
237
208
  #footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; }
@@ -0,0 +1,116 @@
1
+ function createSourceLinks() {
2
+ $('.method_details_list .source_code').
3
+ before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
4
+ $('.toggleSource').toggle(function() {
5
+ $(this).parent().next().slideDown(100);
6
+ $(this).text("Hide source");
7
+ },
8
+ function() {
9
+ $(this).parent().next().slideUp(100);
10
+ $(this).text("View source");
11
+ });
12
+ }
13
+
14
+ function createDefineLinks() {
15
+ var tHeight = 0;
16
+ $('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
17
+ $('.toggleDefines').toggle(function() {
18
+ tHeight = $(this).parent().prev().height();
19
+ $(this).prev().show();
20
+ $(this).parent().prev().height($(this).parent().height());
21
+ $(this).text("(less)");
22
+ },
23
+ function() {
24
+ $(this).prev().hide();
25
+ $(this).parent().prev().height(tHeight);
26
+ $(this).text("more...")
27
+ });
28
+ }
29
+
30
+ function createFullTreeLinks() {
31
+ var tHeight = 0;
32
+ $('.inheritanceTree').toggle(function() {
33
+ tHeight = $(this).parent().prev().height();
34
+ $(this).prev().prev().hide();
35
+ $(this).prev().show();
36
+ $(this).text("(hide)");
37
+ $(this).parent().prev().height($(this).parent().height());
38
+ },
39
+ function() {
40
+ $(this).prev().prev().show();
41
+ $(this).prev().hide();
42
+ $(this).parent().prev().height(tHeight);
43
+ $(this).text("show all")
44
+ });
45
+ }
46
+
47
+ function fixBoxInfoHeights() {
48
+ $('dl.box dd.r1, dl.box dd.r2').each(function() {
49
+ $(this).prev().height($(this).height());
50
+ });
51
+ }
52
+
53
+ function searchFrameLinks() {
54
+ $('#method_list_link').click(function() {
55
+ toggleSearchFrame(this, relpath + 'method_list.html');
56
+ });
57
+
58
+ $('#class_list_link').click(function() {
59
+ toggleSearchFrame(this, relpath + 'class_list.html');
60
+ });
61
+
62
+ $('#file_list_link').click(function() {
63
+ toggleSearchFrame(this, relpath + 'file_list.html');
64
+ });
65
+ }
66
+
67
+ function toggleSearchFrame(id, link) {
68
+ var frame = $('#search_frame');
69
+ $('#search a').removeClass('active').addClass('inactive');
70
+ if (frame.attr('src') == link && frame.css('display') != "none") {
71
+ frame.slideUp(100);
72
+ $('#search a').removeClass('active inactive');
73
+ }
74
+ else {
75
+ $(id).addClass('active').removeClass('inactive');
76
+ frame.attr('src', link).slideDown(100);
77
+ }
78
+ }
79
+
80
+ function linkSummaries() {
81
+ $('.summary_signature').click(function() {
82
+ document.location = $(this).find('a').attr('href');
83
+ });
84
+ }
85
+
86
+ function framesInit() {
87
+ if (window.top.frames.main) {
88
+ document.body.className = 'frames';
89
+ $('#noframes_link').attr('href', document.location);
90
+ $('#noframes_link').removeClass('link_disabled');
91
+ }
92
+ else {
93
+ $('#frames_link').attr('href', relpath+"frames.html");
94
+ $('#frames_link').removeClass('link_disabled');
95
+ }
96
+ }
97
+
98
+ function keyboardShortcuts() {
99
+ $(document).keypress(function(evt) {
100
+ if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
101
+ switch (evt.charCode) {
102
+ case 67: case 99: $('#class_list_link').click(); break; // 'c'
103
+ case 77: case 109: $('#method_list_link').click(); break; // 'm'
104
+ case 70: case 102: $('#file_list_link').click(); break; // 'f'
105
+ }
106
+ });
107
+ }
108
+
109
+ $(framesInit);
110
+ $(createSourceLinks);
111
+ $(createDefineLinks);
112
+ $(createFullTreeLinks);
113
+ $(fixBoxInfoHeights);
114
+ $(searchFrameLinks);
115
+ $(linkSummaries);
116
+ $(keyboardShortcuts);