Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Patch] The reinstall timer breaks footnoterefs (asciidoc.js) #30

Open
GoogleCodeExporter opened this issue Jul 17, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

If the asciidoc.footnotes() function is called twice (such as if the reinstall 
timer is triggered), then all footnoterefs are renumbered to 'undefined' and 
broken. The attached patch solves this by only renumbering footnoterefs when a 
valid number is found for them:

diff -r 7863b0a0ab0d -r 1dad4b041c4a javascripts/asciidoc.js
--- a/javascripts/asciidoc.js   Wed Nov 27 21:59:21 2013 +1300
+++ b/javascripts/asciidoc.js   Tue Apr 15 09:09:29 2014 -0600
@@ -156,9 +156,11 @@
         var href = spans[i].getElementsByTagName("a")[0].getAttribute("href
         href = href.match(/#.*/)[0];  // Because IE return full URL.
         n = refs[href];
-        spans[i].innerHTML =
-          "[<a href='#_footnote_" + n +
-          "' title='View footnote' class='footnote'>" + n + "</a>]";
+        if (n) {
+          spans[i].innerHTML =
+            "[<a href='#_footnote_" + n +
+            "' title='View footnote' class='footnote'>" + n + "</a>]";
+        }
       }
     }
   }

Original issue reported on code.google.com by cristo...@gmail.com on 15 Apr 2014 at 3:39

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant