Bug 467067 - mediawiki-to-eclipse-help does not properly extract local anchors that are specified via absolute links.
Summary: mediawiki-to-eclipse-help does not properly extract local anchors that are sp...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.6   Edit
Assignee: Jeremie Bresson CLA
QA Contact: David Green CLA
URL:
Whiteboard:
Keywords:
: 444459 (view as bug list)
Depends on:
Blocks: 467060
  Show dependency tree
 
Reported: 2015-05-12 03:20 EDT by Alexander Nyßen CLA
Modified: 2015-07-24 11:46 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2015-05-12 03:20:36 EDT
When extracting eclipse help from mediawiki, anchors that are specified by means of absolute paths are not properly extracted.

E.g., when generating eclipse help from http://wiki.eclipse.org/GEF/GEF4/Common, a local anchor specified by 'GEF/GEF4/Common#IActivatable' is generated as follows:

<a href="IActivatable" title="GEF/GEF4/Common#IActivatable">IActivatable</a>

It can thus not be navigated within the generated help. If I specify the local anchor by '#IActivatable', the link is properly generated.
Comment 1 David Green CLA 2015-05-12 16:58:07 EDT
Thanks for the bug Alexander.  Can you attach or comment with details of how you generated the Eclipse help content?  (e.g. the relevant Ant script)
Comment 2 Alexander Nyßen CLA 2015-05-13 01:42:41 EDT
(In reply to David Green from comment #1)
> Thanks for the bug Alexander.  Can you attach or comment with details of how
> you generated the Eclipse help content?  (e.g. the relevant Ant script)

I use the following script to generate:

http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.releng/scripts/generateWikitext.xml

It is executed from within our pom.xml:

http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.releng/pom.xml
Comment 3 Alexander Nyßen CLA 2015-05-13 01:44:19 EDT
(In reply to Alexander Nyßen from comment #2)
> (In reply to David Green from comment #1)
> > Thanks for the bug Alexander.  Can you attach or comment with details of how
> > you generated the Eclipse help content?  (e.g. the relevant Ant script)
> 
> I use the following script to generate:
> 
> http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.
> releng/scripts/generateWikitext.xml
> 
> It is executed from within our pom.xml:
> 
> http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.
> releng/pom.xml

The wiki.path and wiki.title variables used in the script are defined in a wikitextOptions.txt file in each of our doc bundles, e.g: 

http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.common.doc/wikitextOptions.txt
Comment 4 David Green CLA 2015-05-22 00:56:57 EDT
Alexander, is this a problem for the gef4 release?  It looks like the references have been updated in the wiki to avoid the problematic syntax.
Comment 5 Alexander Nyßen CLA 2015-05-22 01:40:47 EDT
(In reply to David Green from comment #4)
> Alexander, is this a problem for the gef4 release?  It looks like the
> references have been updated in the wiki to avoid the problematic syntax.

We have indeed done this as a workaround, so this is no blocker to us.
Comment 6 David Green CLA 2015-06-01 10:12:49 EDT
Ok great, I'm glad there's a workaround for you.
Comment 7 Jeremie Bresson CLA 2015-07-03 15:30:00 EDT
I think I have found the error:

In WikiToDocTask.PathPageMapping.mapPageNameToHref(String) on line 828 [1] when there is a link pointing to the page that is currently processed, the result should always start with a #. If hashId is not null, this is not the case.

Current line:
> return hashId == null ? "#" : hashId;

It should be:
> return "#" + (hashId == null ? "" : hashId); //$NON-NLS-1$ //$NON-NLS-2$

I propose this patch :
https://git.eclipse.org/r/51357

I also wanted to be able to unit test this change. In WikiToDocTask, I have moved the code calling the server into a protected method "createInputReader(URL)". I have also changed some method from "private" to "protected". In the WikiToDocTaskTest, I test with a subclass of WikiToDocTask where the calls to the server are overridden.

Please let me know what you think.

[1] http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.docs.git/tree/org.eclipse.mylyn.wikitext.mediawiki.core/src/org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/WikiToDocTask.java?id=2aed50a755fe7fa63c37a3d977d5bfecefa54786#n828
Comment 9 David Green CLA 2015-07-24 10:28:56 EDT
*** Bug 444459 has been marked as a duplicate of this bug. ***
Comment 10 David Green CLA 2015-07-24 11:46:31 EDT
Thanks for the contribution Jeremie.