Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

make safe ids

  • Loading branch information...
commit b2ff710cf9eb32f1efde022ceb1be24cf51cbdea 1 parent 401b69a
Vladimir Dronnikov dvv authored

Showing 2 changed files with 21 additions and 6 deletions. Show diff stats Hide diff stats

  1. +2 0  lib/index.js
  2. +19 6 templates/layout.jade
2  lib/index.js
@@ -182,6 +182,8 @@ NDoc.prototype.toHTML = function(options) {
182 182
183 183 var tree = this.tree;
184 184 for (var i in tree) {
  185 + // path should be HTML valid id
  186 + tree[i].path = tree[i].path.replace(/\//g, '-');
185 187 ///console.log(i);
186 188 ///tree[i].deprecated = true;
187 189 }
25 templates/layout.jade
@@ -7,8 +7,7 @@ html
7 7 meta(name='generator', content='ndoc')
8 8 script(charset='utf-8', src='javascripts/jquery-1.7.min.js', type='text/javascript')
9 9 script(charset='utf-8', src='javascripts/prettify.js', type='text/javascript')
10   - //-
11   - script(charset='utf-8', src='javascripts/jquery.smooth-scroll.min.js', type='text/javascript')
  10 + script(charset='utf-8', src='javascripts/jquery.smooth-scroll.min.js', type='text/javascript')
12 11 script(charset='utf-8', type='text/javascript')
13 12 var onchange;
14 13 $(document)
@@ -46,7 +45,21 @@ html
46 45 //var unhide = $('div.article[id="' + $(this).attr('href').substring(1) + '"]')
47 46 //console.log('UNH', unhide)
48 47 //unhide.show();
49   - });
  48 + //return false;
  49 + })
  50 + /*.delegate('a[href^="#"]', 'click', function(ev) {
  51 + //ev.preventDefault();
  52 + var href = $(this).attr('href');
  53 + var el = $('[id="' + href.substring(1) + '"]');
  54 + //if (!el.length) return true;
  55 + console.log('SCR', el.offset().top)
  56 + $('html, body').stop().animate({
  57 + scrollTop: el.offset().top
  58 + }, 1000, 'linear', function() {
  59 + location.hash = href;
  60 + });
  61 + return false;
  62 + })*/;
50 63
51 64 link(charset='utf-8', href='stylesheets/api.css', media='screen, projection', rel='stylesheet', type='text/css')
52 65 link(charset='utf-8', href='stylesheets/prettify.css', media='screen, projection', rel='stylesheet', type='text/css')
@@ -99,8 +112,8 @@ html
99 112 $('#home pre >code').removeClass('prettyprint');
100 113 prettyPrint();
101 114 // setup smooth scroll for local anchors
102   - //$('a[href^="#"]').smoothScroll();
103   - $('a[href^="#"]').click(function(ev) {
  115 + $('a[href^="#"]').smoothScroll();
  116 + /*$('a[href^="#"]').click(function(ev) {
104 117 //ev.preventDefault();
105 118 var href = $(this).attr('href');
106 119 var el = $('[id="' + href.substring(1) + '"]');
@@ -112,5 +125,5 @@ html
112 125 location.hash = href;
113 126 });
114 127 return false;
115   - });
  128 + });*/
116 129 });

0 comments on commit b2ff710

Please sign in to comment.
Something went wrong with that request. Please try again.