Revision: 10117 http://sourceforge.net/p/languagetool/code/10117 Author: gulp21-1 Date: 2013-05-18 10:22:41 +0000 (Sat, 18 May 2013) Log Message: ----------- [extension] ignore lines starting with ">" (quotes)
Modified Paths: -------------- trunk/extension/common/tests/index.html trunk/extension/firefox/TODO trunk/extension/firefox/lib/main.js trunk/extension/firefox/locale/en-US.properties trunk/extension/firefox/package.json Added Paths: ----------- trunk/extension/common/tests/quotesTest.html Modified: trunk/extension/common/tests/index.html =================================================================== --- trunk/extension/common/tests/index.html 2013-05-18 09:53:06 UTC (rev 10116) +++ trunk/extension/common/tests/index.html 2013-05-18 10:22:41 UTC (rev 10117) @@ -17,6 +17,7 @@ <span class="fail"><a href="headlineTest.html">headlineTest.html</a></span><br/> <span class="fail"><a href="iframeTest.html">iframeTest.html</a></span><br/> <span class="pass"><a href="newlineTest.html">newlineTest.html</a></span><br/> +<span class="pass"><a href="quotesTest.html">quotesTest.html</a></span><br/> <span class="fail"><a href="scriptContentsTest.html">scriptContentsTest.html</a></span><br/> <span class="pass"><a href="textFieldTest.html">textFieldTest.html</a></span><br/> </body> Added: trunk/extension/common/tests/quotesTest.html =================================================================== --- trunk/extension/common/tests/quotesTest.html (rev 0) +++ trunk/extension/common/tests/quotesTest.html 2013-05-18 10:22:41 UTC (rev 10117) @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>quotesTest</title> +</head> +<body> + +> You are an friendly person.<br/> +I are friendly.<br/> +You am a friend of mine. > You are an very good speaker.<br/> +You am friendly and I am very proud of you.<br/> +> It is an very good idea.<br/> +> You are an friendly child.<br/><br/> + +(4/7 mistakes)<br/><br/> + +<textarea name="user_text" cols="50" rows="10">> You are an friendly person. +I are friendly. +You am a friend of mine. > You are an very good speaker. +You am friendly and I am very proud of you. +> It is an very good idea. +> You are an friendly child. + +(4/7 mistakes)</textarea> + +</body> +</html> Modified: trunk/extension/firefox/TODO =================================================================== --- trunk/extension/firefox/TODO 2013-05-18 09:53:06 UTC (rev 10116) +++ trunk/extension/firefox/TODO 2013-05-18 10:22:41 UTC (rev 10117) @@ -1,12 +1,12 @@ -- ignore lines starting with "> " (quotes) in text fields - - panel opened through context menu should have a sensible position (https://bugzilla.mozilla.org/show_bug.cgi?id=669523) - password fields (type="password") should probably not be send to the server at all, for privacy reasons and because it doesn't make sense anyway -- possibility to undock the panel (overlay webpage or sidebar) +- possibility to undock the panel (overlay webpage or sidebar, https://bugzilla.mozilla.org/show_bug.cgi?id=787395) +- possibility to apply a suggestion + - bug: CTRL-A and check on languagetool.org and you'll get Javascript code checked. "Text" in between <script>...</script> should probably be ignored. Modified: trunk/extension/firefox/lib/main.js =================================================================== --- trunk/extension/firefox/lib/main.js 2013-05-18 09:53:06 UTC (rev 10116) +++ trunk/extension/firefox/lib/main.js 2013-05-18 10:22:41 UTC (rev 10117) @@ -40,9 +40,16 @@ * removes contents of <script>, html tags, newlines, and trims the resulting string */ function preprocess(text) { - return text.replace(/\<script[\s\S]*?\>[\s\S]*?\<\/script\>/gm," <BR> ") // remove everything between <script>-Tags - .replace(/\<\/?([\s\S]*?)\>/gm,"") // remove html tags - .replace(/(\r\n|\n|\r)/gm," <BR> ") // remove newlines + text=text.replace(/\<script[\s\S]*?\>[\s\S]*?\<\/script\>/gm," <BR> ") // remove everything between <script>-Tags + .replace(/\<\/?([\s\S]*?)\>/gm,"") // remove html tags + + if(simpleprefs.prefs.ignoreQuotes) { + text=text.replace(/^>.*?\n/gm, '\n') + .replace(/\n>.*?\n/gm, '\n') + .replace(/\n>.*?$/gm, '\n'); // remove quotes + } + + return text.replace(/(\r\n|\n|\r)/gm," <BR> ") // remove newlines .replace(/(\s+\<BR\>\s+(\<BR\>\s+)*)/g," ") // remove extra spaces added after newline .replace(/^\s+|\s+$/g,""); // trim } Modified: trunk/extension/firefox/locale/en-US.properties =================================================================== --- trunk/extension/firefox/locale/en-US.properties 2013-05-18 09:53:06 UTC (rev 10116) +++ trunk/extension/firefox/locale/en-US.properties 2013-05-18 10:22:41 UTC (rev 10117) @@ -20,6 +20,7 @@ mothertongue_title=Mother tongue mothertongue_description=Select your mother tongue here in order to be warned of false friends in foreign-language texts. enableSpellCheck_title=Enable spell check +ignoreQuotes_title=Ignore lines starting with “>” (i.e. quotes) localServerUrl_title=URL of the local server localServerUrl_description=You can change the port on which the LanguageTool server is running, or enter a completely different URL, e.g. if you are using a central server in your company. enableWebService_title=Use web service when connecting with the local server is not successful Modified: trunk/extension/firefox/package.json =================================================================== --- trunk/extension/firefox/package.json 2013-05-18 09:53:06 UTC (rev 10116) +++ trunk/extension/firefox/package.json 2013-05-18 10:22:41 UTC (rev 10117) @@ -345,6 +345,11 @@ "type": "bool", "value": true }, { + "name": "ignoreQuotes", + "title": "ignoreQuotes_title", + "type": "bool", + "value": true + }, { "name": "localServerUrl", "title": "localServerUrl_title", "description": "localServerUrl_description", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ Languagetool-commits mailing list Languagetool-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-commits