1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.internal.renderer.xhtml

File XHTMLChainingRenderer.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

38
168
53
1
613
432
91
0.54
3.17
53
1.72

Classes

Class Line # Actions
XHTMLChainingRenderer 50 168 0% 91 10
0.9613899696.1%
 

Contributing tests

This file is covered by 584 tests. .

Source view

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.renderer.xhtml;
21   
22    import java.util.LinkedHashMap;
23    import java.util.List;
24    import java.util.Map;
25   
26    import org.xwiki.rendering.internal.renderer.xhtml.image.XHTMLImageRenderer;
27    import org.xwiki.rendering.internal.renderer.xhtml.link.XHTMLLinkRenderer;
28    import org.xwiki.rendering.listener.Format;
29    import org.xwiki.rendering.listener.HeaderLevel;
30    import org.xwiki.rendering.listener.ListType;
31    import org.xwiki.rendering.listener.MetaData;
32    import org.xwiki.rendering.listener.chaining.BlockStateChainingListener;
33    import org.xwiki.rendering.listener.chaining.BlockStateChainingListener.Event;
34    import org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener;
35    import org.xwiki.rendering.listener.chaining.ListenerChain;
36    import org.xwiki.rendering.listener.chaining.MetaDataStateChainingListener;
37    import org.xwiki.rendering.listener.reference.ResourceReference;
38    import org.xwiki.rendering.renderer.AbstractChainingPrintRenderer;
39    import org.xwiki.rendering.renderer.printer.WikiPrinter;
40    import org.xwiki.rendering.renderer.printer.XHTMLWikiPrinter;
41    import org.xwiki.rendering.syntax.Syntax;
42    import org.xwiki.rendering.syntax.SyntaxType;
43   
44    /**
45    * Convert listener events to XHTML.
46    *
47    * @version $Id: 2449f93fba577a884f91a9d862d4538f4f950499 $
48    * @since 1.8RC1
49    */
 
50    public class XHTMLChainingRenderer extends AbstractChainingPrintRenderer
51    {
52    /**
53    * Class attribute value that indicates if the header was generated by a macro.
54    */
55    public static final String GENERATEDHEADERCLASS = "wikigeneratedheader";
56   
57    /**
58    * Class attribute value that indicates if the header id attribute was generated automatically or if it was the user
59    * who specified an id.
60    */
61    public static final String GENERATEDIDCLASS = "wikigeneratedid";
62   
63    private XHTMLLinkRenderer linkRenderer;
64   
65    private XHTMLImageRenderer imageRenderer;
66   
67    private XHTMLWikiPrinter xhtmlWikiPrinter;
68   
69    /**
70    * @param linkRenderer the object to render link events into XHTML. This is done so that it's pluggable because link
71    * rendering depends on how the underlying system wants to handle it. For example for XWiki we check if
72    * the document exists, we get the document URL, etc.
73    * @param imageRenderer the object to render image events into XHTML. This is done so that it's pluggable because
74    * image rendering depends on how the underlying system wants to handle it. For example for XWiki we
75    * check if the image exists as a document attachments, we get its URL, etc.
76    * @param listenerChain the chain of listener filters used to compute various states
77    */
 
78  412696 toggle public XHTMLChainingRenderer(XHTMLLinkRenderer linkRenderer, XHTMLImageRenderer imageRenderer,
79    ListenerChain listenerChain)
80    {
81  412773 setListenerChain(listenerChain);
82   
83  412735 this.linkRenderer = linkRenderer;
84  412760 this.imageRenderer = imageRenderer;
85    }
86   
87    // State
88   
 
89  35196 toggle protected BlockStateChainingListener getBlockState()
90    {
91  35197 return (BlockStateChainingListener) getListenerChain().getListener(BlockStateChainingListener.class);
92    }
93   
 
94  53790 toggle protected EmptyBlockChainingListener getEmptyBlockState()
95    {
96  53795 return (EmptyBlockChainingListener) getListenerChain().getListener(EmptyBlockChainingListener.class);
97    }
98   
 
99  35455 toggle protected MetaDataStateChainingListener getMetaDataState()
100    {
101  35458 return (MetaDataStateChainingListener) getListenerChain().getListener(MetaDataStateChainingListener.class);
102    }
103   
104    // Printer
105   
 
106  412920 toggle @Override
107    protected void pushPrinter(WikiPrinter wikiPrinter)
108    {
109  412875 super.pushPrinter(wikiPrinter);
110  412891 getXHTMLWikiPrinter().setWikiPrinter(getPrinter());
111    }
112