From 724d141d3aeaa7a40219dd4292e590c6012fd188 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 23 Oct 2018 18:05:02 +0200 Subject: [PATCH] Fix links and navigation --- config/jsdoc/api/template/static/scripts/main.js | 14 ++++++++++++-- config/jsdoc/api/template/tmpl/layout.tmpl | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/jsdoc/api/template/static/scripts/main.js b/config/jsdoc/api/template/static/scripts/main.js index acf43fde7b..a3419068d6 100644 --- a/config/jsdoc/api/template/static/scripts/main.js +++ b/config/jsdoc/api/template/static/scripts/main.js @@ -30,7 +30,11 @@ $(function () { }); // Show an item related a current documentation automatically - var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, ''); + var filename = $('.page-title').data('filename') + .replace(/\.[a-z]+$/, '') + .replace('module-', 'module:') + .replace(/_/g, '/') + .replace(/-/g, '~'); var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)'); if ($currentItem.length) { @@ -97,7 +101,8 @@ $(function () { var anchors = $('.anchor'); var _onHashChange = function () { var activeHash = window.document.location.hash - .replace(/\./g, '\\.'); // Escape dot in element id + .replace(/\./g, '\\.') // Escape dot in element id + .replace(/\~/g, '\\~'); // Escape tilde in element id anchors.removeClass('highlighted'); @@ -108,4 +113,9 @@ $(function () { $(window).on('hashchange', _onHashChange); _onHashChange(); + + // Make links that JSDoc forgot clickable + $('p').each(function(i, p) { + p.innerHTML = anchorme(p.innerHTML); + }); }); diff --git a/config/jsdoc/api/template/tmpl/layout.tmpl b/config/jsdoc/api/template/tmpl/layout.tmpl index fd99c511a7..74d383cd09 100644 --- a/config/jsdoc/api/template/tmpl/layout.tmpl +++ b/config/jsdoc/api/template/tmpl/layout.tmpl @@ -14,6 +14,7 @@ var version = obj.packageInfo.version; OpenLayers v<?js= version ?> API - <?js= title ?> +