rehamaltamimi / gwtwiki

Automatically exported from code.google.com/p/gwtwiki
0 stars 0 forks source link

Virtual wiki breakage with JAMWiki 1.1 #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Links of the form [[virtual:Topic]] seem to no longer work starting with 
JAMWiki 1.1 and the Bliki parser.

What version of the product are you using? On what operating system?

Bliki parser with JAMWiki 1.1+ (Bliki 3.0.16).

Please provide any additional information below.

See http://jira.jamwiki.org/browse/JAMWIKI-68.  JAMWiki 1.1 changed virtual 
wiki link handling so that links of the form [[virtual:Topic]] are appended to 
the parserOutput (parserOutput.addVirtualWiki) and rendered in the left nav, 
but Bliki now fails to render virtual wikis entirely.

I looked at this issue and didn't see an obvious solution.  If there is a fix I 
can make please let me know, but it looks like Bliki is seeing virtual wikis as 
either namespaces or interwiki links.

Original issue reported on code.google.com by ryan.hol...@gmail.com on 24 Jan 2012 at 4:28

GoogleCodeExporter commented 8 years ago
Hi Ryan

The URL is build in the methods
org.jamwiki.parser.bliki.JAMWikiModel#appendInternalLink() and
org.jamwiki.parser.bliki.JAMWikiModel#buildTopicUrlNoEdit()
did you checked already if the building of the virtual wiki link could be 
maintained there?

private static String buildTopicUrlNoEdit(String context, String virtualWiki, 
String topicName, String section, String queryString) {
        // TODO same as LinkUtil#buildTopicUrlNoEdit()
        if (StringUtils.isBlank(topicName) && !StringUtils.isBlank(section)) {
            return "#" + Utilities.encodeAndEscapeTopicName(section);
        }
        StringBuilder url = new StringBuilder();
        if (context != null) {
            url.append(context);
        }
        // context never ends with a "/" per servlet specification
        url.append('/');
        // get the virtual wiki, which should have been set by the parent servlet
        url.append(Utilities.encodeAndEscapeTopicName(virtualWiki));
        url.append('/');
        url.append(Utilities.encodeAndEscapeTopicName(topicName));
        if (!StringUtils.isBlank(queryString)) {
            if (queryString.charAt(0) != '?') {
                url.append('?');
            }
            url.append(queryString);
        }
        if (!StringUtils.isBlank(section)) {
            if (section.charAt(0) != '#') {
                url.append('#');
            }
            url.append(Utilities.encodeAndEscapeTopicName(section));
        }
        return url.toString();
}

Original comment by axelclk@gmail.com on 25 Jan 2012 at 5:36

GoogleCodeExporter commented 8 years ago
Sorry for the delayed response.  I'll take a look at the JAMWikiModel code 
again, but as I'm not familiar with the Bliki parser I was not entirely sure 
where in the interface file to begin.  Based on the behavior I'm seeing it 
looks like (for example) appendInterWikiLink() is interpreting a link like 
[[ca:Topic]] as an interwiki link when it is actually a virtual wiki.  If you 
have any insight or can provide a pointer as to where to look in the Bliki 
source to determine the parsing flow I'd be grateful, otherwise I'll try to 
figure this out when I again have some time.

Original comment by ryan.hol...@gmail.com on 27 Jan 2012 at 5:16

GoogleCodeExporter commented 8 years ago
I think because JAMWiki is doing some special handling with virtual wikis it's 
best to analyze the raw wiki link [[...]].
Therefore you could override the AbstractModel#appendRawWikipediaLink(String 
rawLinkText, String suffix) method.
See:
 http://code.google.com/p/gwtwiki/source/browse/trunk/info.bliki.wiki/bliki-core/src/main/java/info/bliki/wiki/model/AbstractWikiModel.java and
 http://code.google.com/p/gwtwiki/source/browse/trunk/info.bliki.wiki/bliki-core/src/main/java/info/bliki/wiki/model/IWikiModel.java

Original comment by axelclk@gmail.com on 27 Jan 2012 at 3:37

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 27 Jan 2012 at 3:39

GoogleCodeExporter commented 8 years ago
Thanks for the pointers.  After looking at the 
AbstractModel#appendRawWikipediaLink code I was able to solve the problem by 
overriding AbstractModel#appendRawNamespaceLinks.  Virtual wikis again seem to 
parse more-or-less correctly with JAMWiki (fix to be included in JAMWiki 1.1.5) 
so this issue can be closed.

Original comment by ryan.hol...@gmail.com on 29 Jan 2012 at 8:15

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 6 Mar 2012 at 5:29