changeset 1469:e9102a5cb03c

PR3426 - ITW Docs do not have correct 'AUTHOR' field * AUTHORS: removed invalid space after one lt mark * Makefile: (generate-docs.stamp) added and used (where appropriate) path to src AUTHORS file. * netx/net/sourceforge/jnlp/resources/Messages.properties: added message for case, when no authors file specified on input. * netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: implemented possibility to include authors file to documentation. * tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java: tests for generator
author Jiri Vanek <jvanek@redhat.com>
date Thu, 14 Sep 2017 15:13:49 +0200
parents 0ef6f6c93476
children 676a6ba5bc31
files AUTHORS ChangeLog Makefile.am netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java
diffstat 6 files changed, 282 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Tue Sep 12 10:16:24 2017 +0200
+++ b/AUTHORS	Thu Sep 14 15:13:49 2017 +0200
@@ -11,7 +11,7 @@
 Adam Domurad <adomurad@redhat.com>
 Lukasz Dracz <ldracz@redhat.com>
 Thomas Fitzsimmons <fitzsim@redhat.com>
-Michał Górny < mgorny@gentoo.org >
+Michał Górny <mgorny@gentoo.org>
 Mark Greenwood <mark@dcs.shef.ac.uk>
 Tereza Hlavackova <hlavackova.tereza@gmail.com>
 Peter Hatina <phatina@redhat.com>
@@ -43,6 +43,5 @@
 Man Lung Wong <mwong@redhat.com>
 
 This project also includes code from the following projects:
-
 OpenJDK <http://openjdk.java.net/>
 Netx <http://jnlp.sourceforge.net/netx/>
--- a/ChangeLog	Tue Sep 12 10:16:24 2017 +0200
+++ b/ChangeLog	Thu Sep 14 15:13:49 2017 +0200
@@ -1,3 +1,17 @@
+2017-09-14  Jiri Vanek <jvanek@redhat.com>
+            Tomáš Votava <tomcacolca@gmail.com>
+
+	PR3426 - ITW Docs do not have correct 'AUTHOR' field 
+	* AUTHORS: removed invalid space after one lt mark
+	* Makefile: (generate-docs.stamp) added and used (where appropriate)
+	path to src AUTHORS file.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: added message for
+	case, when no authors file specified on input.
+	* netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java: implemented
+	possibility to include authors file to documentation.
+	* tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java:
+	tests for generator 
+
 2017-09-12  Fridrich Strba  <fridrich.strba@suse.com>
 
 	Set source language version for javadoc generation for jdk9
--- a/Makefile.am	Tue Sep 12 10:16:24 2017 +0200
+++ b/Makefile.am	Thu Sep 14 15:13:49 2017 +0200
@@ -730,6 +730,7 @@
 	HTML_DOCS_TARGET_DIR="$(DOCS_DIR)/html"  ; \
 	PLAIN_DOCS_TARGET_DIR="$(DOCS_DIR)/plain" ; \
 	MAN_DOCS_TARGET_DIR="$(DOCS_DIR)/man"  ; \
+	AUTHORS_FILE_TARGET="$(TOP_SRC_DIR)/AUTHORS" ; \
 	mkdir "$$HTML_DOCS_TARGET_DIR" ; \
 	mkdir "$$PLAIN_DOCS_TARGET_DIR" ; \
 	mkdir "$$MAN_DOCS_TARGET_DIR" ; \
@@ -745,16 +746,16 @@
 	  export LANG=$$LANG_ID; \
 	  mkdir "$$HTML_DOCS_TARGET_DIR/$$ID" ; \
 	  echo "<li><a href='$$ID/icedtea-web.html'>$$LANG_ID</a></li>"  >> "$$HTML_DOCS_INDEX" ; \
