Thanks for the patch Wiil, I've committed it to the trunk:
http://code.google.com/p/asciidoc/source/detail?r=2a21e2f6c06f7d4ffd87ec164425e6348e4cc826
Cheers, Stuart
On 18/08/11 21:42, Will wrote:
Hi Stuart,
After reading the thread you pointed to I think the best solution is
updating the DIV reference. Here's the result of a diff:
$ diff -u a/asciidoc.js b/asciidoc.js
--- a/asciidoc.js Fri Apr 22 15:29:44 2011
+++ b/asciidoc.js Mon Aug 15 15:53:07 2011
@@ -68,7 +68,7 @@
var i;
for (i = 0; i< toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
- if (entry.nodeName == 'DIV'
+ if (entry.nodeName == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
@@ -114,7 +114,7 @@
var entriesToRemove = [];
for (i = 0; i< noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
- if (entry.nodeName == 'DIV'&& entry.getAttribute("class") ==
"footnote")
+ if (entry.nodeName == 'div'&& entry.getAttribute("class") ==
"footnote")
entriesToRemove.push(entry);
}
for (i = 0; i< entriesToRemove.length; i++) {
Cheers,
Will
On Aug 18, 5:10 am, Stuart Rackham<[email protected]> wrote:
Hi Will
On 16/08/11 02:58, Will wrote:
Hi,
I found the TOC& footnotes generator with asciidoc 8.6.5 under
Windows XP sp3 duplicates items (TOC entries or footnotes) if an XHTML
document is large or slow to load.
To replicate you can create a document that embeds (using the data-uri
scheme) a large image. As the image takes some time to load in the
browser (tested with FF 6.0 beta and Chrome 13.0.782.112) it has the
same effect as a large document. Example (image is 4560 x 3052 px&
510 x 510 ppi):
= AsciiDoc TOC test
== Lorem ipsum
Lorem ipsum dolor sit ametfootnote:[lobortis id venenatis sed],
consectetur adipiscing elit. Cras consecteturfootnote:[vel sagittis
mauris iaculis in] lobortis mauris, id malesuada mi sollicitudin eget.
Nullam magna ante, consectetur vitae scelerisque quis, porttitor
volutpat sapien. Duis at purus nec arcu luctus luctus vitae eu neque.
Praesent vel est vel diam auctor scelerisque. Nam nec nulla eget metus
dapibus rhoncus.
image::./jimmy.jpg[alt="Zoso",width="800"]
== Cras consectetur
Etiam nulla purus, pellentesque eget ultrices vitae, consequat vitae
massa. Cras imperdiet, justo eget ultricies congue, neque urna rutrum
quam, sit amet egestas ante nisi sit amet arcu. Nam posuere velit sed
magna sodales ornare. Quisque at elementum ligula. Etiam aliquam,
tortor a vulputate imperdiet, nibh justo pellentesque tellus, eu
gravida massa dui sed nulla. Aliquam sodales elit a nunc egestas
placerat.
== Nullam magna ante
Donec pretium tincidunt semper. Phasellus congue ornare tortor eu
semper. Phasellus iaculis tempus lorem id pellentesque. Morbi
elementum commodo nisl vel euismod. Aliquam ac nibh quis sapien
tristique lobortis. Quisque ligula enim, tempus a aliquam sit amet,
tempor sed est. Ut sit amet augue lacus. Etiam tortor est, pretium
eget vulputate at, blandit eu tortor. Fusce eget rutrum purus. Aenean
est eros, suscipit at dignissim condimentum, suscipit id mi.
Rendering:
python C:\bin\asciidoc-8.6.5\asciidoc.py --verbose --attribute data-
uri --attribute icons --attribute numbered --backend=xhtml11 --out-
file="L:\el\sa\_asciidoc\toc-test\asciidoc-toc-test.xhtml" --attribute
toc "L:\el\sa\_asciidoc\toc-test\asciidoc-toc-test.txt"
It seems the issue is with the code that drops existing elements
before recreating, as it references the elements by tag name "DIV"
instead of "div". Editing lines 71& 117 does the trick.
Alternatively, it can be changed to only build the TOC/footnotes once
(after the document has loaded) by commenting out lines 178& 182.
Increasing the interval set on line 182 (e.g. from 500 to 3000) has
the same effect but is probably pointless.
Thanks for spotting this and figuring out the fixes, which fix do you think is
best? Could you please post a diff of the changes (I'm not familar with this
code). The change was made here:
http://code.google.com/p/asciidoc/source/detail?r=327c1c7ff4da355f2bf...
and followed considerable discussion:
http://groups.google.com/group/asciidoc/browse_thread/thread/5a7fe64f...
Cheers, Stuart
Cheers,
Will
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/asciidoc?hl=en.