Last modified: 2014-07-30 04:52:38 UTC
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…
(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?