Revision: 8366
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=8366&view=rev
Author:   gulp21-1
Date:     2012-11-11 16:50:36 +0000 (Sun, 11 Nov 2012)
Log Message:
-----------
[extension] do not ignore \n in the selection (used to work in older versions)
            added two more tests

Modified Paths:
--------------
    trunk/extension/common/tests/FAILING_TESTS
    trunk/extension/common/tests/index.html
    trunk/extension/firefox/lib/main.js

Added Paths:
-----------
    trunk/extension/common/tests/headlineTest.html
    trunk/extension/common/tests/newlineTest.html

Modified: trunk/extension/common/tests/FAILING_TESTS
===================================================================
--- trunk/extension/common/tests/FAILING_TESTS  2012-11-11 14:49:38 UTC (rev 
8365)
+++ trunk/extension/common/tests/FAILING_TESTS  2012-11-11 16:50:36 UTC (rev 
8366)
@@ -1,3 +1,4 @@
-As of 09/11/12
+As of 11/11/12
 
+- headlineTest.html
 - scriptContentsTest.html

Added: trunk/extension/common/tests/headlineTest.html
===================================================================
--- trunk/extension/common/tests/headlineTest.html                              
(rev 0)
+++ trunk/extension/common/tests/headlineTest.html      2012-11-11 16:50:36 UTC 
(rev 8366)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>headlineTest</title>
+</head>
+<body>
+<h1>Regul&auml;re Ausdr&uuml;cke</h1>
+<p>Ein regul&auml;rer Ausdruck kann sehr kompliziert aussehen. Aber davon 
sollte man sich nicht abschrecken lassen.</p>
+
+(0 Fehler)
+
+</body>
+</html>

Modified: trunk/extension/common/tests/index.html
===================================================================
--- trunk/extension/common/tests/index.html     2012-11-11 14:49:38 UTC (rev 
8365)
+++ trunk/extension/common/tests/index.html     2012-11-11 16:50:36 UTC (rev 
8366)
@@ -10,6 +10,8 @@
 <tr><td><a href="escapeHtmlTagsTest.txt">escapeHtmlTagsTest.txt</a></td></tr>
 <tr><td><a href="escapeUrlTest.html">escapeUrlTest.html</a></td></tr>
 <tr><td><a href="germanTest.html">germanTest.html</a></td></tr>
+<tr><td><a href="headlineTest.html">headlineTest.html</a></td></tr>
+<tr><td><a href="newlineTest.html">newlineTest.html</a></td></tr>
 <tr><td><a href="scriptContentsTest.html">scriptContentsTest.html</a></td></tr>
 </table>
 </body>

Added: trunk/extension/common/tests/newlineTest.html
===================================================================
--- trunk/extension/common/tests/newlineTest.html                               
(rev 0)
+++ trunk/extension/common/tests/newlineTest.html       2012-11-11 16:50:36 UTC 
(rev 8366)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>newlineTest</title>
+</head>
+<body>
+
+One.
+
+<p>
+In this sentence
+there is an mistake.
+</p>
+
+Two.
+
+<p>
+In this sentence 
+ there is an mistake.
+</p>
+
+Three.
+
+<p>
+There is an mistake in this sentence.
+</p>
+
+Four.
+
+<p>
+In this sentence<br/>
+there is an mistake.
+</p>
+
+(4 mistakes)
+
+</body>
+</html>

Modified: trunk/extension/firefox/lib/main.js
===================================================================
--- trunk/extension/firefox/lib/main.js 2012-11-11 14:49:38 UTC (rev 8365)
+++ trunk/extension/firefox/lib/main.js 2012-11-11 16:50:36 UTC (rev 8366)
@@ -41,7 +41,7 @@
 function preprocess(text) {
        return text.replace(/\<script\>[\s\S]*?\<\/script\>/gm," <BR> ") // 
remove everything between <script>-Tags
                   .replace(/\<\/?([\s\S]*?)\>/gm,"") // remove html tags
-                  .replace(/(\r\n|\n|\r)/gm,"") // remove newlines
+                  .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
 }
@@ -154,8 +154,10 @@
 function widgetClicked() {
        var EMPTYTEXTWARNING="<div class=\"status\">"+_("emptyText")+"</div>";
        
-       if(selectedText!=null)
+       if(selectedText!=null) {
+               console.log("Selection: "+selectedText);
                selectedText=preprocess(selectedText);
+       }
        
        if(selectedText==null || selectedText=="") {
                panel.port.emit("setText", EMPTYTEXTWARNING);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Languagetool-commits mailing list
Languagetool-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to