#710 Lots of redundant, bad anchors built on file load

0.8a3_(obsolete)
open
nobody
5
2011-11-01
2011-11-01
Bob
No

System: Linux cameron 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux
Version: current for Ubuntu: version 0.8b3 (20081229)
Language: HTML4, DTD: strict

I'm using KompoZer to build Kindle-ready documents - one huge document. Document is currently 1200 lines or so and growing. Chapters are defined using <h3>, with subsections using <h4> and <h5> The problem comes when I introduce a new cross-link into the document. I create a new link and use KompoZer's nice link builder that lists the <h3>, <h4>, and <h5> sections. When I build a link I see an anchor point on the target, as expected. However, when I save the document and reload it, I find lots of stray links. In a particular section, for example, it seems like every <br> and maybe every <span> has a link that duplicates the most recent real anchor above it in the file. However, not every paragraph, <br>, etc has a bad anchor. I haven't figured out the pattern yet. I'll have a long section with every line, practically, carrying a bad anchor, and then a section with no bad anchors at all.

I can remove the bad anchors using the right-click popup menu. When I do so, I can save the document and re-load it, and the bad anchors do not appear again. I can edit, save, and reload as much as I want with no bad anchors - until I add a new link to an anchor point inside the document. It doesn't seem to matter whether the point already has an anchor defined or not. A new link causes a bunch of bad anchors the next time I load the document.

I've looked at the saved document with another editor. The bad anchors are NOT there when I save the document. They're getting built when the document is loaded for the first time after I create a new link, but I can't figure out why, nor can I figure out what's triggering the problem in either KompoZer or the HTML.

Thoughts? Experiments you'd like me to run?

Discussion

  • Bob
    Bob
    2011-11-02

    (Later) It appears that the bad anchors get generated between a newly-added anchor and one that was already there. "Already there" means the old anchor was in the file when it was loaded, before the new anchor was created.

     
  • Bob
    Bob
    2011-11-03

    (Still later) The problem involves some sort of input processing on the <a> tag. When the file gets saved, a new anchor tag is properly represented as <a name="something" />. After the file gets reloaded, the anchor appears as <a name="something" >, and the closing anchor tag </a> is some distance away, at the end of the current paragraph or section or whatever. The code is behaving as if it is ignoring the "/>" type closure and is trying to put text inside an anchor point (which doesn't actually need any content, I believe).

    To check this hypothesis, I did the following:
    (a) build a new anchor using the normal dialog
    (b) hand-edit the anchor <a name="test.test.test"/>some text => <a name="test.test.test">some text</a>
    (Kompozer would not let me do an <a name...></a> construct - I needed text between the <a> and the </a>)

    Sure enough, when I saved and reloaded the file, I had no spurious anchors created.

     
  • Jonathan Doig
    Jonathan Doig
    2012-04-12

    Same here. Kompozer version 0.7.10 (20070831) on Windows XP.

    I simply load a pre-existing HTML and resave, and Kompozer adds many spurious anchors of the form:
    <a id="anchor-anchor" name="anchor-anchor"> ... </a>
    and
    <a id="anchor-NN-anchor" name="anchor-NN-anchor">...</a>
    where "NN" is a 2-digit number eg 25