Skip to content

Commit 768bbcf

Browse files
Update to latest template that works well with online doc app for #16
1 parent dc0ca7b commit 768bbcf

22 files changed

+1660
-973
lines changed

etc/marklogic-template/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Template for API Documentation
2+
3+
This directory contains a template for generating JSDoc API docs
4+
with gulp-jsdoc. The contents are derived from the bootswatch
5+
"simplex" template, as generated by docstrap.
6+
7+
The original template was modified in the following ways:
8+
* Minor color, font and other aethestic changes using the usual
9+
docstrap variables.
10+
* Removed the @import of google fonts because they are not
11+
always reachable and can cause long page loads.
12+
* Removed all embedded javascript so the pages can safely be hosted
13+
by MarkLogic Server as XHTML. This meant trouncing on some of the
14+
configurable parts of the original setting. For example, you cannot
15+
enable Google analytics, despite what docstrap thinks.
16+
17+
To generate the docs using this template, run "gulp doc" from the
18+
root project directory.
19+
20+
You can also use an alternative docstrap/bootswatch or a custom template
21+
of your choosing. To use a different template:
22+
* Edit gulpfile.js in the root project directory and change the "path"
23+
and "theme" values of the "doc" task.
24+
* Run "gulp doc" from the root project directory. The docs are
25+
generated into a doc/ subdirectory.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Extracted from layout.html
2+
$( function () {
3+
$( '#main' ).localScroll( {
4+
offset : { top : 60 } //offset by the height of your header (give or take a few px, see what works for you)
5+
} );
6+
$( "dt.name" ).each( function () {
7+
var $this = $( this ).find("h4");
8+
var icon = $( "<i/>" ).addClass( "icon-plus-sign" ).addClass( "pull-right" ).addClass( "icon-white" );
9+
var dt = $(this);
10+
var children = dt.next( "dd" );
11+
12+
dt.prepend( icon ).css( {cursor : "pointer"} );
13+
dt.addClass( "member-collapsed" ).addClass( "member" );
14+
15+
16+
children.hide();
17+
18+
dt.children().on( "click", function () {
19+
children = dt.next( "dd" );
20+
console.debug(dt, children)
21+
children.slideToggle( "fast", function () {
22+
23+
if ( children.is( ":visible" ) ) {
24+
icon.addClass( "icon-minus-sign" ).removeClass( "icon-plus-sign" ).removeClass( "icon-white" );
25+
dt.addClass( "member-open" ).animate( "member-collapsed" );
26+
} else {
27+
icon.addClass( "icon-plus-sign" ).removeClass( "icon-minus-sign" ).addClass( "icon-white" );
28+
dt.addClass( "member-collapsed" ).removeClass( "member-open" );
29+
}
30+
} );
31+
} );
32+
33+
} );
34+
} );
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Extracted from layout.html
2+
$( function () {
3+
$( "[id*='$']" ).each( function () {
4+
var $this = $( this );
5+
6+
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
7+
} );
8+
9+
$( "#toc" ).toc( {
10+
anchorName : function ( i, heading, prefix ) {
11+
return $( heading ).attr( "id" ) || ( prefix + i );
12+
},
13+
selectors : "h1,h2,h3,h4",
14+
showAndHide : false,
15+
scrollTo : "100px"
16+
} );
17+
18+
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
19+
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
20+
$( '.dropdown-toggle' ).dropdown();
21+
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
22+
23+
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
24+
var $this = $( this );
25+
26+
var example = $this.find( "code" );
27+
exampleText = example.html();
28+
var lang = /{@lang (.*?)}/.exec( exampleText );
29+
if ( lang && lang[1] ) {
30+
exampleText = exampleText.replace( lang[0], "" );
31+
example.html( exampleText );
32+
lang = lang[1];
33+
} else {
34+
lang = "javascript";
35+
}
36+
37+
if ( lang ) {
38+
39+
$this
40+
.addClass( "sunlight-highlight-" + lang )
41+
.addClass( "linenums" )
42+
.html( example.html() );
43+
44+
}
45+
} );
46+
47+
Sunlight.highlightAll( {
48+
lineNumbers : true,
49+
showMenu : true,
50+
enableDoclinks : true
51+
} );
52+
} );

0 commit comments

Comments
 (0)