docurium 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/Gemfile +5 -0
- data/LICENCE +19 -0
- data/README.md +39 -0
- data/TODO.txt +19 -0
- data/bin/cm +31 -0
- data/docurium.gemspec +25 -0
- data/lib/docurium.rb +435 -0
- data/lib/docurium/cli.rb +10 -0
- data/site/css/style.css +236 -0
- data/site/images/search_icon.png +0 -0
- data/site/index.html +65 -0
- data/site/js/backbone.js +27 -0
- data/site/js/docurium.js +649 -0
- data/site/js/json2.js +26 -0
- data/site/js/underscore.js +26 -0
- data/site/shared/css/documentation.css +797 -0
- data/site/shared/css/pygments.css +60 -0
- data/site/shared/images/active-arrow.png +0 -0
- data/site/shared/images/background-v2.png +0 -0
- data/site/shared/images/background-white.png +0 -0
- data/site/shared/images/dropdown_sprites.jpg +0 -0
- data/site/shared/images/footer_logo.png +0 -0
- data/site/shared/images/logo.png +0 -0
- data/site/shared/images/nav-rule.png +0 -0
- data/site/shared/images/next_step_arrow.gif +0 -0
- data/site/shared/images/qmark.png +0 -0
- data/site/shared/js/documentation.js +43 -0
- data/site/shared/js/jquery.js +154 -0
- data/test/fixtures/git2/api.docurium +6 -0
- data/test/fixtures/git2/blob.h +121 -0
- data/test/fixtures/git2/commit.h +302 -0
- data/test/fixtures/git2/common.h +98 -0
- data/test/fixtures/git2/errors.h +149 -0
- data/test/fixtures/git2/index.h +270 -0
- data/test/fixtures/git2/object.h +147 -0
- data/test/fixtures/git2/odb.h +302 -0
- data/test/fixtures/git2/odb_backend.h +107 -0
- data/test/fixtures/git2/oid.h +191 -0
- data/test/fixtures/git2/refs.h +325 -0
- data/test/fixtures/git2/repository.h +217 -0
- data/test/fixtures/git2/revwalk.h +187 -0
- data/test/fixtures/git2/signature.h +81 -0
- data/test/fixtures/git2/tag.h +297 -0
- data/test/fixtures/git2/thread-utils.h +71 -0
- data/test/fixtures/git2/tree.h +266 -0
- data/test/fixtures/git2/types.h +162 -0
- data/test/fixtures/git2/zlib.h +58 -0
- data/test/repo_test.rb +101 -0
- data/test/test_helper.rb +29 -0
- metadata +167 -0
data/lib/docurium/cli.rb
ADDED
data/site/css/style.css
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
html {
|
2
|
+
height: 100%;
|
3
|
+
}
|
4
|
+
|
5
|
+
/* Remove Below */
|
6
|
+
|
7
|
+
#header a.logo {
|
8
|
+
font-size: 35px;
|
9
|
+
font-weight: bold;
|
10
|
+
color: #014d65;
|
11
|
+
padding-top: 12px;
|
12
|
+
}
|
13
|
+
|
14
|
+
#header {
|
15
|
+
height:81px;
|
16
|
+
}
|
17
|
+
#main {
|
18
|
+
background-position-y: -10px
|
19
|
+
}
|
20
|
+
#search-field {
|
21
|
+
margin: 0px;
|
22
|
+
}
|
23
|
+
|
24
|
+
#versions li h3 {
|
25
|
+
padding: 10px;
|
26
|
+
}
|
27
|
+
|
28
|
+
h3 #version {
|
29
|
+
display: inline;
|
30
|
+
color: #743;
|
31
|
+
}
|
32
|
+
|
33
|
+
.category_index { float: left; margin: 0.25em; width:19em; }
|
34
|
+
.category_index h2 { background: #ddd; text-align: center; padding: 0.25em; margin-bottom: 0.5em; }
|
35
|
+
.category_index dt, .category_index dd { margin-right: 0.5em; }
|
36
|
+
.category_index dt { margin-left: 0.5em !important; }
|
37
|
+
.category_index dd { margin-left: 1.5em !important; }
|
38
|
+
|
39
|
+
|
40
|
+
/*********************/
|
41
|
+
/* Sidebar */
|
42
|
+
/*********************/
|
43
|
+
|
44
|
+
#guides .guide .sidebar h3 {
|
45
|
+
padding: 4px;
|
46
|
+
margin: .2em 0;
|
47
|
+
}
|
48
|
+
#guides .guide .sidebar h3:focus { outline: none; }
|
49
|
+
|
50
|
+
.sidebar dl { padding: 0 0.5em 0.5em 0.5em; }
|
51
|
+
.sidebar dt {
|
52
|
+
font-weight: bold;
|
53
|
+
margin-top: 0.5em;
|
54
|
+
}
|
55
|
+
|
56
|
+
.ui-icon {
|
57
|
+
display: inline-block;
|
58
|
+
width: 16px;
|
59
|
+
height: 16px;
|
60
|
+
background-color: white;
|
61
|
+
background-position: -2px 2px;
|
62
|
+
background-repeat: no-repeat;
|
63
|
+
}
|
64
|
+
.ui-icon-triangle-expand { background-image: url(../images/expand.png); }
|
65
|
+
.ui-icon-triangle-collapse { background-image: url(../images/collapse.png); }
|
66
|
+
|
67
|
+
div.sidebar-shell {
|
68
|
+
margin: 0 0;
|
69
|
+
}
|
70
|
+
|
71
|
+
div.sidebar-module {
|
72
|
+
width: 232px;
|
73
|
+
}
|
74
|
+
.content {
|
75
|
+
width: 660px;
|
76
|
+
}
|
77
|
+
|
78
|
+
input.search {
|
79
|
+
font-size: 12px;
|
80
|
+
width: 200px;
|
81
|
+
padding: 5px 5px 5px 23px;
|
82
|
+
margin-bottom: 8px;
|
83
|
+
font-family: Helvetica,Arial,freesans,sans-serif;
|
84
|
+
border: 1px solid #DDD;
|
85
|
+
border-top-color: #CCC;
|
86
|
+
border-bottom-color: #EAEAEA;
|
87
|
+
-webkit-border-radius: 3px;
|
88
|
+
-moz-border-radius: 3px;
|
89
|
+
border-radius: 3px;
|
90
|
+
background: url(../images/search_icon.png) 5px 50% no-repeat white;
|
91
|
+
}
|
92
|
+
|
93
|
+
a small {
|
94
|
+
font-size: 0.8em;
|
95
|
+
color: #aaa;
|
96
|
+
}
|
97
|
+
|
98
|
+
h2 small {
|
99
|
+
font-size: 0.8em;
|
100
|
+
font-weight: normal;
|
101
|
+
color: #666;
|
102
|
+
}
|
103
|
+
|
104
|
+
table.methods {
|
105
|
+
width: 100%;
|
106
|
+
}
|
107
|
+
table.methods tr td {
|
108
|
+
padding: 4px 8px;
|
109
|
+
border-bottom: 1px solid #eee;
|
110
|
+
}
|
111
|
+
table.methods tr td.methodName a {
|
112
|
+
font-weight: bold;
|
113
|
+
}
|
114
|
+
|
115
|
+
table.funcTable tr td {
|
116
|
+
padding: 5px 10px;
|
117
|
+
border-bottom: 1px solid #eee;
|
118
|
+
}
|
119
|
+
table.funcTable tr td.comment {
|
120
|
+
color: #999;
|
121
|
+
}
|
122
|
+
table.funcTable tr td.var {
|
123
|
+
font-weight: bold;
|
124
|
+
color: #833;
|
125
|
+
}
|
126
|
+
|
127
|
+
code.params {
|
128
|
+
white-space: pre-wrap; /* css-3 */
|
129
|
+
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
130
|
+
white-space: -pre-wrap; /* Opera 4-6 */
|
131
|
+
white-space: -o-pre-wrap; /* Opera 7 */
|
132
|
+
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
133
|
+
}
|
134
|
+
|
135
|
+
.example {
|
136
|
+
padding: 10px;
|
137
|
+
background: #efe;
|
138
|
+
margin-top: 10px;
|
139
|
+
margin-bottom: 10px;
|
140
|
+
border: 1px solid #7a7;
|
141
|
+
}
|
142
|
+
.example h3 {
|
143
|
+
margin: 8px 0;
|
144
|
+
margin-top: 0;
|
145
|
+
color: #585;
|
146
|
+
}
|
147
|
+
|
148
|
+
.returns { margin-bottom: 15px; }
|
149
|
+
|
150
|
+
h1.funcTitle {
|
151
|
+
font-size: 1.6em;
|
152
|
+
}
|
153
|
+
h3.funcDesc {
|
154
|
+
font-size: 1.0em;
|
155
|
+
font-weight: normal;
|
156
|
+
color: #686;
|
157
|
+
padding-bottom: 10px;
|
158
|
+
margin: 0;
|
159
|
+
}
|
160
|
+
|
161
|
+
h1.funcTitle small {
|
162
|
+
font-size: 0.8em;
|
163
|
+
font-weight: normal;
|
164
|
+
color: #888;
|
165
|
+
margin-left: 10px;
|
166
|
+
}
|
167
|
+
|
168
|
+
.also {
|
169
|
+
padding: 10px;
|
170
|
+
border-top: 1px solid #ddd;
|
171
|
+
background: #eee;
|
172
|
+
}
|
173
|
+
|
174
|
+
.sidebar-module ul ul li span.divide {
|
175
|
+
background: #eee;
|
176
|
+
cursor: default;
|
177
|
+
}
|
178
|
+
|
179
|
+
.fileLink {
|
180
|
+
padding: 10px;
|
181
|
+
}
|
182
|
+
|
183
|
+
.signatures {
|
184
|
+
padding: 10px;
|
185
|
+
}
|
186
|
+
|
187
|
+
.signatures a {
|
188
|
+
background: #ddd;
|
189
|
+
padding: 4px;
|
190
|
+
margin: 0;
|
191
|
+
color: #000;
|
192
|
+
}
|
193
|
+
|
194
|
+
.signatures a.changed {
|
195
|
+
background: #ffd4aa;
|
196
|
+
}
|
197
|
+
|
198
|
+
.signatures a.current {
|
199
|
+
border-bottom: 3px solid #933;
|
200
|
+
}
|
201
|
+
|
202
|
+
.signatures h3 {
|
203
|
+
margin: 8px 0;
|
204
|
+
margin-top: 0;
|
205
|
+
}
|
206
|
+
|
207
|
+
h2.funcGroup {
|
208
|
+
border: 0;
|
209
|
+
margin: 5px 0;
|
210
|
+
margin-top: 8px;
|
211
|
+
padding: 5px 0;
|
212
|
+
border-bottom: 1px solid #eee;
|
213
|
+
}
|
214
|
+
p.functionList {
|
215
|
+
border: 0;
|
216
|
+
margin: 0;
|
217
|
+
padding: 0;
|
218
|
+
}
|
219
|
+
|
220
|
+
p.functionList a.changed {
|
221
|
+
background: #ffd4aa;
|
222
|
+
}
|
223
|
+
|
224
|
+
p.functionList a.introd {
|
225
|
+
background: #cec;
|
226
|
+
}
|
227
|
+
|
228
|
+
.changelog li.adds a {
|
229
|
+
color: #393;
|
230
|
+
}
|
231
|
+
.changelog li.changes a {
|
232
|
+
color: #993;
|
233
|
+
}
|
234
|
+
.changelog li.deletes {
|
235
|
+
color: #933;
|
236
|
+
}
|
Binary file
|
data/site/index.html
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
+
<title>API Documentation</title>
|
6
|
+
<link href="shared/css/documentation.css" media="screen" rel="stylesheet" type="text/css">
|
7
|
+
<link href="shared/css/pygments.css" media="screen" rel="stylesheet" type="text/css">
|
8
|
+
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css">
|
9
|
+
<script src="shared/js/jquery.js" type="text/javascript"></script>
|
10
|
+
<script src="shared/js/documentation.js" type="text/javascript"></script>
|
11
|
+
<script src="js/json2.js" type="text/javascript"></script>
|
12
|
+
<script src="js/underscore.js" type="text/javascript"></script>
|
13
|
+
<script src="js/backbone.js" type="text/javascript"></script>
|
14
|
+
<script src="js/docurium.js" type="text/javascript"></script>
|
15
|
+
</head>
|
16
|
+
|
17
|
+
<body class="documentation">
|
18
|
+
<div id="not-footer">
|
19
|
+
<div id="header-wrapper">
|
20
|
+
<div id="header">
|
21
|
+
<div>
|
22
|
+
<a class="logo" href="#" id="site-title">API</a>
|
23
|
+
<ul class="nav">
|
24
|
+
<li><input type="text" class="search" id="search-field" name="q" autocomplete="off"></li>
|
25
|
+
</ul>
|
26
|
+
</div>
|
27
|
+
</div><!-- #header -->
|
28
|
+
</div><!-- #header-wrapper -->
|
29
|
+
|
30
|
+
<div id="wrapper">
|
31
|
+
|
32
|
+
<div class="content"></div>
|
33
|
+
|
34
|
+
<div id="js-help-sidebar" class="sidebar-shell">
|
35
|
+
<div class="sidebar-module">
|
36
|
+
<ul class="subgroup" id="versions">
|
37
|
+
<li>
|
38
|
+
<h3 id="version-picker">Version: <span id="version"></span></h3>
|
39
|
+
<ul id="version-list"></ul>
|
40
|
+
</li>
|
41
|
+
</ul>
|
42
|
+
</div> <!-- /sidebar-module -->
|
43
|
+
<div class="sidebar-module">
|
44
|
+
<ul class="subgroup" id="files-list">
|
45
|
+
<li><h3><a>Loading...</a></h3></li>
|
46
|
+
</ul>
|
47
|
+
</div> <!-- /sidebar-module -->
|
48
|
+
</div><!-- /sidebar-shell -->
|
49
|
+
|
50
|
+
</div><!-- #wrapper -->
|
51
|
+
|
52
|
+
</div><!-- /not-footer -->
|
53
|
+
<div id="footer-wrapper">
|
54
|
+
<div id="footer">
|
55
|
+
<div class="left-col">
|
56
|
+
Powered by Docurium<br/>
|
57
|
+
Sponsored by GitHub<br/>
|
58
|
+
<br/>
|
59
|
+
</div>
|
60
|
+
<div class="right-col"></div>
|
61
|
+
</div><!-- #footer -->
|
62
|
+
</div><!-- #footer-wrapper -->
|
63
|
+
|
64
|
+
</body>
|
65
|
+
</html>
|
data/site/js/backbone.js
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
// Backbone.js 0.3.3
|
2
|
+
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
|
3
|
+
// Backbone may be freely distributed under the MIT license.
|
4
|
+
// For all details and documentation:
|
5
|
+
// http://documentcloud.github.com/backbone
|
6
|
+
(function(){var e;e=typeof exports!=="undefined"?exports:this.Backbone={};e.VERSION="0.3.3";var f=this._;if(!f&&typeof require!=="undefined")f=require("underscore")._;var h=this.jQuery||this.Zepto;e.emulateHTTP=false;e.emulateJSON=false;e.Events={bind:function(a,b){this._callbacks||(this._callbacks={});(this._callbacks[a]||(this._callbacks[a]=[])).push(b);return this},unbind:function(a,b){var c;if(a){if(c=this._callbacks)if(b){c=c[a];if(!c)return this;for(var d=0,g=c.length;d<g;d++)if(b===c[d]){c.splice(d,
|
7
|
+
1);break}}else c[a]=[]}else this._callbacks={};return this},trigger:function(a){var b,c,d,g;if(!(c=this._callbacks))return this;if(b=c[a]){d=0;for(g=b.length;d<g;d++)b[d].apply(this,Array.prototype.slice.call(arguments,1))}if(b=c.all){d=0;for(g=b.length;d<g;d++)b[d].apply(this,arguments)}return this}};e.Model=function(a,b){a||(a={});if(this.defaults)a=f.extend({},this.defaults,a);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.set(a,{silent:true});this._previousAttributes=
|
8
|
+
f.clone(this.attributes);if(b&&b.collection)this.collection=b.collection;this.initialize(a,b)};f.extend(e.Model.prototype,e.Events,{_previousAttributes:null,_changed:false,initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.attributes[a];return this._escapedAttributes[a]=(b==null?"":b).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,
|
9
|
+
""")},set:function(a,b){b||(b={});if(!a)return this;if(a.attributes)a=a.attributes;var c=this.attributes,d=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return false;if("id"in a)this.id=a.id;for(var g in a){var i=a[g];if(!f.isEqual(c[g],i)){c[g]=i;delete d[g];if(!b.silent){this._changed=true;this.trigger("change:"+g,this,i,b)}}}!b.silent&&this._changed&&this.change(b);return this},unset:function(a,b){b||(b={});var c={};c[a]=void 0;if(!b.silent&&this.validate&&
|
10
|
+
!this._performValidation(c,b))return false;delete this.attributes[a];delete this._escapedAttributes[a];if(!b.silent){this._changed=true;this.trigger("change:"+a,this,void 0,b);this.change(b)}return this},clear:function(a){a||(a={});var b=this.attributes,c={};for(attr in b)c[attr]=void 0;if(!a.silent&&this.validate&&!this._performValidation(c,a))return false;this.attributes={};this._escapedAttributes={};if(!a.silent){this._changed=true;for(attr in b)this.trigger("change:"+attr,this,void 0,a);this.change(a)}return this},
|
11
|
+
fetch:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("read",this,function(d){if(!b.set(b.parse(d),a))return false;a.success&&a.success(b,d)},c);return this},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return false;var c=this,d=j(b.error,c,b),g=this.isNew()?"create":"update";(this.sync||e.sync)(g,this,function(i){if(!c.set(c.parse(i),b))return false;b.success&&b.success(c,i)},d);return this},destroy:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("delete",
|
12
|
+
this,function(d){b.collection&&b.collection.remove(b);a.success&&a.success(b,d)},c);return this},url:function(){var a=k(this.collection);if(this.isNew())return a;return a+(a.charAt(a.length-1)=="/"?"":"/")+this.id},parse:function(a){return a},clone:function(){return new this.constructor(this)},isNew:function(){return!this.id},change:function(a){this.trigger("change",this,a);this._previousAttributes=f.clone(this.attributes);this._changed=false},hasChanged:function(a){if(a)return this._previousAttributes[a]!=
|
13
|
+
this.attributes[a];return this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=false,d;for(d in a)if(!f.isEqual(b[d],a[d])){c=c||{};c[d]=a[d]}return c},previous:function(a){if(!a||!this._previousAttributes)return null;return this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);if(c){b.error?b.error(this,c):this.trigger("error",this,c,b);return false}return true}});
|
14
|
+
e.Collection=function(a,b){b||(b={});if(b.comparator){this.comparator=b.comparator;delete b.comparator}this._boundOnModelEvent=f.bind(this._onModelEvent,this);this._reset();a&&this.refresh(a,{silent:true});this.initialize(a,b)};f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c<d;c++)this._add(a[c],b);else this._add(a,b);return this},remove:function(a,
|
15
|
+
b){if(f.isArray(a))for(var c=0,d=a.length;c<d;c++)this._remove(a[c],b);else this._remove(a,b);return this},get:function(a){if(a==null)return null;return this._byId[a.id!=null?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");this.models=this.sortBy(this.comparator);a.silent||this.trigger("refresh",this,a);return this},pluck:function(a){return f.map(this.models,
|
16
|
+
function(b){return b.get(a)})},refresh:function(a,b){a||(a=[]);b||(b={});this._reset();this.add(a,{silent:true});b.silent||this.trigger("refresh",this,b);return this},fetch:function(a){a||(a={});var b=this,c=j(a.error,b,a);(this.sync||e.sync)("read",this,function(d){b.refresh(b.parse(d));a.success&&a.success(b,d)},c);return this},create:function(a,b){var c=this;b||(b={});if(a instanceof e.Model)a.collection=c;else a=new this.model(a,{collection:c});return a.save(null,{success:function(d,g){c.add(d);
|
17
|
+
b.success&&b.success(d,g)},error:b.error})},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0;this.models=[];this._byId={};this._byCid={}},_add:function(a,b){b||(b={});a instanceof e.Model||(a=new this.model(a,{collection:this}));var c=this.getByCid(a);if(c)throw Error(["Can't add the same model to a set twice",c.id]);this._byId[a.id]=a;this._byCid[a.cid]=a;a.collection=this;this.models.splice(this.comparator?this.sortedIndex(a,this.comparator):
|
18
|
+
this.length,0,a);a.bind("all",this._boundOnModelEvent);this.length++;b.silent||a.trigger("add",a,this,b);return a},_remove:function(a,b){b||(b={});a=this.getByCid(a)||this.get(a);if(!a)return null;delete this._byId[a.id];delete this._byCid[a.cid];delete a.collection;this.models.splice(this.indexOf(a),1);this.length--;b.silent||a.trigger("remove",a,this,b);a.unbind("all",this._boundOnModelEvent);return a},_onModelEvent:function(a,b){if(a==="change:id"){delete this._byId[b.previous("id")];this._byId[b.id]=
|
19
|
+
b}this.trigger.apply(this,arguments)}});f.each(["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","invoke","max","min","sortBy","sortedIndex","toArray","size","first","rest","last","without","indexOf","lastIndexOf","isEmpty"],function(a){e.Collection.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}});e.Controller=function(a){a||(a={});if(a.routes)this.routes=a.routes;this._bindRoutes();
|
20
|
+
this.initialize(a)};var o=/:([\w\d]+)/g,p=/\*([\w\d]+)/g;f.extend(e.Controller.prototype,e.Events,{initialize:function(){},route:function(a,b,c){e.history||(e.history=new e.History);f.isRegExp(a)||(a=this._routeToRegExp(a));e.history.route(a,f.bind(function(d){d=this._extractParameters(a,d);c.apply(this,d);this.trigger.apply(this,["route:"+b].concat(d))},this))},saveLocation:function(a){e.history.saveLocation(a)},_bindRoutes:function(){if(this.routes)for(var a in this.routes){var b=this.routes[a];
|
21
|
+
this.route(a,b,this[b])}},_routeToRegExp:function(a){a=a.replace(o,"([^/]*)").replace(p,"(.*?)");return RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});e.History=function(){this.handlers=[];this.fragment=this.getFragment();f.bindAll(this,"checkUrl")};var l=/^#*/;f.extend(e.History.prototype,{interval:50,getFragment:function(a){return(a||window.location).hash.replace(l,"")},start:function(){var a=document.documentMode;if(a=h.browser.msie&&(!a||a<=7))this.iframe=h('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow;
|
22
|
+
"onhashchange"in window&&!a?h(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval);return this.loadUrl()},route:function(a,b){this.handlers.push({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();if(a==this.fragment&&this.iframe)a=this.getFragment(this.iframe.location);if(a==this.fragment||a==decodeURIComponent(this.fragment))return false;if(this.iframe)window.location.hash=this.iframe.location.hash=a;this.loadUrl()},loadUrl:function(){var a=this.fragment=
|
23
|
+
this.getFragment();return f.any(this.handlers,function(b){if(b.route.test(a)){b.callback(a);return true}})},saveLocation:function(a){a=(a||"").replace(l,"");if(this.fragment!=a){window.location.hash=this.fragment=a;if(this.iframe&&a!=this.getFragment(this.iframe.location)){this.iframe.document.open().close();this.iframe.location.hash=a}}}});e.View=function(a){this._configure(a||{});this._ensureElement();this.delegateEvents();this.initialize(a)};var q=/^(\w+)\s*(.*)$/;f.extend(e.View.prototype,e.Events,
|
24
|
+
{tagName:"div",$:function(a){return h(a,this.el)},initialize:function(){},render:function(){return this},remove:function(){h(this.el).remove();return this},make:function(a,b,c){a=document.createElement(a);b&&h(a).attr(b);c&&h(a).html(c);return a},delegateEvents:function(a){if(a||(a=this.events)){h(this.el).unbind();for(var b in a){var c=a[b],d=b.match(q),g=d[1];d=d[2];c=f.bind(this[c],this);d===""?h(this.el).bind(g,c):h(this.el).delegate(d,g,c)}}},_configure:function(a){if(this.options)a=f.extend({},
|
25
|
+
this.options,a);if(a.model)this.model=a.model;if(a.collection)this.collection=a.collection;if(a.el)this.el=a.el;if(a.id)this.id=a.id;if(a.className)this.className=a.className;if(a.tagName)this.tagName=a.tagName;this.options=a},_ensureElement:function(){if(!this.el){var a={};if(this.id)a.id=this.id;if(this.className)a["class"]=this.className;this.el=this.make(this.tagName,a)}}});var m=function(a,b){var c=r(this,a,b);c.extend=m;return c};e.Model.extend=e.Collection.extend=e.Controller.extend=e.View.extend=
|
26
|
+
m;var s={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c,d){var g=s[a];a=a==="create"||a==="update"?JSON.stringify(b.toJSON()):null;b={url:k(b),type:g,contentType:"application/json",data:a,dataType:"json",processData:false,success:c,error:d};if(e.emulateJSON){b.contentType="application/x-www-form-urlencoded";b.processData=true;b.data=a?{model:a}:{}}if(e.emulateHTTP)if(g==="PUT"||g==="DELETE"){if(e.emulateJSON)b.data._method=g;b.type="POST";b.beforeSend=function(i){i.setRequestHeader("X-HTTP-Method-Override",
|
27
|
+
g)}}h.ajax(b)};var n=function(){},r=function(a,b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){return a.apply(this,arguments)};n.prototype=a.prototype;d.prototype=new n;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},k=function(a){if(!(a&&a.url))throw Error("A 'url' property or function must be specified");return f.isFunction(a.url)?a.url():a.url},j=function(a,b,c){return function(d){a?a(b,d):b.trigger("error",b,d,c)}}})();
|
data/site/js/docurium.js
ADDED
@@ -0,0 +1,649 @@
|
|
1
|
+
$(function() {
|
2
|
+
// our document model - stores the datastructure generated from docurium
|
3
|
+
var Docurium = Backbone.Model.extend({
|
4
|
+
|
5
|
+
defaults: {'version': 'unknown'},
|
6
|
+
|
7
|
+
initialize: function() {
|
8
|
+
this.loadVersions()
|
9
|
+
},
|
10
|
+
|
11
|
+
loadVersions: function() {
|
12
|
+
$.getJSON("project.json", function(data) {
|
13
|
+
docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name})
|
14
|
+
if(data.name) {
|
15
|
+
$('#site-title').text(data.name + ' API')
|
16
|
+
document.title = data.name + ' API'
|
17
|
+
}
|
18
|
+
docurium.setVersionPicker()
|
19
|
+
docurium.setVersion()
|
20
|
+
})
|
21
|
+
},
|
22
|
+
|
23
|
+
setVersionPicker: function () {
|
24
|
+
vers = docurium.get('versions')
|
25
|
+
$('#version-list').empty().hide()
|
26
|
+
for(var i in vers) {
|
27
|
+
version = vers[i]
|
28
|
+
vlink = $('<a>').attr('href', '#' + version).append(version).click( function() {
|
29
|
+
$('#version-list').hide(100)
|
30
|
+
})
|
31
|
+
$('#version-list').append($('<li>').append(vlink))
|
32
|
+
}
|
33
|
+
vlink = $('<a>').attr('href', '#' + 'p/changelog').append("Changelog").click ( function () {
|
34
|
+
$('#version-list').hide(100)
|
35
|
+
})
|
36
|
+
$('#version-list').append($('<li>').append(vlink))
|
37
|
+
},
|
38
|
+
|
39
|
+
setVersion: function (version) {
|
40
|
+
if(!version) {
|
41
|
+
version = _.first(docurium.get('versions'))
|
42
|
+
}
|
43
|
+
if(docurium.get('version') != version) {
|
44
|
+
docurium.set({'version': version})
|
45
|
+
$('#site-title').attr('href', '#' + version)
|
46
|
+
docurium.loadDoc()
|
47
|
+
}
|
48
|
+
},
|
49
|
+
|
50
|
+
loadDoc: function() {
|
51
|
+
version = this.get('version')
|
52
|
+
$.ajax({
|
53
|
+
url: version + '.json',
|
54
|
+
context: this,
|
55
|
+
dataType: 'json',
|
56
|
+
success: function(data){
|
57
|
+
this.set({'data': data})
|
58
|
+
Backbone.history.start()
|
59
|
+
}
|
60
|
+
})
|
61
|
+
},
|
62
|
+
|
63
|
+
collapseSection: function(data) {
|
64
|
+
$(this).next().toggle(100)
|
65
|
+
return false
|
66
|
+
},
|
67
|
+
|
68
|
+
showIndexPage: function() {
|
69
|
+
version = docurium.get('version')
|
70
|
+
ws.saveLocation(version)
|
71
|
+
|
72
|
+
data = docurium.get('data')
|
73
|
+
content = $('.content')
|
74
|
+
content.empty()
|
75
|
+
|
76
|
+
content.append($('<h1>').append("Public API Functions"))
|
77
|
+
|
78
|
+
sigHist = docurium.get('signatures')
|
79
|
+
|
80
|
+
// Function Groups
|
81
|
+
for (var i in data['groups']) {
|
82
|
+
group = data['groups'][i]
|
83
|
+
content.append($('<h2>').addClass('funcGroup').append(group[0]))
|
84
|
+
list = $('<p>').addClass('functionList')
|
85
|
+
for(var j in group[1]) {
|
86
|
+
fun = group[1][j]
|
87
|
+
link = $('<a>').attr('href', '#' + groupLink(group[0], fun)).append(fun)
|
88
|
+
if(sigHist[fun].changes[version]) {
|
89
|
+
link.addClass('changed')
|
90
|
+
}
|
91
|
+
if(version == _.first(sigHist[fun].exists)) {
|
92
|
+
link.addClass('introd')
|
93
|
+
}
|
94
|
+
list.append(link)
|
95
|
+
if(j < group[1].length - 1) {
|
96
|
+
list.append(', ')
|
97
|
+
}
|
98
|
+
}
|
99
|
+
content.append(list)
|
100
|
+
}
|
101
|
+
},
|
102
|
+
|
103
|
+
showFun: function(gname, fname) {
|
104
|
+
id = '#groupItem' + gname
|
105
|
+
ref = parseInt($(id).attr('ref'))
|
106
|
+
|
107
|
+
group = docurium.get('data')['groups'][ref]
|
108
|
+
fdata = docurium.get('data')['functions']
|
109
|
+
gname = group[0]
|
110
|
+
functions = group[1]
|
111
|
+
|
112
|
+
content = $('.content')
|
113
|
+
content.empty()
|
114
|
+
|
115
|
+
// Show Function Name
|
116
|
+
content.append($('<h1>').addClass('funcTitle').append(fname))
|
117
|
+
if(fdata[fname]['description']) {
|
118
|
+
sub = content.append($('<h3>').addClass('funcDesc').append( ' ' + fdata[fname]['description'] ))
|
119
|
+
}
|
120
|
+
|
121
|
+
// Show Function Arguments
|
122
|
+
argtable = $('<table>').addClass('funcTable')
|
123
|
+
args = fdata[fname]['args']
|
124
|
+
for(var i=0; i<args.length; i++) {
|
125
|
+
arg = args[i]
|
126
|
+
row = $('<tr>')
|
127
|
+
row.append($('<td>').attr('valign', 'top').attr('nowrap', true).append(this.hotLink(arg.type)))
|
128
|
+
row.append($('<td>').attr('valign', 'top').addClass('var').append(arg.name))
|
129
|
+
row.append($('<td>').addClass('comment').append(arg.comment))
|
130
|
+
argtable.append(row)
|
131
|
+
}
|
132
|
+
content.append(argtable)
|
133
|
+
|
134
|
+
// Show Function Return Value
|
135
|
+
retdiv = $('<div>').addClass('returns')
|
136
|
+
retdiv.append($('<h3>').append("returns"))
|
137
|
+
rettable = $('<table>').addClass('funcTable')
|
138
|
+
retrow = $('<tr>')
|
139
|
+
rettable.append(retrow)
|
140
|
+
retdiv.append(rettable)
|
141
|
+
|
142
|
+
ret = fdata[fname]['return']
|
143
|
+
retrow.append($('<td>').attr('valign', 'top').append(this.hotLink(ret.type)))
|
144
|
+
if(ret.comment) {
|
145
|
+
retrow.append($('<td>').addClass('comment').append(ret.comment))
|
146
|
+
}
|
147
|
+
content.append(retdiv)
|
148
|
+
|
149
|
+
// Show Non-Parsed Function Comments
|
150
|
+
if (fdata[fname]['comments']) {
|
151
|
+
content.append($('<pre>').append(fdata[fname]['comments']))
|
152
|
+
}
|
153
|
+
|
154
|
+
// Show Function Signature
|
155
|
+
ex = $('<code>').addClass('params')
|
156
|
+
ex.append(this.hotLink(fdata[fname]['return']['type'] + ' ' + fname + '(' + fdata[fname]['argline'] + ');'))
|
157
|
+
example = $('<div>').addClass('example')
|
158
|
+
example.append($('<h3>').append("signature"))
|
159
|
+
example.append(ex)
|
160
|
+
content.append(example)
|
161
|
+
|
162
|
+
// Show Function History
|
163
|
+
sigs = $('<div>').addClass('signatures')
|
164
|
+
sigs.append($('<h3>').append("versions"))
|
165
|
+
sigHist = docurium.get('signatures')[fname]
|
166
|
+
for(var i in sigHist.exists) {
|
167
|
+
ver = sigHist.exists[i]
|
168
|
+
link = $('<a>').attr('href', '#' + groupLink(gname, fname, ver)).append(ver)
|
169
|
+
if(sigHist.changes[ver]) {
|
170
|
+
link.addClass('changed')
|
171
|
+
}
|
172
|
+
if(ver == docurium.get('version')) {
|
173
|
+
link.addClass('current')
|
174
|
+
}
|
175
|
+
sigs.append(link)
|
176
|
+
}
|
177
|
+
content.append(sigs)
|
178
|
+
|
179
|
+
// Link to Function Def on GitHub
|
180
|
+
link = this.github_file(fdata[fname].file, fdata[fname].line, fdata[fname].lineto)
|
181
|
+
flink = $('<a>').attr('target', 'github').attr('href', link).append(fdata[fname].file)
|
182
|
+
content.append($('<div>').addClass('fileLink').append("Defined in: ").append(flink))
|
183
|
+
|
184
|
+
// Show other functions in this group
|
185
|
+
also = $('<div>').addClass('also')
|
186
|
+
flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>')
|
187
|
+
flink.click( docurium.showGroup )
|
188
|
+
also.append("Also in ")
|
189
|
+
also.append(flink)
|
190
|
+
also.append(" group: <br/>")
|
191
|
+
|
192
|
+
for(i=0; i<functions.length; i++) {
|
193
|
+
f = functions[i]
|
194
|
+
d = fdata[f]
|
195
|
+
link = $('<a>').attr('href', '#' + groupLink(gname, f)).append(f)
|
196
|
+
also.append(link)
|
197
|
+
also.append(', ')
|
198
|
+
}
|
199
|
+
content.append(also)
|
200
|
+
|
201
|
+
|
202
|
+
this.addHotlinks()
|
203
|
+
},
|
204
|
+
|
205
|
+
showChangeLog: function() {
|
206
|
+
content = $('.content')
|
207
|
+
content.empty()
|
208
|
+
content.append($('<h1>').append("Function Changelog"))
|
209
|
+
// for every version, show which functions added, removed, changed - from HEAD down
|
210
|
+
versions = docurium.get('versions')
|
211
|
+
sigHist = docurium.get('signatures')
|
212
|
+
|
213
|
+
lastVer = _.first(versions)
|
214
|
+
|
215
|
+
// fill changelog struct
|
216
|
+
changelog = {}
|
217
|
+
for(var i in versions) {
|
218
|
+
version = versions[i]
|
219
|
+
changelog[version] = {'deletes': [], 'changes': [], 'adds': []}
|
220
|
+
}
|
221
|
+
|
222
|
+
// figure out the adds, deletes and changes
|
223
|
+
for(var func in sigHist) {
|
224
|
+
lastv = _.last(sigHist[func].exists)
|
225
|
+
firstv = _.first(sigHist[func].exists)
|
226
|
+
if (func != '__attribute__') {
|
227
|
+
changelog[firstv]['adds'].push(func)
|
228
|
+
}
|
229
|
+
if(lastv && (lastv != lastVer)) {
|
230
|
+
vi = _.indexOf(versions, lastv)
|
231
|
+
delv = versions[vi - 1]
|
232
|
+
changelog[delv]['deletes'].push(func)
|
233
|
+
}
|
234
|
+
for(var v in sigHist[func].changes) {
|
235
|
+
changelog[v]['changes'].push(func)
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
239
|
+
// display the data
|
240
|
+
for(var i in versions) {
|
241
|
+
version = versions[i]
|
242
|
+
content.append($('<h3>').append(version))
|
243
|
+
cl = $('<div>').addClass('changelog')
|
244
|
+
|
245
|
+
for(var type in changelog[version]) {
|
246
|
+
adds = changelog[version][type]
|
247
|
+
adds.sort()
|
248
|
+
addsection = $('<p>')
|
249
|
+
for(var j in adds) {
|
250
|
+
add = adds[j]
|
251
|
+
gname = docurium.groupOf(add)
|
252
|
+
if(type != 'deletes') {
|
253
|
+
addlink = $('<a>').attr('href', '#' + groupLink(gname, add, version)).append(add)
|
254
|
+
} else {
|
255
|
+
addlink = add
|
256
|
+
}
|
257
|
+
addsection.append($('<li>').addClass(type).append(addlink))
|
258
|
+
}
|
259
|
+
cl.append(addsection)
|
260
|
+
}
|
261
|
+
content.append(cl)
|
262
|
+
}
|
263
|
+
},
|
264
|
+
|
265
|
+
showType: function(data, manual) {
|
266
|
+
if(manual) {
|
267
|
+
id = '#typeItem' + domSafe(manual)
|
268
|
+
ref = parseInt($(id).attr('ref'))
|
269
|
+
} else {
|
270
|
+
ref = parseInt($(this).attr('ref'))
|
271
|
+
}
|
272
|
+
tdata = docurium.get('data')['types'][ref]
|
273
|
+
tname = tdata[0]
|
274
|
+
data = tdata[1]
|
275
|
+
|
276
|
+
ws.saveLocation(typeLink(tname))
|
277
|
+
|
278
|
+
content = $('.content')
|
279
|
+
content.empty()
|
280
|
+
content.append($('<h1>').addClass('funcTitle').append(tname).append($("<small>").append(data.type)))
|
281
|
+
|
282
|
+
content.append($('<p>').append(data.value))
|
283
|
+
if(data.block) {
|
284
|
+
content.append($('<pre>').append(data.block))
|
285
|
+
}
|
286
|
+
|
287
|
+
var ret = data.used.returns
|
288
|
+
if (ret.length > 0) {
|
289
|
+
content.append($('<h3>').append('Returns'))
|
290
|
+
}
|
291
|
+
for(var i=0; i<ret.length; i++) {
|
292
|
+
gname = docurium.groupOf(ret[i])
|
293
|
+
flink = $('<a>').attr('href', '#' + groupLink(gname, ret[i])).append(ret[i])
|
294
|
+
flink.click( docurium.showFun )
|
295
|
+
content.append(flink)
|
296
|
+
content.append(', ')
|
297
|
+
}
|
298
|
+
|
299
|
+
var needs = data.used.needs
|
300
|
+
if (needs.length > 0) {
|
301
|
+
content.append($('<h3>').append('Argument In'))
|
302
|
+
}
|
303
|
+
for(var i=0; i<needs.length; i++) {
|
304
|
+
gname = docurium.groupOf(needs[i])
|
305
|
+
flink = $('<a>').attr('href', '#' + groupLink(gname, needs[i])).append(needs[i])
|
306
|
+
flink.click( docurium.showFun )
|
307
|
+
content.append(flink)
|
308
|
+
content.append(', ')
|
309
|
+
}
|
310
|
+
|
311
|
+
link = docurium.github_file(data.file, data.line, data.lineto)
|
312
|
+
flink = $('<a>').attr('target', 'github').attr('href', link).append(data.file)
|
313
|
+
content.append($('<div>').addClass('fileLink').append("Defined in: ").append(flink))
|
314
|
+
|
315
|
+
return false
|
316
|
+
},
|
317
|
+
|
318
|
+
showGroup: function(data, manual, flink) {
|
319
|
+
if(manual) {
|
320
|
+
id = '#groupItem' + manual
|
321
|
+
ref = parseInt($(id).attr('ref'))
|
322
|
+
} else {
|
323
|
+
ref = parseInt($(this).attr('ref'))
|
324
|
+
}
|
325
|
+
group = docurium.get('data')['groups'][ref]
|
326
|
+
fdata = docurium.get('data')['functions']
|
327
|
+
gname = group[0]
|
328
|
+
|
329
|
+
ws.saveLocation(groupLink(gname));
|
330
|
+
|
331
|
+
functions = group[1]
|
332
|
+
$('.content').empty()
|
333
|
+
$('.content').append($('<h1>').append(gname + ' functions'))
|
334
|
+
|
335
|
+
table = $('<table>').addClass('methods')
|
336
|
+
for(i=0; i<functions.length; i++) {
|
337
|
+
f = functions[i]
|
338
|
+
d = fdata[f]
|
339
|
+
row = $('<tr>')
|
340
|
+
row.append($('<td>').attr('nowrap', true).attr('valign', 'top').append(d['return']['type'].substring(0, 20)))
|
341
|
+
link = $('<a>').attr('href', '#' + groupLink(gname, f)).append(f)
|
342
|
+
row.append($('<td>').attr('valign', 'top').addClass('methodName').append( link ))
|
343
|
+
args = d['args']
|
344
|
+
argtd = $('<td>')
|
345
|
+
for(j=0; j<args.length; j++) {
|
346
|
+
argtd.append(args[j].type + ' ' + args[j].name)
|
347
|
+
argtd.append($('<br>'))
|
348
|
+
}
|
349
|
+
row.append(argtd)
|
350
|
+
table.append(row)
|
351
|
+
}
|
352
|
+
$('.content').append(table)
|
353
|
+
|
354
|
+
for(var i=0; i<functions.length; i++) {
|
355
|
+
f = functions[i]
|
356
|
+
argsText = '( ' + fdata[f]['argline'] + ' )'
|
357
|
+
link = $('<a>').attr('href', '#' + groupLink(gname, f)).append(f)
|
358
|
+
$('.content').append($('<h2>').append(link).append($('<small>').append(argsText)))
|
359
|
+
$('.content').append($('<pre>').append(fdata[f]['rawComments']))
|
360
|
+
}
|
361
|
+
return false
|
362
|
+
},
|
363
|
+
|
364
|
+
// look for structs and link them
|
365
|
+
hotLink: function(text) {
|
366
|
+
types = this.get('data')['types']
|
367
|
+
for(var i=0; i<types.length; i++) {
|
368
|
+
type = types[i]
|
369
|
+
typeName = type[0]
|
370
|
+
typeData = type[1]
|
371
|
+
re = new RegExp(typeName + ' ', 'gi');
|
372
|
+
link = '<a ref="' + i.toString() + '" class="typeLink' + domSafe(typeName) + '" href="#">' + typeName + '</a> '
|
373
|
+
text = text.replace(re, link)
|
374
|
+
}
|
375
|
+
return text
|
376
|
+
},
|
377
|
+
|
378
|
+
groupHash: false,
|
379
|
+
groupOf: function (func) {
|
380
|
+
if(!this.groupHash) {
|
381
|
+
this.groupHash = {}
|
382
|
+
data = this.get('data')
|
383
|
+
for(var i=0; i<data['groups'].length; i++) {
|
384
|
+
group = data['groups'][i][1]
|
385
|
+
groupName = data['groups'][i][0]
|
386
|
+
for(var j=0; j<group.length; j++) {
|
387
|
+
f = group[j]
|
388
|
+
this.groupHash[f] = groupName
|
389
|
+
}
|
390
|
+
}
|
391
|
+
}
|
392
|
+
return this.groupHash[func]
|
393
|
+
},
|
394
|
+
|
395
|
+
addHotlinks: function() {
|
396
|
+
types = this.get('data')['types']
|
397
|
+
for(var i=0; i<types.length; i++) {
|
398
|
+
type = types[i]
|
399
|
+
typeName = type[0]
|
400
|
+
className = '.typeLink' + domSafe(typeName)
|
401
|
+
$(className).click( this.showType )
|
402
|
+
}
|
403
|
+
},
|
404
|
+
|
405
|
+
refreshView: function() {
|
406
|
+
data = this.get('data')
|
407
|
+
|
408
|
+
// Function Groups
|
409
|
+
menu = $('<li>')
|
410
|
+
title = $('<h3><a href="#">Functions</a></h3>').click( this.collapseSection )
|
411
|
+
menu.append(title)
|
412
|
+
list = $('<ul>')
|
413
|
+
_.each(data['groups'], function(group, i) {
|
414
|
+
flink = $('<a href="#" ref="' + i.toString() + '" id="groupItem' + group[0] + '">' + group[0] + ' <small>(' + group[1].length + ')</small></a>')
|
415
|
+
flink.click( this.showGroup )
|
416
|
+
fitem = $('<li>')
|
417
|
+
fitem.append(flink)
|
418
|
+
list.append(fitem)
|
419
|
+
}, this)
|
420
|
+
menu.append(list)
|
421
|
+
|
422
|
+
// Types
|
423
|
+
title = $('<h3><a href="#">Types</a></h3>').click( this.collapseSection )
|
424
|
+
menu.append(title)
|
425
|
+
list = $('<ul>')
|
426
|
+
|
427
|
+
fitem = $('<li>')
|
428
|
+
fitem.append($('<span>').addClass('divide').append("Enums"))
|
429
|
+
list.append(fitem)
|
430
|
+
|
431
|
+
_.each(data['types'], function(group, i) {
|
432
|
+
if(group[1]['block'] && group[1]['type'] == 'enum') {
|
433
|
+
flink = $('<a href="#" ref="' + i.toString() + '" id="typeItem' + domSafe(group[0]) + '">' + group[0] + '</a>')
|
434
|
+
flink.click( this.showType )
|
435
|
+
fitem = $('<li>')
|
436
|
+
fitem.append(flink)
|
437
|
+
list.append(fitem)
|
438
|
+
}
|
439
|
+
}, this)
|
440
|
+
|
441
|
+
fitem = $('<li>')
|
442
|
+
fitem.append($('<span>').addClass('divide').append("Structs"))
|
443
|
+
list.append(fitem)
|
444
|
+
|
445
|
+
_.each(data['types'], function(group, i) {
|
446
|
+
if(group[1]['block'] && group[1]['type'] != 'enum') {
|
447
|
+
flink = $('<a href="#" ref="' + i.toString() + '" id="typeItem' + domSafe(group[0]) + '">' + group[0] + '</a>')
|
448
|
+
flink.click( this.showType )
|
449
|
+
fitem = $('<li>')
|
450
|
+
fitem.append(flink)
|
451
|
+
list.append(fitem)
|
452
|
+
}
|
453
|
+
}, this)
|
454
|
+
|
455
|
+
fitem = $('<li>')
|
456
|
+
fitem.append($('<span>').addClass('divide').append("Opaque Structs"))
|
457
|
+
list.append(fitem)
|
458
|
+
|
459
|
+
_.each(data['types'], function(group, i) {
|
460
|
+
if(!group[1]['block']) {
|
461
|
+
flink = $('<a href="#" ref="' + i.toString() + '" id="typeItem' + domSafe(group[0]) + '">' + group[0] + '</a>')
|
462
|
+
flink.click( this.showType )
|
463
|
+
fitem = $('<li>')
|
464
|
+
fitem.append(flink)
|
465
|
+
list.append(fitem)
|
466
|
+
}
|
467
|
+
}, this)
|
468
|
+
list.hide()
|
469
|
+
menu.append(list)
|
470
|
+
|
471
|
+
// File Listing
|
472
|
+
title = $('<h3><a href="#">Files</a></h3>').click( this.collapseSection )
|
473
|
+
menu.append(title)
|
474
|
+
filelist = $('<ul>')
|
475
|
+
_.each(data['files'], function(file) {
|
476
|
+
url = this.github_file(file['file'])
|
477
|
+
flink = $('<a target="github" href="' + url + '">' + file['file'] + '</a>')
|
478
|
+
fitem = $('<li>')
|
479
|
+
fitem.append(flink)
|
480
|
+
filelist.append(fitem)
|
481
|
+
}, this)
|
482
|
+
filelist.hide()
|
483
|
+
menu.append(filelist)
|
484
|
+
|
485
|
+
list = $('#files-list')
|
486
|
+
list.empty()
|
487
|
+
list.append(menu)
|
488
|
+
},
|
489
|
+
|
490
|
+
github_file: function(file, line, lineto) {
|
491
|
+
url = "https://github.com/" + docurium.get('github')
|
492
|
+
url += "/blob/" + docurium.get('version') + '/' + data.prefix + '/' + file
|
493
|
+
if(line) {
|
494
|
+
url += '#L' + line.toString()
|
495
|
+
if(lineto) {
|
496
|
+
url += '-' + lineto.toString()
|
497
|
+
}
|
498
|
+
} else {
|
499
|
+
url += '#files'
|
500
|
+
}
|
501
|
+
return url
|
502
|
+
},
|
503
|
+
|
504
|
+
search: function(data) {
|
505
|
+
var searchResults = []
|
506
|
+
var value = $('#search-field').attr('value')
|
507
|
+
if (value.length < 3) {
|
508
|
+
return false
|
509
|
+
}
|
510
|
+
this.searchResults = []
|
511
|
+
|
512
|
+
ws.saveLocation(searchLink(value))
|
513
|
+
|
514
|
+
data = docurium.get('data')
|
515
|
+
|
516
|
+
// look for functions (name, comment, argline)
|
517
|
+
for (var name in data.functions) {
|
518
|
+
f = data.functions[name]
|
519
|
+
if (name.search(value) > -1) {
|
520
|
+
gname = docurium.groupOf(name)
|
521
|
+
var flink = $('<a>').attr('href', '#' + groupLink(gname, name)).append(name)
|
522
|
+
searchResults.push(['fun-' + name, flink, 'function'])
|
523
|
+
}
|
524
|
+
if (f.argline) {
|
525
|
+
if (f.argline.search(value) > -1) {
|
526
|
+
gname = docurium.groupOf(name)
|
527
|
+
var flink = $('<a>').attr('href', '#' + groupLink(gname, name)).append(name)
|
528
|
+
searchResults.push(['fun-' + name, flink, f.argline])
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}
|
532
|
+
for (var i in data.types) {
|
533
|
+
var type = data.types[i]
|
534
|
+
name = type[0]
|
535
|
+
if (name.search(value) > -1) {
|
536
|
+
var link = $('<a>').attr('href', '#' + typeLink(name)).append(name)
|
537
|
+
searchResults.push(['type-' + name, link, type[1].type])
|
538
|
+
}
|
539
|
+
}
|
540
|
+
|
541
|
+
// look for types
|
542
|
+
// look for files
|
543
|
+
content = $('.content')
|
544
|
+
content.empty()
|
545
|
+
|
546
|
+
content.append($('<h1>').append("Search Results"))
|
547
|
+
table = $("<table>")
|
548
|
+
var shown = {}
|
549
|
+
for (var i in searchResults) {
|
550
|
+
row = $("<tr>")
|
551
|
+
result = searchResults[i]
|
552
|
+
if (!shown[result[0]]) {
|
553
|
+
link = result[1]
|
554
|
+
match = result[2]
|
555
|
+
row.append($('<td>').append(link))
|
556
|
+
row.append($('<td>').append(match))
|
557
|
+
table.append(row)
|
558
|
+
shown[result[0]] = true
|
559
|
+
}
|
560
|
+
}
|
561
|
+
content.append(table)
|
562
|
+
|
563
|
+
}
|
564
|
+
|
565
|
+
})
|
566
|
+
|
567
|
+
var Workspace = Backbone.Controller.extend({
|
568
|
+
|
569
|
+
routes: {
|
570
|
+
"": "main",
|
571
|
+
":version": "main",
|
572
|
+
":version/group/:group": "group",
|
573
|
+
":version/type/:type": "showtype",
|
574
|
+
":version/group/:group/:func": "groupFun",
|
575
|
+
":version/search/:query": "search",
|
576
|
+
"p/changelog": "changelog",
|
577
|
+
},
|
578
|
+
|
579
|
+
main: function(version) {
|
580
|
+
docurium.setVersion(version)
|
581
|
+
docurium.showIndexPage()
|
582
|
+
},
|
583
|
+
|
584
|
+
group: function(version, gname) {
|
585
|
+
docurium.setVersion(version)
|
586
|
+
docurium.showGroup(null, gname)
|
587
|
+
},
|
588
|
+
|
589
|
+
groupFun: function(version, gname, fname) {
|
590
|
+
docurium.setVersion(version)
|
591
|
+
docurium.showFun(gname, fname)
|
592
|
+
},
|
593
|
+
|
594
|
+
showtype: function(version, tname) {
|
595
|
+
docurium.setVersion(version)
|
596
|
+
docurium.showType(null, tname)
|
597
|
+
},
|
598
|
+
|
599
|
+
search: function(version, query) {
|
600
|
+
docurium.setVersion(version)
|
601
|
+
$('#search-field').attr('value', query)
|
602
|
+
docurium.search()
|
603
|
+
},
|
604
|
+
|
605
|
+
changelog: function(version, tname) {
|
606
|
+
docurium.showChangeLog()
|
607
|
+
},
|
608
|
+
|
609
|
+
});
|
610
|
+
|
611
|
+
function groupLink(gname, fname, version) {
|
612
|
+
if(!version) {
|
613
|
+
version = docurium.get('version')
|
614
|
+
}
|
615
|
+
if(fname) {
|
616
|
+
return version + "/group/" + gname + '/' + fname
|
617
|
+
} else {
|
618
|
+
return version + "/group/" + gname
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
622
|
+
function typeLink(tname) {
|
623
|
+
return docurium.get('version') + "/type/" + tname
|
624
|
+
}
|
625
|
+
|
626
|
+
function searchLink(tname) {
|
627
|
+
return docurium.get('version') + "/search/" + tname
|
628
|
+
}
|
629
|
+
|
630
|
+
function domSafe(str) {
|
631
|
+
return str.replace('_', '-')
|
632
|
+
}
|
633
|
+
|
634
|
+
|
635
|
+
window.docurium = new Docurium
|
636
|
+
window.ws = new Workspace
|
637
|
+
|
638
|
+
docurium.bind('change:version', function(model, version) {
|
639
|
+
$('#version').text(version)
|
640
|
+
})
|
641
|
+
docurium.bind('change:data', function(model, data) {
|
642
|
+
model.refreshView()
|
643
|
+
})
|
644
|
+
|
645
|
+
$('#search-field').keyup( docurium.search )
|
646
|
+
|
647
|
+
$('#version-picker').click( docurium.collapseSection )
|
648
|
+
|
649
|
+
})
|