-	  $$TP_COMMAND html "$$HTML_DOCS_TARGET_DIR/$$ID" $$TP_TAIL ; \
+	  $$TP_COMMAND html "$$HTML_DOCS_TARGET_DIR/$$ID" $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  mkdir "$$PLAIN_DOCS_TARGET_DIR/$$ID" ; \
-	  $$TP_COMMAND plain "$$PLAIN_DOCS_TARGET_DIR/$$ID" 160 $$TP_TAIL; \
+	  $$TP_COMMAND plain "$$PLAIN_DOCS_TARGET_DIR/$$ID" 160 $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  if [ $$ID = "en" ] ; then \
 	    MAN_DESC="$$MAN_DOCS_TARGET_DIR/man1" ; \
 	  else \
 	    MAN_DESC="$$MAN_DOCS_TARGET_DIR/$$ID/man1" ; \
 	  fi ; \
 	  mkdir -p "$$MAN_DESC" ; \
-	  $$TP_COMMAND man $$ENCOD "$$MAN_DESC" $$TP_TAIL ; \
+	  $$TP_COMMAND man $$ENCOD "$$MAN_DESC" $$TP_TAIL "-authorFile=$$AUTHORS_FILE_TARGET" ; \
 	  $$TP_COMMAND htmlIntro "$(NETX_DIR)/net/sourceforge/jnlp/resources/about_$$ID.html" $$TP_TAIL; \
 	done ; \
 	export LANG=$$LANG_BACKUP ; \
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Tue Sep 12 10:16:24 2017 +0200
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Thu Sep 14 15:13:49 2017 +0200
@@ -30,6 +30,7 @@
 BUTback=Back
 BUTforward=Forward
 BUTreload=Reload
+ITWdocsMissingAuthors=See authors file
 
 HEADLESS_MISSCONFIGURED=Headless check failed. You are forced to run without any graphics. IcedTea-Web can run like this, but your app probably not. This is likely bug in your system.
 
--- a/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java	Tue Sep 12 10:16:24 2017 +0200
+++ b/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java	Thu Sep 14 15:13:49 2017 +0200
@@ -33,18 +33,23 @@
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.
-*/
-
+ */
 package net.sourceforge.jnlp.util.docprovider;
 
