https://bugzilla.wikimedia.org/show_bug.cgi?id=66233

Deepak Sharma <deepak.sh...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deepak.sh...@gmail.com

--- Comment #1 from Deepak Sharma <deepak.sh...@gmail.com> ---
(In reply to James Forrester from comment #0)
> Multiple easy mistakes cause horrible, ugly red text:
> 
> * <ref name="foo" /> but not <ref>
> * <ref />, unnamed
> * <ref> but no <references />
> * <references /> but no <ref>
> 
> This is what PageContentSave exists for. Let's use it…

Hi James,

I would like to try and fix this bug if no one else is already working on it.

Since, I am just a beginner, so please correct me if I am wrong somewhere.
Instead of using PageSaveContent hook, I think it would be better off to use
EditFilter Hook which we can use to halt editing and print out the error
message on top of Edit Page (which I think is exactly that you want).

So, I gave it a quick try (just to find out if it'll work):

/***********/
// declared a flag variable to find if error has occurred
var $err=false;

// and put $this->err = true; whenever error occured
// and we can also make an errors array to store all the errors that are
// encountered on the way.
...

// declared callback for the EditFilter hook in setHooks function in
// Cite_body.php

...
if ( !Cite::$hooksInstalled ) {
...
$wgHooks['EditFilter'][] =  array( $parser->extCite, 'validate');
...

function validate($editPage, $text, $section, &$hookError, $summary ){
  if ( $this->err ) {
    $hookError = "There's some problem with your refs";
  }
  error_log('function validate called');
  return true;
}

/***********/


But, the problem I am encountering is that validate function is never being
called, it is as if callback function for EditFilter hook was never set.

Can you please let me know, where am I going wrong?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to