Opened 10 years ago

Closed 9 years ago

#366 closed defect (wontfix)

multidoc generates duplicate id attributes for HTML output

Reported by: Moritz Heidkamp Owned by: Ivan Raikov
Priority: minor Milestone:
Component: unknown Version: 4.6.x
Keywords: Cc:
Estimated difficulty:

Description

Titles beginning with e.g. numbers will result in illegal HTML id attributes. The attached patch fixes this by allowing only letters at the beginning of generated ids. Note that there is also potential for multidoc to generate the same id multiple times inside the same document.

Attachments (2)

remove-invalid-chars-from-beginning-of-id.patch (477 bytes) - added by Moritz Heidkamp 10 years ago.
unique-ids.patch (7.6 KB) - added by Moritz Heidkamp 10 years ago.

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by Moritz Heidkamp

comment:1 Changed 10 years ago by sjamaan

Owner: changed from sjamaan to Ivan Raikov
Status: newassigned
Summary: multidoc generates invalid id attributes for HTML outputmultidoc generates duplicate id attributes for HTML output

I've applied your patch, thanks! The multiple IDs with the same name is a known problem, but a little hard to fix right now, I'm afraid. (at least not without nasty hackery)

Maybe Ivan has an idea?

I've renamed the title of this ticket to reflect the fact that still needs fixing.

Changed 10 years ago by Moritz Heidkamp

Attachment: unique-ids.patch added

comment:2 Changed 10 years ago by Moritz Heidkamp

The unique-ids.patch takes a stab at fixing this issue. I used the secret *preorder/ss* binding modifier, not sure whether that is a Good Idea. I also changed it in such a way that html-transformation-rules doesn't require the contents to be passed to it anymore to build the table of contents. However, I kept the single argument signature for now so as not to break existing code. If you choose to apply the patch, feel free to change that, of course :-)

comment:3 Changed 10 years ago by sjamaan

Ivan: I'll let you decide whether this is an acceptable way to deal with this.

comment:4 in reply to:  3 Changed 10 years ago by Ivan Raikov

Yes, I will look at it, also need to check if the latex and texinfo backends are consistent with how they handle this. Do you want to add a test case to unit tests for this?

Replying to sjamaan:

Ivan: I'll let you decide whether this is an acceptable way to deal with this.

comment:5 Changed 10 years ago by sjamaan

I've modified "simple.sxml" to include two subsections with the title "Subsection", which triggers the bug.

I've also added test programs which loop through all the sxml files and produce html, latex and texinfo output files to make testing a little easier. Turns out that the LaTeX and Texinfo rulesets crash on tables in the "bb" testcase.

I noticed that the sxml files were incomplete in the sense that they could not be converted to full standalone html files or LaTeX or Texinfo files. That's because the qwiki conversion rules are missing. I decided to make the tests independent of qwiki stuff; they should be testing multidoc, not qwiki! Multidoc should be capable of functioning without loading qwiki. Ideally, the tests should work without requiring a rule for translating the wiki-page tag into LaTeX/Texinfo document headers or html+body tags. Perhaps some functionality should be moved around between multidoc and qwiki so we have a fully standalone multidoc for generic "documents", which qwiki is only one program which produces those from wiki-specific documents.

Sorry for the long story, but I felt it was important :)

comment:6 Changed 10 years ago by Moritz Heidkamp

Any news on the unique-ids.patch? Sorry, just bumping the ticket so it doesn't get lost :-)

comment:7 in reply to:  6 Changed 10 years ago by Ivan Raikov

I have looked at the patch, but I think preorder/ss is a bit of a hack. But passing the content to the stylesheet constructor is also a hack, so I want to rewrite the transformations to use foldts, which can carry unique id information in the accumulator argument. I will have a little bit of time to work on it this week, and I will let you know if it will be possible to go the foldts route.

Replying to syn:

Any news on the unique-ids.patch? Sorry, just bumping the ticket so it doesn't get lost :-)

comment:8 Changed 9 years ago by felix winkelmann

Milestone: 4.7.0

comment:9 Changed 9 years ago by Ivan Raikov

Resolution: wontfix
Status: assignedclosed

Properly fixing and developing multidoc requires developers who do not break software at whim. I will merge the html-part of multidoc with the stringozzi that is qwiki, and will develop a new implementation from scratch, possibly based on pandoc.

Note: See TracTickets for help on using tickets.