diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/JavaWsTextsProvider.java --- a/netx/net/sourceforge/jnlp/util/docprovider/JavaWsTextsProvider.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/JavaWsTextsProvider.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,4 +1,3 @@ - /* Copyright (C) 2008 Red Hat, Inc. diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/PolicyEditorTextsProvider.java --- a/netx/net/sourceforge/jnlp/util/docprovider/PolicyEditorTextsProvider.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/PolicyEditorTextsProvider.java Fri Oct 17 15:57:06 2014 +0200 @@ -67,7 +67,8 @@ @Override public String getSynopsis() { return super.getSynopsis() - + getFormatter().wrapParagraph(getFormatter().process("@BOLD_OPEN@ " + getId() + " @BOLD_CLOSE_NWLINE_BOLD_OPEN@" + getId() + " [-file] @BOLD_CLOSE@"+Translator.R("PEsynopseP1")+" @BOLD_OPEN@[-codebase] @BOLD_CLOSE@"+Translator.R("PEsynopseP2"))); + + getFormatter().wrapParagraph(getFormatter().process(getFormatter().getBoldOpening() + " " + getId() + " " + + getFormatter().getBoldCloseNwlineBoldOpen() + getId() + " [-file] " + getFormatter().getBoldClosing() + Translator.R("PEsynopseP1") + " "+getFormatter().getBold("[-codebase] ") + Translator.R("PEsynopseP2"))); } @Override diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java --- a/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/TextsProvider.java Fri Oct 17 15:57:06 2014 +0200 @@ -175,7 +175,7 @@ String controlledBy = ""; for (Map.Entry> entry : defs) { if (matchSttingsValueWithInfrastrucutreFile(entry.getValue(), f)) { - controlledBy = " Controlled by @BOLD_OPEN@" + entry.getKey() + "@BOLD_CLOSE@"; + controlledBy = " Controlled by " + getFormatter().getBold(entry.getKey()); break; } } diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java --- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/Formatter.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,3 +1,40 @@ +/* + Copyright (C) 2008 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.formatters.formatters; public interface Formatter { diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java --- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/HtmlFormatter.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,8 +1,40 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ +/* + Copyright (C) 2008 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.formatters.formatters; import java.util.Date; @@ -11,10 +43,7 @@ import java.util.TreeMap; import net.sourceforge.jnlp.runtime.JNLPRuntime; -/** - * - * @author jvanek - */ + public class HtmlFormatter extends ReplacingTextFormatter { private final Map content = new TreeMap<>(); diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ManFormatter.java --- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ManFormatter.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ManFormatter.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,3 +1,40 @@ +/* + Copyright (C) 2008 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.formatters.formatters; import java.text.Format; diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java --- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/PlainTextFormatter.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,3 +1,40 @@ +/* + Copyright (C) 2008 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.formatters.formatters; import java.util.ArrayList; diff -r 89e1a72ca8ac netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java --- a/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java Fri Oct 17 13:28:00 2014 +0200 +++ b/netx/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatter.java Fri Oct 17 15:57:06 2014 +0200 @@ -1,3 +1,40 @@ +/* + Copyright (C) 2008 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.formatters.formatters; import net.sourceforge.jnlp.runtime.Boot; @@ -9,10 +46,7 @@ @Override public String process(String s) { - return s.replace("@NWLINE@", getNewLine()) - .replace("@BOLD_CLOSE_NWLINE_BOLD_OPEN@", getBoldCloseNwlineBoldOpen()) - .replace("@BOLD_OPEN@", getBoldOpening()).replace("@BOLD_CLOSE@", getBoldClosing()) - .replace("@NWLINE_BOLD_OPEN@", getBreakAndBold()).replace("@BOLD_CLOSE_NWLINE@", getCloseBoldAndBreak()); + return s.replace("@BOLD_OPEN@", getBoldOpening()).replace("@BOLD_CLOSE@", getBoldClosing()); } protected String localizeTitle(String s) { diff -r 89e1a72ca8ac tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatterTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/ReplacingTextFormatterTest.java Fri Oct 17 15:57:06 2014 +0200 @@ -0,0 +1,131 @@ +/* + Copyright (C) 2014 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.formatters.formatters; + +import org.junit.Assert; +import org.junit.Test; + +public class ReplacingTextFormatterTest { + + Formatter tr = new ReplacingTextFormatter() { + + @Override + public String wrapParagraph(String s) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getHeaders(String id, String encoding) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getNewLine() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getBoldOpening() { + return "OPEN"; + } + + @Override + public String getBoldClosing() { + return "CLOSE"; + } + + @Override + public String getBreakAndBold() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCloseBoldAndBreak() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getBoldCloseNwlineBoldOpen() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTitle(String name) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getUrl(String url, String appearence) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getOption(String key, String value) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getSeeAlso(String s) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTail() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getFileSuffix() { + throw new UnsupportedOperationException("Not supported yet."); + } + }; + + + @Test + public void upperCaseNoSpaces() { + String s = tr.process("aaa @BOLD_OPEN@ bbb @BOLD_CLOSE@ ccc"); + Assert.assertEquals("aaa OPEN bbb CLOSE ccc", s); + } + + @Test + public void illegal1() { + String s = tr.process("aa @BOLD_OPEN@ ccc @BOLD_close@ @BOLD@"); + Assert.assertFalse(s.contains("CLOSE")); + Assert.assertTrue(s.contains("OPEN")); + } + +} \ No newline at end of file