File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ <h3>API Documentation</h3>
115115 </ tr >
116116 </ tbody >
117117 </ table >
118- < hr >
118+ < pre class = "const language-javascript" >
119+ < code > var { { jsClassName } } = require("nodegit").{ { jsClassName } } ;</ code > </ pre >
119120 < div class = "header" >
120121 < strong class = "{%if not ignore%}is{%else%}not{%endif%} added" > in API</ strong >
121122 < strong class = "deps" > Depends on: < a class = "ref" > Repository</ a > </ strong >
@@ -155,6 +156,15 @@ <h4>Functions:</h4>
155156 { % each functions as function % }
156157 < li id = "{{jsClassName}}/function/{{function.jsFunctionName}}" >
157158 < strong class = "{%if not function.ignore%}is{%else%}not{%endif%} added" > { { jsClassName} } #</ strong > < strong class = "method" > { { function . jsFunctionName} } </ strong >
159+ { % if function . isConstructorMethod % }
160+ < pre class = "function language-javascript" > < code > { { jsClassName } } .{ { function . jsFunctionName } } ({ % each function . args | realArgs as arg % } { { arg. name | addComma arg i } } { % endeach % } );</ code > </ pre >
161+ { % else % }
162+ < pre class = "function language-javascript" >
163+ < code > var { { jsClassName | toCamelCase } } = new { { jsClassName } } ();
164+ { { jsClassName | toCamelCase } } .{ { function . jsFunctionName } } ({ % each function . args | realArgs as arg % } { { arg. name | addComma arg i } } { % endeach % } );
165+ </ code > </ pre >
166+ { % endif % }
167+
158168 < p > { { { function. comment } } } </ p >
159169 < h4 > Arguments :</h4 >
160170 < div class = "arguments" >
Original file line number Diff line number Diff line change 1515
1616 var contentTemplate = combyne ( $ ( ".api-content script" ) . eq ( 1 ) . html ( ) . trim ( ) ) ;
1717
18+ contentTemplate . registerFilter ( "realArgs" , function ( args ) {
19+ return args . filter ( function ( arg ) {
20+ return ! arg . isSelf && ! arg . isReturn ;
21+ } ) . map ( function ( arg , val , all ) {
22+ arg . length = all . length ;
23+ return arg ;
24+ } ) ;
25+ } ) ;
26+
27+ contentTemplate . registerFilter ( "addComma" , function ( value , arg , index ) {
28+ if ( index === arg . length - 1 ) {
29+ return value ;
30+ }
31+ else {
32+ return value + ", " ;
33+ }
34+ } ) ;
35+
36+ contentTemplate . registerFilter ( "toCamelCase" , function ( value ) {
37+ return value [ 0 ] . toLowerCase ( ) + value . slice ( 1 ) ;
38+ } ) ;
39+
1840 resp . forEach ( function ( ctor ) {
1941 // Add nav entry.
2042 var anchor = $ ( "<a href='#" + ctor . jsClassName + "'><li>" + ctor . jsClassName + "</li><ul class='subnav'></ul></a>" ) . appendTo ( scrollable ) ;
3254 } ) ;
3355 } ) ;
3456
57+ // Highlight the new code blocks.
58+ Prism . highlightAll ( ) ;
59+
3560 listApi . on ( "click" , "a" , function ( ev ) {
3661 listApi . find ( "a" ) . removeClass ( "active" ) ;
3762 $ ( this ) . addClass ( "active" ) ;
Original file line number Diff line number Diff line change @@ -160,3 +160,18 @@ ul.api-contents table h3 {
160160}
161161
162162.scrollable ::-webkit-scrollbar { width : 0 !important }
163+
164+ .api-contents pre .const {
165+ border : 1px solid # DFDADA ;
166+ margin-right : -20px ;
167+ margin-top : 20px ;
168+ margin-bottom : 20px ;
169+ }
170+
171+ .api-contents pre .const code {
172+ margin-left : 10px ;
173+ }
174+
175+ pre .function {
176+ margin-left : 0px !important ;
177+ }
You can’t perform that action at this time.
0 commit comments