Re: [Htmlvalidator-help] A bugfix and few new functions in 0.8 version
Brought to you by:
mgueury
From: Marc G. <mg...@sk...> - 2006-06-25 15:55:03
|
Hi Tibor, I imported most but not all of the changes, see below. But I have just one question. What is the file setup.properties and how does it work ? Do I just need to copy it file in the locale/tidy directory ? For the other changes, 1) css files are copied 2) sp* files are copied too 3) the algorithm file is copied 4) the change about the menu with the parser is not copied I think that this option is too complex. I prefer for now the "choose algorithm" dialog box shown at the first start. (I still need to write it) It is more in line with the extension. - Few options and menu items. - And a lot of help that will let people learn about HTML. My current concern is that I got mail from some computer scientists that did not found or understood the choice of algorithm. I understand this since SGML is not one of the most known computer science topic. So, for now the education of the users, and the "Choose algorithm" dialog is, for me, the best method :) I copied the .js part of the code (it can be usefull one day) But not the tidy.dtd part and the browserStatusBar.xul part. 5) Copied the change in tidyValidate.js - about the currentHelpPage For the translation, take care that the extension will change a little before production. But thanks a lot for doing it ! Marc Tibor Balogh wrote: > Dear Marc! > > I modified the extension in some points. > > - A bugfix: When pressed the Ctr+H twice, the Help box was empty. > - Add a parser changer menu item to the statusbars' menu. (but it > somtimes doesn't work exactly and I don't understand why. Exp: Open > the 'http://users.skynet.be/mgueury/mozilla/', the Tidy parser gives 5 > warnings. Change the parse method to SGML with statusbar menu and > change it again to Tidy method. Now the Tidy will write out 1 warning.) > - A shower function to the algorithm.html page. The page will been > show if you click on the help label of Help box! > - Hungarian translation. > > > Regards, > Tibor Balogh > > PS: Pleas, do not cc this mail to htmlvalidator list, then my English > is very poor. Thanks! > > > en-US tidy.dtd: > --------------- > <!ENTITY tidy.browser.menu.enable "Enable"> > <!ENTITY tidy.browser.menu.parser.tidy "Parser: Tidy"> > <!-- <!ENTITY tidy.browser.menu.parser.sp "Parser: SGML"> --> > > <!ENTITY tidy.browser.menu.html_clipboard "Copy HTML to Clipboard"> > > > en-US tidy.properties: > ---------------------- > tidy_disable=Disable > tidy_parser_tidy=Parser: Tidy > tidy_parser_sp=Parser: SGML > > # There are 3 variations of "error" with or without s, because > grammatical plural > # rules depends of the language. Ex: > # > English : 2 errors, 1 error, 0 errors (0 takes 's') > # > French : 2 erreurs, 1 erreur, 0 erreur (0 takes no 's') > tidy_info=info > tidy_error=error > tidy_errors=errors > tidy_0_errors=errors > > > browserStatusBar.xul: > --------------------- > <menuitem label="&tidy.browser.menu.disable;" > id="tidy.browser.menu.disable" > oncommand="oTidyBrowser.onDisable()"/> > <menuitem label="&tidy.browser.menu.parser.tidy;" > id="tidy.browser.menu.parser" > oncommand="oTidyBrowser.changeParser()"/> > <menuseparator/> > > > tidyBrowser.js: > --------------- > this.xulMenuDisable = > document.getElementById('tidy.browser.menu.disable'); > this.xulMenuParser = document.getElementById('tidy.browser.menu.parser'); > this.xulMenuHtmlClipboard = > document.getElementById('tidy.browser.menu.html_clipboard'); > > ... > > this.xulMenuDisable.setAttribute("label", oTidyUtil.getString( > (browser_enable?"tidy_disable":"tidy_enable") )); > this.xulMenuParser.setAttribute("label", oTidyUtil.getString( > "tidy_parser_"+oTidyUtil.getCharPref("algorithm") )); > > // Maybe to uncomment in a next version > > ... > > /** __ onDisable ______________________________________________________ > */ > onDisable : function() > { > oTidyUtil.setBoolPref( "browser_enable", !oTidyUtil.getBoolPref( > "browser_enable" ) ); > this.initIcon(); > }, > > /** __ changeParser ______________________________________________________ > */ > changeParser : function() > { > var isTidyParser = oTidyUtil.getCharPref("algorithm") == "tidy"; > oTidyUtil.setCharPref("algorithm", isTidyParser? "sp":"tidy"); > > this.emptyTidyResult( window.content ); > this.validateFrame( window.content ); > this.updateStatusBar(); > }, > > /** __ emptyTidyResult > ______________________________________________________ > * It sets tidyResult properties to null > * parameter requires window.content > */ > emptyTidyResult : function( main_page ) > { > main_page.document.tidyResult = null; > > var frm = main_page.frames; > for (var i=0; i<frm.length; ++i) > { > this.emptyTidyResult( frm[i] ); > } > } > > > viewSourceAndValidate.xul: > -------------------------- > <vbox valign="middle" flex="1"> > <label control="tidy-explain-error-label" > value="&tidy-explain-error-label;" > onclick="changeHelpPage()" style="cursor:pointer;"/> > </vbox> > > > tidyValidate.js: > ---------------- > function tidyHideValidator() > { > var box = document.getElementById("tidy-validate-box"); > oTidyValidate.hideValidator( !box.hidden ); > > } > > ... > > tidyResult: null, > currentHelpPage: "", > > // Style > > ... > > loadHelp : function(src) > { > var url = [ > "chrome://tidy/content/help/"+oTidyUtil.defaultLanguage+"/"+src, > "chrome://tidy/content/help/en-US/"+src, > > "chrome://tidy/content/help/"+oTidyUtil.defaultLanguage+"/no_help.html", > "chrome://tidy/content/help/en-US/no_help.html" > ]; > > for (var i=0; i<url.length; ++i) > { > if (helpExists(url[i])) > { > this.currentHelpPage = src; > this.xulExplainError.loadURI( url[i] ); > break; > } > } > > function helpExists(fileName){ > try { > var req = new XMLHttpRequest(); > req.open('GET', fileName, false); > req.send(null); > } > catch(ex){ > return false; > } > return true; > } > }, > > ... > > hideValidator : function( bHide ) > { > var box = document.getElementById("tidy-validate-box"); > var splitter = document.getElementById("tidy-splitter"); > box.hidden = splitter.hidden = bHide; > > this.xulMenuHide.setAttribute("checked", !bHide); > > // The validation has already been done ? > if( !bHide && !this.bIsValidated ) > { > oTidyValidate.validateHtmlFromNode(); > } > else > { > oTidyValidate.loadHelp( oTidyValidate.currentHelpPage ); > } > }, > > ... > > > function changeHelpPage() > { > if (!changeHelpPage.prev || ( > changeHelpPage.prev != 'algorithm.html' && > oTidyValidate.currentHelpPage != 'algorithm.html')) > { > changeHelpPage.prev = 'algorithm.html'; > } > var prevPage = oTidyValidate.currentHelpPage; > oTidyValidate.loadHelp( changeHelpPage.prev ); > changeHelpPage.prev = prevPage; > } > |