Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make safe ids

  • Loading branch information...
commit b2ff710cf9eb32f1efde022ceb1be24cf51cbdea 1 parent 401b69a
@dvv dvv authored
Showing with 21 additions and 6 deletions.
  1. +2 −0  lib/index.js
  2. +19 −6 templates/layout.jade
View
2  lib/index.js
@@ -182,6 +182,8 @@ NDoc.prototype.toHTML = function(options) {
var tree = this.tree;
for (var i in tree) {
+ // path should be HTML valid id
+ tree[i].path = tree[i].path.replace(/\//g, '-');
///console.log(i);
///tree[i].deprecated = true;
}
View
25 templates/layout.jade
@@ -7,8 +7,7 @@ html
meta(name='generator', content='ndoc')
script(charset='utf-8', src='javascripts/jquery-1.7.min.js', type='text/javascript')
script(charset='utf-8', src='javascripts/prettify.js', type='text/javascript')
- //-
- script(charset='utf-8', src='javascripts/jquery.smooth-scroll.min.js', type='text/javascript')
+ script(charset='utf-8', src='javascripts/jquery.smooth-scroll.min.js', type='text/javascript')
script(charset='utf-8', type='text/javascript')
var onchange;
$(document)
@@ -46,7 +45,21 @@ html
//var unhide = $('div.article[id="' + $(this).attr('href').substring(1) + '"]')
//console.log('UNH', unhide)
//unhide.show();
- });
+ //return false;
+ })
+ /*.delegate('a[href^="#"]', 'click', function(ev) {
+ //ev.preventDefault();
+ var href = $(this).attr('href');
+ var el = $('[id="' + href.substring(1) + '"]');
+ //if (!el.length) return true;
+ console.log('SCR', el.offset().top)
+ $('html, body').stop().animate({
+ scrollTop: el.offset().top
+ }, 1000, 'linear', function() {
+ location.hash = href;
+ });
+ return false;
+ })*/;
link(charset='utf-8', href='stylesheets/api.css', media='screen, projection', rel='stylesheet', type='text/css')
link(charset='utf-8', href='stylesheets/prettify.css', media='screen, projection', rel='stylesheet', type='text/css')
@@ -99,8 +112,8 @@ html
$('#home pre >code').removeClass('prettyprint');
prettyPrint();
// setup smooth scroll for local anchors
- //$('a[href^="#"]').smoothScroll();
- $('a[href^="#"]').click(function(ev) {
+ $('a[href^="#"]').smoothScroll();
+ /*$('a[href^="#"]').click(function(ev) {
//ev.preventDefault();
var href = $(this).attr('href');
var el = $('[id="' + href.substring(1) + '"]');
@@ -112,5 +125,5 @@ html
location.hash = href;
});
return false;
- });
+ });*/
});
Please sign in to comment.
Something went wrong with that request. Please try again.