jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 1.x PDF Plugin
  • MPPDF-40

Can't use 2 subsections with the same name

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.3
  • Fix Version/s: 2.5
  • Labels:
    None
  • Testcase included:
    yes

Description

If 2 subsections have the same name the pdf generation fails because they have the same id.

For exemple :
<section name="Section 1">
<subsection name="SubSection">
</subsection>
</section>
<section name="Section2">
<subsection name="SubSection">
</subsection>
</section>

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    MPPDF-40.patch
    22/Aug/05 12:17 AM
    1 kB
    Lukas Theussl

Issue Links

relates to

Bug - A problem which impairs or prevents the functions of the product. MPPDF-19 Cannot build the pdf documentation for maven 1.1

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Lukas Theussl added a comment - 23/Jun/05 10:47 AM

My personal feeling is that this is rather a fop issue - duplicate id's should be ignored and not lead to a build failure. In principle I could work around that by enumerating identical id's, however, it would be impossible to resolve the ambiguity when two identical id's are referenced. For that reason I think it would be better to just document the issue.

Note that the issue only applies to id's within the same document, and that identical <a name="id"> tags lead to the same problem.

Also note that the xdoc plugin will generate identical id's for the example above as well.

Show
Lukas Theussl added a comment - 23/Jun/05 10:47 AM My personal feeling is that this is rather a fop issue - duplicate id's should be ignored and not lead to a build failure. In principle I could work around that by enumerating identical id's, however, it would be impossible to resolve the ambiguity when two identical id's are referenced. For that reason I think it would be better to just document the issue. Note that the issue only applies to id's within the same document, and that identical <a name="id"> tags lead to the same problem. Also note that the xdoc plugin will generate identical id's for the example above as well.
Hide
Permalink
Arnaud Heritier added a comment - 10/Aug/05 4:24 PM

certainly the same issue

Show
Arnaud Heritier added a comment - 10/Aug/05 4:24 PM certainly the same issue
Hide
Permalink
Lukas Theussl added a comment - 14/Aug/05 10:53 AM

