Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Issue 38 in gwtwiki: Parsing of template redirects
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gwtw...@googlecode.com  
View profile  
 More options Apr 27 2010, 11:06 pm
From: gwtw...@googlecode.com
Date: Wed, 28 Apr 2010 03:06:51 +0000
Local: Tues, Apr 27 2010 11:06 pm
Subject: [bliki] Issue 38 in gwtwiki: Parsing of template redirects
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 38 by dfisla: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Consider:

Template:Test1
------- contents -------
#REDIRECT[[Template:Test2]]

Template:Test
-------- contents ------
<p>Hello World!</p>

given any article that references {{Test1}} should output:
<p>Hello World!</p>

for specific wikipedia example you can refer to:
Template:InfosectionEnd, and
Template:InfoboxEnd

I got this to work by making the following changes to TemplateParser class:

private static final Pattern REDIRECT_PATTERN =
Pattern.compile(".*#REDIRECT[ ]*\\[\\[Template:(.*)\\]\\].*",
Pattern.CASE_INSENSITIVE | Pattern.DOTALL);

in method:

protected static void parseRecursive(String rawWikitext, IWikiModel
wikiModel, Appendable writer, boolean parseOnlySignature, boolean
renderTemplate, HashMap<String, String> templateParameterMap) throws
IOException {

...

// Experimental to handle #REDIRECT [[Template:Foo]]
Matcher m = REDIRECT_PATTERN.matcher(rawWikitext);
if (m.matches()) {
    String redirectTemplate = m.group(1);
    rawWikitext = m.replaceAll("{{" + redirectTemplate + "}}");

}

There has to be a better way to implement this, I don't really like mixing
in the regex matcher with the rest of the template parser based on the fact
the template parser operates on the character level.

Also, currently this works because the parser will replace the redirect
reference with the actual template markup and recurse on it - therefore the
redirect is followed and content is evaluated/parsed. The template parser
will also not stop and continue parsing the rest of the main template which
is opposite to how page redirects are handled where the page parser stops
processing the rest of the content after running into a redirect construct.

I also allow for whitespace between #REDIRECT keyword and the first outer
"[[" brackets as there are many Wikipedia articles that do this instead of
the proper #REDIRECT[[...]] syntax.

In any case, the above change works for now - this was a big deal for me
when parsing Wikipedia pages & templates.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://matheclipse.org/en/Eclipse_Wikipedia_Editor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Apr 27 2010, 11:10 pm
From: gwtw...@googlecode.com
Date: Wed, 28 Apr 2010 03:10:52 +0000
Local: Tues, Apr 27 2010 11:10 pm
Subject: [bliki] Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #1 on issue 38 by dfisla: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

The parsing of redirects, at least the way implemented above, requires that  
it is the
first recursive call - see attached file for details.

Attachments:
        TemplateParser.java  26.8 KB

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://matheclipse.org/en/Eclipse_Wikipedia_Editor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Apr 28 2010, 3:06 pm
From: gwtw...@googlecode.com
Date: Wed, 28 Apr 2010 19:06:14 +0000
Local: Wed, Apr 28 2010 3:06 pm
Subject: [bliki] Re: Issue 38 in gwtwiki: Parsing of template redirects
Updates:
        Status: Accepted
        Owner: axelclk

Comment #2 on issue 38 by axelclk: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

(No comment was entered for this change.)

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://matheclipse.org/en/Eclipse_Wikipedia_Editor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Apr 28 2010, 3:09 pm
From: gwtw...@googlecode.com
Date: Wed, 28 Apr 2010 19:09:39 +0000
Local: Wed, Apr 28 2010 3:09 pm
Subject: [bliki] Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #3 on issue 38 by axelclk: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Could you please try, if these changes solve the problem:
http://code.google.com/p/gwtwiki/source/detail?r=1107

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://matheclipse.org/en/Eclipse_Wikipedia_Editor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile   Translate to Translated (View Original)
 More options Apr 28 2010, 10:12 pm
From: gwtw...@googlecode.com
Date: Thu, 29 Apr 2010 02:12:31 +0000
Local: Wed, Apr 28 2010 10:12 pm
Subject: [bliki] Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #4 on issue 38 by dfisla: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Works for me! Thanks.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://matheclipse.org/en/Eclipse_Wikipedia_Editor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options May 13 2010, 11:36 am
From: gwtw...@googlecode.com
Date: Thu, 13 May 2010 15:36:29 +0000
Local: Thurs, May 13 2010 11:36 am
Subject: [bliki] Re: Issue 38 in gwtwiki: Parsing of template redirects
Updates:
        Status: Fixed

Comment #5 on issue 38 by axelclk: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

(No comment was entered for this change.)

--
You received this message because you are subscribed to the Google Groups "Bliki - Java/Eclipse Wikipedia API" group.
To post to this group, send email to bliki@googlegroups.com
To unsubscribe from this group, send email to bliki-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/bliki?hl=en
or visit the projects homepage at http://code.google.com/p/gwtwiki/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 2:46 am
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 06:46:54 +0000
Local: Tues, Jun 5 2012 2:46 am
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #6 on issue 38 by ido1...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Hi axelclk,
Im new on Bliki, and I have the same problem sfisla is talking about - with  
the redirections... I saw that you amde some changes to the bliki.core  
library.
can you please explain me how to update me files with your file in order to  
handle the redirection issue.
Im using maven (I didnt succed to activate my project without making it a  
maven project.)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 9:17 am
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 13:17:39 +0000
Local: Tues, Jun 5 2012 9:17 am
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #7 on issue 38 by dfi...@itmatter.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

This has been fixed some time ago - r1107 noted above. What version of  
bliki api are you using?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 12:44 pm
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 16:44:38 +0000
Local: Tues, Jun 5 2012 12:44 pm
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #8 on issue 38 by ido1...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Yes, I checked out the bliki code and saw that these changes have already  
been added to the library.
I followed this tutorial exactly:
http://www.integratingstuff.com/2012/04/06/hook-into-wikipedia-using-...
and still, when I search for "Machester United football club" I don't get  
anything, but when I use the dibugger I notice I have  
a "#REDIRECT[[Machester United F.C.]]", means that it doesn't do the  
recursive call for redirections.
Can you explain what I have to do in order to pass over all those  
redirection and just get the value of what I search for? (please refer to  
the tutorial in your answer as I am not an expert in bliki...)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 1:18 pm
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 17:18:44 +0000
Local: Tues, Jun 5 2012 1:18 pm
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #9 on issue 38 by axel...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

You have a typo in your article text:
"Machester United football club"

versus

"Manchester United football club"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 1:46 pm
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 17:46:38 +0000
Local: Tues, Jun 5 2012 1:46 pm
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #10 on issue 38 by ido1...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Its just a typo in the comment...
When I search for "Machester United Football Club" and use the debugger,
I notice that after doing the next line:
List<Page> listOfPages = user.queryContent(listOfTitleStrings);
I get the next value for listOfPages:
[PageID: 2983919; NS: 0; Title: Manchester United Football Club;
Image url:
Content:
#REDIRECT [[Manchester United F.C.]]]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 5 2012, 2:58 pm
From: gwtw...@googlecode.com
Date: Tue, 05 Jun 2012 18:58:53 +0000
Local: Tues, Jun 5 2012 2:58 pm
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #11 on issue 38 by axel...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

OK.
There's a IWikModel#getRedirectLink() method which returns the parsed  
redircet link after parsing the first wiki text.
With this redirect title string you can again use the Wikipedia API.

See the modified HTMLCreatorExample I've commited in r5527.

The Example creates two files.

The first file
   C:\temp\Manchester_United_Football_Club.html
contains no visible HTML.

The second file
    C:\temp\Manchester_United_F.C..html
contains the rendered redirect title.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gwtw...@googlecode.com  
View profile  
 More options Jun 6 2012, 8:22 am
From: gwtw...@googlecode.com
Date: Wed, 06 Jun 2012 12:22:09 +0000
Local: Wed, Jun 6 2012 8:22 am
Subject: Re: Issue 38 in gwtwiki: Parsing of template redirects

Comment #12 on issue 38 by ido1...@gmail.com: Parsing of template redirects
http://code.google.com/p/gwtwiki/issues/detail?id=38

Thank You very much!
Now I can handle redirections so thank's:)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »