Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../../img/srcFileCovDistChart6.png 81% of files have more coverage
12   82   7   2
2   45   0.58   6
6     1.17  
1    
 
  AbstractHTMLElementConverter       Line # 32 12 0% 7 8 60% 0.6
 
  (8)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.parser.xwiki10.macro;
21   
22    import java.util.Map;
23   
24    import org.xwiki.rendering.internal.parser.xwiki10.HTMLFilter.HTMLFilterContext;
25   
26    /**
27    * Base class for HTML elements converters.
28    *
29    * @version $Id: 2e5539a7a2429ae089e4b896cd526931f6294db6 $
30    * @since 1.8M1
31    */
 
32    public abstract class AbstractHTMLElementConverter implements HTMLElementConverter
33    {
34    private String elementName;
35   
 
36  8 toggle protected AbstractHTMLElementConverter()
37    {
38   
39    }
40   
 
41  0 toggle protected AbstractHTMLElementConverter(String elementName)
42    {
43  0 this.elementName = elementName;
44    }
45   
 
46  0 toggle @Override
47    public String getElementName()
48    {
49  0 return this.elementName;
50    }
51   
 
52  0 toggle @Override
53    public boolean protectResult()
54    {
55  0 return false;
56    }
57   
 
58  5 toggle @Override
59    public boolean isInline()
60    {
61  5 return true;
62    }
63   
64    @Override
65    public abstract String convert(String name, Map<String, String> parameters, String content,
66    HTMLFilterContext filterContext);
67   
 
68  5 toggle protected void appendParameters(StringBuffer result, Map<String, String> parameters, HTMLFilterContext filterContext)
69    {
70  5 StringBuffer parametersSB = new StringBuffer();
71  5 for (Map.Entry<String, String> parameter : parameters.entrySet()) {
72  5 if (parametersSB.length() > 0) {
73  0 parametersSB.append(" ");
74    }
75  5 parametersSB.append(filterContext.cleanContent(parameter.getKey()));
76  5 parametersSB.append("=");
77  5 parametersSB.append(filterContext.cleanContent(parameter.getValue()));
78    }
79   
80  5 result.append(parametersSB);
81    }
82    }