Actually,your example above leads to an invalid HTML document, because according to the HTML 4.01 specs ( http://www.w3.org/TR/html4/struct/links.html#h-12.2.1 ), anchor names must be unique within one document.

Show
Lukas Theussl added a comment - 14/Aug/05 10:53 AM Actually,your example above leads to an invalid HTML document, because according to the HTML 4.01 specs ( http://www.w3.org/TR/html4/struct/links.html#h-12.2.1 ), anchor names must be unique within one document.
Hide
Permalink
Arnaud Heritier added a comment - 14/Aug/05 6:45 PM

You're right but the end user musn't know that a subsection name generates an id which must be unique. It's the plugin's problem to generate an unique id ? WDYT ?

Show
Arnaud Heritier added a comment - 14/Aug/05 6:45 PM You're right but the end user musn't know that a subsection name generates an id which must be unique. It's the plugin's problem to generate an unique id ? WDYT ?
Hide
Permalink
Lukas Theussl added a comment - 14/Aug/05 8:09 PM

Even if we would generate a unique id, it would be completely useless for the end user if he doesn't know how to reference it
(how would you link to your two subsections above from a different source document?). We would have to document and tell the user
how we generate the ids, but then we can also tell him to use unique ids in the first place.

The only alternative that I see is to abandon the id generation from section names completely and tell the user to use a unique <a name=""/> element for every
section he wants to reference. That would be the cleanest solution, but it would break compatibility with the xdoc plugin
and I would only support it if the same change would be made in the xdoc plugin.
(thinking about it, one should actually open the very same issue for the xdoc plugin, for the reason I stated above).

Show
Lukas Theussl added a comment - 14/Aug/05 8:09 PM Even if we would generate a unique id, it would be completely useless for the end user if he doesn't know how to reference it (how would you link to your two subsections above from a different source document?). We would have to document and tell the user how we generate the ids, but then we can also tell him to use unique ids in the first place. The only alternative that I see is to abandon the id generation from section names completely and tell the user to use a unique <a name=""/> element for every section he wants to reference. That would be the cleanest solution, but it would break compatibility with the xdoc plugin and I would only support it if the same change would be made in the xdoc plugin. (thinking about it, one should actually open the very same issue for the xdoc plugin, for the reason I stated above).
Hide
Permalink
Wendy Smoak added a comment - 21/Aug/05 9:26 AM

I agree that this needs to be fixed in xdoc first. I didn't see that anyone had yet reported it, so I opened a feature request to allow <section name="Some Long Description" href="desc"> to allow users to pick the anchor name they want.

See: http://jira.codehaus.org/browse/MPXDOC-159

Show
Wendy Smoak added a comment - 21/Aug/05 9:26 AM I agree that this needs to be fixed in xdoc first. I didn't see that anyone had yet reported it, so I opened a feature request to allow <section name="Some Long Description" href="desc"> to allow users to pick the anchor name they want. See: http://jira.codehaus.org/browse/MPXDOC-159
Hide
Permalink
Lukas Theussl added a comment - 22/Aug/05 12:17 AM

This should do the job: I introduce an optional 'id' tag like I indicated in my original description for MPXDOC-158.
If this id tag is present, it will be used for referencing, if it is omitted, the 'name' tag will be used. Like that we stay compatible with xdoc (well, almost, links will behave differently, but that is an xdoc problem). We just have to document that for identical sub/section names, it is mandatory to specify unique id tags.

Note that this patch only fixes the problem of identical sub/sections, identical links in navigation.xml will still fail (but I don't think it is necessary to fix that).

I will submit an analogous patch for the xdoc plugin but the current patch can be applied independently of that.

Show
Lukas Theussl added a comment - 22/Aug/05 12:17 AM This should do the job: I introduce an optional 'id' tag like I indicated in my original description for MPXDOC-158. If this id tag is present, it will be used for referencing, if it is omitted, the 'name' tag will be used. Like that we stay compatible with xdoc (well, almost, links will behave differently, but that is an xdoc problem). We just have to document that for identical sub/section names, it is mandatory to specify unique id tags. Note that this patch only fixes the problem of identical sub/sections, identical links in navigation.xml will still fail (but I don't think it is necessary to fix that). I will submit an analogous patch for the xdoc plugin but the current patch can be applied independently of that.
Hide
Permalink
Arnaud Heritier added a comment - 22/Aug/05 5:19 PM

Another idea to improve ids with the default naming is to generate them from the section/subsections tree.
For exemple :
<section name="A"> ==> Generates id="A"
<subsection name="B"> ==> Generates id="A_B"
<subsection name="C"> ==> Generates id="A_B_C"
</subsection>
</subsection>
<subsection name="D"> ==> Generates id="A_D"
</subsection>
</section>
I don't know if there's a maximum number of chars in an id.

Show
Arnaud Heritier added a comment - 22/Aug/05 5:19 PM Another idea to improve ids with the default naming is to generate them from the section/subsections tree. For exemple : <section name="A"> ==> Generates id="A" <subsection name="B"> ==> Generates id="A_B" <subsection name="C"> ==> Generates id="A_B_C" </subsection> </subsection> <subsection name="D"> ==> Generates id="A_D" </subsection> </section> I don't know if there's a maximum number of chars in an id.
Hide
Permalink
Lukas Theussl added a comment - 22/Aug/05 5:58 PM

In your example, a <section name="A B"> would generate the same id as the first subsection, so this is not fool proof.

My personal opinion is that the plugin should not auto-generate id's at all (except where they are only used internally, like for the table of contents, in which case the user does not need to know anything about it). The only raison d'etre for the id generation for sub/sections is to make it referencable for the user. If the user wants to reference a sub/section, he should provide an id himself.

Note that in the old version of the plugin, before my fix for MPPDF-24, ids for sub/sections were generated using xslt's generate-id() function, which gave a unique id in all cases. However, they were completely useless because they were re-generated dynamically at each build time and the user couldn't know how to reference them. I conclude that if you want to ensure unique ids, you would have to auto-generate them according to some algorithm, but in that case they are useless because they can't be referenced. If you want id's that the user can reference easily, there is no way to ensure they are unique.

I'd rather propose to remove the id generation from name tags altogether and keep the id tag as an option (that's how it should be in the xdoc plugin as well). Thus, we maintain backwards compatibility within the pdf plugin and avoid any build failures. The worst thing that can happen is that a link to a section does not work in the generated pdf if the user forgets to specify an id tag.

Show
Lukas Theussl added a comment - 22/Aug/05 5:58 PM In your example, a <section name="A B"> would generate the same id as the first subsection, so this is not fool proof. My personal opinion is that the plugin should not auto-generate id's at all (except where they are only used internally, like for the table of contents, in which case the user does not need to know anything about it). The only raison d'etre for the id generation for sub/sections is to make it referencable for the user. If the user wants to reference a sub/section, he should provide an id himself. Note that in the old version of the plugin, before my fix for MPPDF-24, ids for sub/sections were generated using xslt's generate-id() function, which gave a unique id in all cases. However, they were completely useless because they were re-generated dynamically at each build time and the user couldn't know how to reference them. I conclude that if you want to ensure unique ids, you would have to auto-generate them according to some algorithm, but in that case they are useless because they can't be referenced. If you want id's that the user can reference easily, there is no way to ensure they are unique. I'd rather propose to remove the id generation from name tags altogether and keep the id tag as an option (that's how it should be in the xdoc plugin as well). Thus, we maintain backwards compatibility within the pdf plugin and avoid any build failures. The worst thing that can happen is that a link to a section does not work in the generated pdf if the user forgets to specify an id tag.
Hide
Permalink
Arnaud Heritier added a comment - 02/Oct/05 3:43 AM

Reopen to change "fix for"

Show
Arnaud Heritier added a comment - 02/Oct/05 3:43 AM Reopen to change "fix for"

People

  • Assignee:
    Lukas Theussl
    Reporter:
    Arnaud Heritier
Vote (0)
Watch (0)

Dates

  • Created:
    23/Jun/05 8:59 AM
    Updated:
    02/Oct/05 3:44 AM
    Resolved:
    02/Oct/05 3:44 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.