From 90ec9e6e4d97f8ef3e863efa0aa00e924d70396c Mon Sep 17 00:00:00 2001 From: Shi-Chao Xia Date: Fri, 4 Sep 2020 15:15:28 +0800 Subject: [PATCH] Fix the problem of minitoc display not working properly --- styles/bigblow/js/bigblow.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/styles/bigblow/js/bigblow.js b/styles/bigblow/js/bigblow.js index e7349c7..b38b7b4 100644 --- a/styles/bigblow/js/bigblow.js +++ b/styles/bigblow/js/bigblow.js @@ -47,8 +47,17 @@ $(function() { function generateMiniToc(divId) { $('#minitoc').empty().append('

In this section

'); $('#' + divId).find('h3').each(function(i) { - let pos = $(this).text().search(" "); - let text = $(this).text().substring(0, pos); + // Get text up to non-breaking space, to omit the + // tags. If there are no tags, there will be no + //  , so get all the text. + let text = null; + let pos = $(this).text().search(/ | ►/); + if (pos > 0) { + text = $(this).text().substring(0, pos); + } + else { + text = $(this).text(); + } $("#minitoc").append("" + text + ""); });