Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 241822 - XML projectplan renderer should generate a table of contents, and <a name> tags for headings
Summary: XML projectplan renderer should generate a table of contents, and <a name> ta...
Status: RESOLVED FIXED
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: Process (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: David Carver CLA
QA Contact:
URL: http://www.eclipse.org/projects/proje...
Whiteboard:
Keywords:
Depends on: 243303
Blocks: 249939
  Show dependency tree
 
Reported: 2008-07-23 11:09 EDT by Martin Oberhuber CLA
Modified: 2008-10-07 07:43 EDT (History)
1 user (show)

See Also:


Attachments
Add Table of Contents (5.08 KB, patch)
2008-09-05 16:21 EDT, David Carver CLA
no flags Details | Diff
Fixes issue with Themes hyperlink, as well as preamble not rendering (1.52 KB, patch)
2008-09-12 09:13 EDT, David Carver CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2008-07-23 11:09:59 EDT
When the XML project plan is rendered to HTML, e.g.

   http://www.eclipse.org/projects/project-plan.php?projectid=dsdp.tm

It should render a table of contents for the various headings and subheadings, along with <a name=> tags for the headings. This would allow to send hyperlinks which directly jump to a subheading by E-Mail if a particular item is to be referenced. Also, it would simplify navigating through the plan.
Comment 1 Bjorn Freeman-Benson CLA 2008-09-04 11:31:43 EDT
Dave, this seems like something the XSLT could do.
Comment 2 David Carver CLA 2008-09-04 13:26:56 EDT
Yeah, I can take a look at it, maybe we need to revive the Plan2.php for testing purposes again.   I'm in the middle of some other XSLT work right now, so might get to a POC tomorrow.
Comment 3 David Carver CLA 2008-09-05 16:21:09 EDT
Created attachment 111866 [details]
Add Table of Contents

Adds a table of contents and links back to the table of contents.
Comment 4 David Carver CLA 2008-09-05 16:24:03 EDT
bjorn, the patch attached to the message adds a div tag with an id attribute, so you can set the css as appropriate for styling the table of contents.  It's pretty basic, but let me know if we need to do anything more complicated with it.

Comment 5 Martin Oberhuber CLA 2008-09-05 16:26:12 EDT
Would it be possible to get each theme listed in the TOC as well, preferrably on another level? i.e.

<li><a href="#themes_and_priorities">Themes and Priorities
<ul><li><a href="#tp_1">Theme 1</a></li>
    <li><a href="#tp_2">Theme 2</a></li>
</ul></li>

Comment 6 Bjorn Freeman-Benson CLA 2008-09-05 16:40:33 EDT
Patch applied, thanks Dave. Closing as FIXED.
Martin, if you'd like to provide a patch that does more, I'm happy to review and apply that one too.
Comment 7 David Carver CLA 2008-09-05 17:11:57 EDT
(In reply to comment #5)
> Would it be possible to get each theme listed in the TOC as well, preferrably
> on another level? i.e.
> 
> <li><a href="#themes_and_priorities">Themes and Priorities
> <ul><li><a href="#tp_1">Theme 1</a></li>
>     <li><a href="#tp_2">Theme 2</a></li>
> </ul></li>
> 

It's possible...several ways to do it, there is a generate-id() function, or we add a required id attribute to the themes that need to be filled in.  Using just the name attribute on the Theme won't work as it won't be a unique id.

XSLT Faq shows some examples using generate-id

http://www.dpawson.co.uk/xsl/sect2/N4416.html

Comment 8 Martin Oberhuber CLA 2008-09-12 04:43:38 EDT
On the TM project plan at least, the "Themes and Priorities" index in the TOC links into the "#compatibility" section...

http://www.eclipse.org/projects/project-plan.php?projectid=dsdp.tm
Comment 9 Martin Oberhuber CLA 2008-09-12 04:46:13 EDT
Actually, it turns out that for dsdp.tm, the "preamble" of Themes and Priorities is completely removed when rendering... that's why the anchor is missing...
Comment 10 David Carver CLA 2008-09-12 09:00:45 EDT
I can reproduce this locally, so I'll see about getting a patch done this morning.
Comment 11 David Carver CLA 2008-09-12 09:13:27 EDT
Created attachment 112412 [details]
Fixes issue with Themes hyperlink, as well as preamble not rendering

Includes all previous patches, plus fixes hyperlink for themes and priorities as well as rendering the preamble for themes and priorities.
Comment 12 Bjorn Freeman-Benson CLA 2008-09-16 14:07:52 EDT
Patch applied, closing as FIXED.
Comment 13 Martin Oberhuber CLA 2008-09-16 14:23:55 EDT
Sorry, but the "a href" for the "themes and priorities" TOC entry is 1 off, so it cannot be navigated:

http://www.eclipse.org/projects/project-plan.php?projectid=dsdp.tm

The TOC has  <a href="#themes_and_prioritie">      <-- NOTE THE MISSING s -->
The impl has <a name="themes_and_priorities">

With respect to allowing TOC entries for individual themes: in order to avoid the "synthetically generating unique names" problem, what if the XML markup were extended to allow an optional additional user-specified attribute of each <theme> node to get used in the TOC? E.g.

   <p:theme name="Improve Usability" href="th1" toc="1">

Only those themes with href attribute would get an <a name> tag. Only those with toc="1" would also get listed in the TOC. Would that make sense?
Comment 14 Bjorn Freeman-Benson CLA 2008-09-16 14:29:06 EDT
(in reply to comment #13) 
I fixed the missing "s" problem, but leave the rest of your question to the greater expertise of Dave.
Comment 15 David Carver CLA 2008-09-16 17:07:23 EDT
(In reply to comment #13)

> With respect to allowing TOC entries for individual themes: in order to avoid
> the "synthetically generating unique names" problem, what if the XML markup
> were extended to allow an optional additional user-specified attribute of each
> <theme> node to get used in the TOC? E.g.
> 
>    <p:theme name="Improve Usability" href="th1" toc="1">
> 
> Only those themes with href attribute would get an <a name> tag. Only those
> with toc="1" would also get listed in the TOC. Would that make sense?

Technically, you don't have to do that as XSLT has a generate-id() function that we could use.   

http://www.w3schools.com/XSL/func_generateid.asp

So, if somebody wants to take a crack at learning some XSLT and adding this, the XSL Tools has the available editors, and a good tutorial on working with XSLT can be found here:

http://www.cafeconleche.org/books/bible2/chapters/ch17.html

and 

http://www.xfront.com/files/tutorials.html

Gotta teach somebody else this XSLT stuff otherwise I'll end up maintaining this all by myself. :)

 

Comment 16 Martin Oberhuber CLA 2008-10-07 07:43:22 EDT
Marking this fixed sine Dave's work is done for now. I filed bug 249939 to track the additional enhancement of a TOC entry for each theme.