[Mediawiki-l] Parsing raw text

Jack Eapen C jackec at suntecgroup.com
Fri Jan 4 04:03:12 UTC 2008



By this time I hv figured out something
Justing playing around with mediawiki and mysql fulltext search- I hv
the following function:

$wgHooks['ArticleSaveComplete'][] = 'getNormalTextfromWikiText';

function getNormalTextfromWikiText(&$article,&$user,&$text)
{
   global $wgParser;
   $result = $wgParser->parse($text, $wgParser->mTitle,
$wgParser->mOptions);
   $new_text= $result->getText();

	$dbw =& wfGetDB( DB_MASTER );
			$dbw->insert( 'searchable_text',
				array(
				'page_id' => $article->getID(),
				'searchable_text'    => $new_text
				) );
	 return true;
}

What I want is to insert normal text to a table and perform a mysql
fulltext search on that table. i.e. if some user enters
[http://en.wikipedia.org/ Link to Wikipedia] in article edit box, I want
to insert "Link to Wikipedia" into my table. The "parse" in my above
function is returning "<p><a href="http://en.wikipedia.org/"
class="external text" target="_blank" title="http://en.wikipedia.org/"
rel="nofollow">Link to Wikipedia</a>
</p>". I don't want that. Simply needs "Link to Wikipedia". How can I
get that? 


Regards,
 
Jack
----------------------------------------------------------------
"May He protect us both. May He cause us both to enjoy.May we exert
together. May our studies become brilliant. May we not hate each other"


-----Original Message-----
From: mediawiki-l-bounces at lists.wikimedia.org
[mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of Thomas
Dalton
Sent: Thursday, January 03, 2008 7:55 PM
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] Parsing raw text

On 03/01/2008, Jack Eapen C <jackec at suntecgroup.com> wrote:
>
>
> Suppose I want to parse the text from the edit form and make it like 
> html output and insert into a table. i.e. what I want to insert into 
> the table is NOT wiki text. I can insert the wiki text with a function

> with "ArticleSaveCOmplete" hook. But in my function first I want to 
> process the $text into something like the rendered output and then 
> insert into a table.
>
> Can anyone plz tell me which function I can call for this?

I'm not quite sure what you're trying to do. Could you explain in more
detail what you are actually trying to achieve?

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l


This electronic mail (including any attachment thereto) may be confidential and privileged and is intended only for the individual or entity named above. Any unauthorized use, printing, copying, disclosure or dissemination of this communication may be subject to legal restriction or sanction. Accordingly, if you are not the intended recipient, please notify the sender by replying to this email immediately and delete this email (and any attachment thereto) from your computer system...Thank You



More information about the MediaWiki-l mailing list