Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../../../img/srcFileCovDistChart7.png 76% of files have more coverage
18   82   14   9
16   49   0.78   2
2     7  
1    
 
  XWikiSpanTagHandler       Line # 33 18 0% 14 12 66.7% 0.6666667
 
  (56)
 
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.internal.parser.xhtml.wikimodel;
21   
22    import org.xwiki.rendering.wikimodel.WikiParameter;
23    import org.xwiki.rendering.wikimodel.xhtml.handler.SpanTagHandler;
24    import org.xwiki.rendering.wikimodel.xhtml.impl.XhtmlHandler.TagStack.TagContext;
25   
26    /**
27    * Handle XWiki span elements (we need to ensure we skip link content when we generate them
28    * and also skip the spans for the "?" for links pointing to non existing pages).
29    *
30    * @version $Id: e6f844786814dd5b253fe3dac608220ed6b43d63 $
31    * @since 1.7M1
32    */
 
33    public class XWikiSpanTagHandler extends SpanTagHandler
34    {
 
35  138 toggle @Override
36    protected void begin(TagContext context)
37    {
38    // If we're on a span for unknown links then skip the event for its content.
39    // Ex: <a href="..."><span class="wikicreatelinktext">...</span><span class="wikicreatelinkqm">?</span></a>
40  138 WikiParameter classParam = context.getParams().getParameter("class");
41  138 if (classParam != null) {
42  73 if (classParam.getValue().contains("wikigeneratedlinkcontent"))
43    {
44  28 setAccumulateContent(true);
45  45 } else if (classParam.getValue().equals("wikilink")
46    || classParam.getValue().equals("wikicreatelink")
47    || classParam.getValue().equals("wikiexternallink"))
48    {
49    // Nothing to do
50  0 } else if (classParam.getValue().equals("xwikirenderingerror")) {
51  0 setAccumulateContent(true);
52    } else {
53  0 super.begin(context);
54    }
55    } else {
56  65 super.begin(context);
57    }
58    }
59   
 
60  138 toggle @Override
61    protected void end(TagContext context)
62    {
63  138 WikiParameter classParam = context.getParams().getParameter("class");
64  138 if (classParam != null) {
65  73 if (classParam.getValue().contains("wikigeneratedlinkcontent"))
66    {
67  28 setAccumulateContent(false);
68  45 } else if (classParam.getValue().equals("wikilink")
69    || classParam.getValue().equals("wikicreatelink")
70    || classParam.getValue().equals("wikiexternallink"))
71    {
72    // Nothing to do
73  0 } else if (classParam.getValue().equals("xwikirenderingerror")) {
74  0 setAccumulateContent(false);
75    } else {
76  0 super.end(context);
77    }
78    } else {
79  65 super.end(context);
80    }
81    }
82    }