incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Jaquith <>
Subject Re: Parsing fun
Date Tue, 13 Oct 2009 11:18:49 GMT
A few more clarifying questions:

- Are page names normalized when stored? I.e., when persisted we
always use the MashedTogetherName?
- When WikiPaths are resolved, do we resolve such that the WikiPath
returned always uses the MashedTogetherName?

Lastly, how do you reconcile these three tests:

(1) JSPWikiMarkupParser.testHyperlinks3():

        String src = "This should be a [hyperlink too]";
        assertEquals( "This should be a <a class=\"wikipage\"
href=\"/Wiki.jsp?page=HyperlinkToo\">hyperlink too</a>",
                      translate(src) );

(2) JSPWikiMarkupParser.testSpacesInLinks1()

        newPage("Foo bar");
        String src = "[Foo bar]";
        assertEquals( "<a class=\"wikipage\"
href=\"/Wiki.jsp?page=Foo%20bar\">Foo bar</a>", translate(src) );

(3) MarkupParserTest.testCleanLinkWithSpaces()

        assertEquals( "HyperlinkToo",
MarkupParser.cleanLink("hyperlink  too") );


On Tue, Oct 13, 2009 at 2:25 AM, Janne Jalkanen
<> wrote:
> Yes, we've allowed spaces in wiki page names since 2.6.
> However, we do also check - for backwards compatibility - also for the
> mashedtogethername if the wiki page with spaces does not exist. So
> [Test page] => first check for the existence of "Test page" => if not exist,
> then try to find "TestPage".
> There's a fairly hairy problem which is that we kind of assume that the
> comparison can be done in a case insensitive manner.  So on some operating
> systems (like Linux) [test page] might actually not match "Test page", but
> it would match "TestPage" (because mashing also normalizes the page name).
>  For 3.0 this is not going to be a problem, since all pages - also the ones
> with spaces - are normalized (or should be normalized; if they're not, then
> there's a bug.)
> This is why you probably have not noticed this, since the hop to page names
> with spaces was fairly transparent.
> /Janne
> On Oct 13, 2009, at 04:45 , Andrew Jaquith wrote:
>> Ok -- I think I am actually CONFUSED. The unit tests for MarkupParser
>> show a test where the output of a cleaned-link is expected to have
>> spaces.
>> So, which is it? Do we allow spaces in wiki page names? If so, that
>> would suggest the failing JSPWikiMarkupParser test is wrong.
>> Also, if spaces are allowed, how do you resolve page names? Are pages
>> "Test Page" and "TestPage" the same page?
>> Maybe I need to RTFM... just not sure where the M is...
>> Andrew
>> On Mon, Oct 12, 2009 at 7:26 PM, Andrew Jaquith
>> <> wrote:
>>> This is fairly amusing...
>>> It turns out that one of the failing JSPWikiMarkupParser unit tests,
>>> testHyperlinks3, is failing because MarkupParser.cleanLink() isn't
>>> cleaning.
>>> The link markup "hyperlink too" should result in "HyperlinkToo", no? It
>>> results instead in "Hyperlink too".
>>> What's even more amusing is that MarkupParserTest doesn't even test for
>>> this
>>> type of (common?) whitespace condition. Clearly we need to test for this
>>> --
>>> and I'll fix the bug too while I'm at it. :)
>>> Andrew

View raw message