+import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.io.Reader;
 import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -63,13 +68,16 @@
 import net.sourceforge.jnlp.util.docprovider.formatters.formatters.ReplacingTextFormatter;
 
 public abstract class TextsProvider {
+    
+    private static File authorFileFromUserInput = null;
 
     private final String encoding;
     private final Formatter formatter;
     private final boolean forceTitles;
     protected final boolean expandVariables;
     private boolean prepared = false;
-
+    private File authorFilePath = null;
+    
     private boolean introduction = true;
     private boolean synopsis = true;
     private boolean description = true;
@@ -184,7 +192,6 @@
             for (Map.Entry<String, Setting<String>> entry : defs) {
                 if (matchSttingsValueWithInfrastrucutreFile(entry.getValue(), f)) {
                     controlledBy = " " + Translator.R("BUTControlledBy", getFormatter().getBold(entry.getKey()));
-                    
                     break;
                 }
             }
@@ -271,13 +278,9 @@
     public String getAuthors() {
         if (forceTitles) {
             return getFormatter().getTitle(ManFormatter.KnownSections.AUTHOR)
-                    + getFormatter().wrapParagraph(
-                            getFormatter().process(Translator.R("ITWTBdebug"))
-                            + getFormatter().getNewLine());
+                    + generateAuthorsSection(authorFilePath);
         } else {
-            return getFormatter().wrapParagraph(
-                    getFormatter().process(Translator.R("ITWTBdebug"))
-                    + getFormatter().getNewLine());
+            return generateAuthorsSection(authorFilePath);
         }
     }
 
@@ -399,7 +402,7 @@
     public static void main(String[] args) throws IOException {
         // Shutdown hook from OutputController was causing hanging build on Windows. It's not used on headless.
         JNLPRuntime.setHeadless(true);
-
+        
         if (args.length == 0) {
             System.out.println(" * IcedTea-Web self documentation tool list of arguments *");
             System.out.println(" * argument version - last parameter of each command, is used when there is no internal versionknown *");
@@ -412,24 +415,38 @@
             System.out.println("man encoding targetDir expand version - will generate man documentation to target dir in desired encoding");
             System.out.println("plain targetDir maxLineWidth expand version - will generate plain text documentation to target dir in desired encoding");
             System.out.println("                                            - maxLineWidth is in <5," + Integer.MAX_VALUE + ">");
+            System.out.println("to generate informations about authors from a file, use argument '-authorFile' with path to AUTHORS file located in icedtea-web."
+                    + "\n eg. -authorFile=/home/user/icedtea-web/AUTHORS");
         } else {
-            ReplacingTextFormatter.backupVersion = args[args.length - 1];
-            boolean expand = Boolean.valueOf(args[args.length - 2]);
-            switch (args[0]) {
+            List<String> argsList = new ArrayList<>();
+            argsList.addAll(Arrays.asList(args));
+            for (String s : argsList) {
+                if (s.startsWith("-authorFile=")) {
+                    authorFileFromUserInput = new File(s.split("=")[1]);
+                    if (!authorFileFromUserInput.exists()) {
+                        throw new RuntimeException(authorFileFromUserInput.getAbsolutePath() + " does not exists");
+                    }
+                    argsList.remove(s);
+                    break;
+                }
+            }
+            ReplacingTextFormatter.backupVersion = argsList.get(argsList.size() - 1);
+            boolean expand = Boolean.valueOf(argsList.get(argsList.size() - 2));
+            switch (argsList.get(0)) {
                 case "all":
                     generateAll(new File(System.getProperty("user.dir")), expand);
                     break;
                 case "html":
-                    generateOnlineHtmlHelp(new File(args[1]), expand);
+                    generateOnlineHtmlHelp(new File(argsList.get(1)), expand);
                     break;
                 case "htmlIntro":
-                    generateItwIntro(new File(args[1]), expand);
+                    generateItwIntro(new File(argsList.get(1)), expand);
                     break;
                 case "man":
-                    generateManText(args[1], new File(args[2]), expand);
+                    generateManText(argsList.get(1), new File(argsList.get(2)), expand);
                     break;
                 case "plain":
-                    generatePlainTextDocs(new File(args[1]), Integer.valueOf(args[2]), expand);
+                    generatePlainTextDocs(new File(argsList.get(1)), Integer.valueOf(argsList.get(2)), expand);
                     break;
                 default:
                     System.out.println("unknown param");
@@ -441,6 +458,7 @@
 
     public static void generateItwIntro(File f, boolean expand) throws IOException {
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider("utf-8", new HtmlFormatter(false, true, false), false, expand);
+        //!!AUTHORS FILE IS NOT NEEDED IN THIS METHOD, AUTHORS ARE GENERATED SEPARATELY INTO ANOTHER TAB
         itw.setSeeAlso(false);
         itw.writeToFile(f);
     }
@@ -481,15 +499,15 @@
             }
         }
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new HtmlFormatter(allowContext, allowLogo, includeXmlHeader), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for (TextsProvider provider : providers) {
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -499,15 +517,15 @@
 
     public static void generateManText(String encoding, File dir, boolean titles, boolean expand) throws IOException {
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new ManFormatter(), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new ManFormatter(), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new ManFormatter(), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new ManFormatter(), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new ManFormatter(), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for (TextsProvider provider : providers) {
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -517,15 +535,15 @@
 
     public static void generatePlainTextDocs(String encoding, File dir, String indent, int lineWidth, boolean titles, boolean expand) throws IOException {
         JavaWsTextsProvider javaws = new JavaWsTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        javaws.writeToDir(dir);
         ItwebSettingsTextsProvider itws = new ItwebSettingsTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        itws.writeToDir(dir);
         PolicyEditorTextsProvider pe = new PolicyEditorTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        pe.writeToDir(dir);
         IcedTeaWebTextsProvider itw = new IcedTeaWebTextsProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        itw.writeToDir(dir);
         ItwebPluginTextProvider pl = new ItwebPluginTextProvider(encoding, new PlainTextFormatter(indent, lineWidth), titles, expand);
-        pl.writeToDir(dir);
+        TextsProvider[] providers = new TextsProvider[]{javaws, itws, pe, itw, pl};
+        for(TextsProvider provider : providers){
+            provider.setAuthorFilePath(authorFileFromUserInput);
+            provider.writeToDir(dir);
+        }
 
     }
 
@@ -671,6 +689,11 @@
         this.authors = authors;
     }
 
+    public void setAuthorFilePath(File authorFilePath) {
+        this.authorFilePath = authorFilePath;
+    }
+    
+
     /**
      * @return the seeAlso
      */
@@ -695,4 +718,55 @@
         return s;
     }
 
+    private String readAuthors(File authors) {
+        try {
+            return readAuthorsImpl(authors);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private String readAuthorsImpl(File authors) throws IOException {
+        return readAuthorsImpl(new InputStreamReader(new FileInputStream(authors), "UTF-8"));
+
+    }
+
+    String readAuthorsImpl(Reader authors) throws IOException {
+        StringBuilder sb = new StringBuilder();
+        boolean areAuthors = false;
+        BufferedReader reader = new BufferedReader(authors);
+        while (true) {
+            String line = reader.readLine();
+            if (line == null) {
+                break;
+            }
+            if (line.trim().isEmpty()) {
+                areAuthors = !areAuthors;
+            }
+            if (getFormatter() instanceof HtmlFormatter) {
+                String replace = line.replaceAll("<", "&#60");
+                String replaceAll = replace.replaceAll(">", "&#62");
+                sb.append(getFormatter().process(replaceAll));
+            } else {
+                sb.append(getFormatter().process(line));
+            }
+            if (getFormatter() instanceof HtmlFormatter || areAuthors == false) {
+                sb.append(getFormatter().getNewLine());
+            }
+        }
+        return sb.toString();
+    }
+
+    private String generateAuthorsSection(File filePath) {
+        if (filePath == null) {
+            return getFormatter().wrapParagraph(
+                    getFormatter().process(Translator.R("ITWdocsMissingAuthors"))
+                    + getFormatter().getNewLine());
+        } else {
+            return getFormatter().wrapParagraph(
+                    getFormatter().process(readAuthors(filePath))
+                    + getFormatter().getNewLine());
+        }
+    }
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/docprovider/ReadAutorsTest.java	Thu Sep 14 15:13:49 2017 +0200
@@ -0,0 +1,155 @@
+/* ReadAutorsTest.java
+   Copyright (C) 2017 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+package net.sourceforge.jnlp.util.docprovider;
+
+import java.io.IOException;
+import java.io.StringReader;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.HtmlFormatter;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.ManFormatter;
+import net.sourceforge.jnlp.util.docprovider.formatters.formatters.PlainTextFormatter;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class ReadAutorsTest {
+    
+    public static final String NEWLINE = System.getProperty("line.separator");
+    public static final String HTMLNEWLINE = "<BR/>";
+    public static final String MANNEWLINE = ".br";
+    
+    public static final String TESTTEXT = "<test@test.test><<>><><>" + NEWLINE + "<><><>";
+    public static final String BRACKETSTESTREPLACEDHTML = "&#60test@test.test&#62&#60&#60&#62&#62&#60&#62&#60&#62" + HTMLNEWLINE + NEWLINE + "&#60&#62&#60&#62&#60&#62" + HTMLNEWLINE + NEWLINE;
+    public static final String BRACKETSTESTREPLACEDMAN = "<test@test.test><<>><><>" + NEWLINE + MANNEWLINE + NEWLINE + "<><><>" + NEWLINE + MANNEWLINE + NEWLINE;
+    public static final String BRACKETSTESTREPLACEDPLAIN = TESTTEXT + NEWLINE;
+    
+    public static final String FILESTREAM = "RANDOM TEXT" + NEWLINE + "RANDOM TEXT" + NEWLINE
+            + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + NEWLINE 
+            + "MORE RANDOM TEXT" + NEWLINE
+            + "MORE RANDOM TEXT" + NEWLINE
+            + "MORE RANDOM TEXT" + NEWLINE;
+    public static final String FILESTREAMHTML = "RANDOM TEXT" + HTMLNEWLINE + NEWLINE + "RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "ANOTHER RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + HTMLNEWLINE + NEWLINE
+            + "MORE RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "MORE RANDOM TEXT" + HTMLNEWLINE + NEWLINE
+            + "MORE RANDOM TEXT" + HTMLNEWLINE + NEWLINE;
+    public static final String FILESTREAMPLAIN = "RANDOM TEXT" + NEWLINE + "RANDOM TEXT" + NEWLINE
+            + "ANOTHER RANDOM TEXT"
+            + "ANOTHER RANDOM TEXT"
+            + "ANOTHER RANDOM TEXT"
+            + "ANOTHER RANDOM TEXT"
+            + "ANOTHER RANDOM TEXT"
+            + "ANOTHER RANDOM TEXT" + NEWLINE
+            + "MORE RANDOM TEXT" + NEWLINE
+            + "MORE RANDOM TEXT" + NEWLINE
+            + "MORE RANDOM TEXT" + NEWLINE;
+
+    @Test
+    public void replaceBracketsWithEntitiesHtml() throws IOException {
+        TextsProvider tp = new TextsProvider("utf-8", new HtmlFormatter(), true, true) {
+            @Override
+            public String getId() {
+                return "test1";
+            }
+        };
+        String output = tp.readAuthorsImpl(new StringReader(TESTTEXT));
+        assertEquals(BRACKETSTESTREPLACEDHTML, output);
+    }
+
+    @Test
+    public void replaceBracketsWithEntitiesMan() throws IOException {
+        TextsProvider tp = new TextsProvider("utf-8", new ManFormatter(), true, true) {
+            @Override
+            public String getId() {
+                return "test2";
+            }
+        };
+        String output = tp.readAuthorsImpl(new StringReader(TESTTEXT));
+        assertEquals(BRACKETSTESTREPLACEDMAN, output);
+    }
+
+    @Test
+    public void replaceBracketsWithEntitiesPlain() throws IOException {
+        TextsProvider tp = new TextsProvider("utf-8", new PlainTextFormatter(), true, true) {
+            @Override
+            public String getId() {
+                return "test3";
+            }
+        };
+        String output = tp.readAuthorsImpl(new StringReader(TESTTEXT));
+        assertEquals(BRACKETSTESTREPLACEDPLAIN, output);
+    }
+
+    @Test
+    public void newLineTestHtml() throws IOException {
+        TextsProvider tp = new TextsProvider("utf-8", new HtmlFormatter(), true, true) {
+            @Override
+            public String getId() {
+                return "test4";
+            }
+        };
+        String output = tp.readAuthorsImpl(new StringReader(FILESTREAM));
+        assertEquals(FILESTREAMHTML, output);
+
+    }
+    
+    @Test
+    public void newLineTestPlainText() throws IOException {
+        TextsProvider tp = new TextsProvider("utf-8", new PlainTextFormatter(), true, true) {
+            @Override
+            public String getId() {
+                return "test5";
+            }
+        };
+        String output = tp.readAuthorsImpl(new StringReader(FILESTREAM));
+        assertEquals(FILESTREAMPLAIN, output);
+
+    }
+}