| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.rendering.wikimodel.confluence; |
| 21 |
|
|
| 22 |
|
import java.util.ArrayDeque; |
| 23 |
|
import java.util.Deque; |
| 24 |
|
|
| 25 |
|
import org.xwiki.rendering.wikimodel.IWemListener; |
| 26 |
|
import org.xwiki.rendering.wikimodel.WikiParameters; |
| 27 |
|
import org.xwiki.rendering.wikimodel.impl.InternalWikiScannerContext; |
| 28 |
|
import org.xwiki.rendering.wikimodel.util.IListListener; |
| 29 |
|
import org.xwiki.rendering.wikimodel.util.ListBuilder; |
| 30 |
|
import org.xwiki.rendering.wikimodel.util.SectionBuilder; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
@version |
| 34 |
|
@since |
| 35 |
|
|
| |
|
| 75.2% |
Uncovered Elements: 28 (113) |
Complexity: 28 |
Complexity Density: 0.36 |
|
| 36 |
|
public class ConfluenceInternalWikiScannerContext extends |
| 37 |
|
InternalWikiScannerContext |
| 38 |
|
{ |
| 39 |
|
private int fPreBlockType = IBlockTypes.NONE; |
| 40 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 41 |
594 |
public ConfluenceInternalWikiScannerContext(... |
| 42 |
|
SectionBuilder<WikiParameters> sectionBuilder, IWemListener listener) |
| 43 |
|
{ |
| 44 |
594 |
super(sectionBuilder, listener); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@inheritDoc |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@see |
| 53 |
|
|
| 54 |
|
|
| |
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 55 |
27 |
@Override... |
| 56 |
|
public void onTableCell(boolean head, WikiParameters params) |
| 57 |
|
{ |
| 58 |
27 |
checkStyleOpened(); |
| 59 |
27 |
checkListOpened(); |
| 60 |
27 |
endTableCell(); |
| 61 |
27 |
fTableHead = head; |
| 62 |
27 |
fTableCellParams = params != null ? params : WikiParameters.EMPTY; |
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
} |
| 68 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
| 69 |
58 |
@Override... |
| 70 |
|
public void beginList() |
| 71 |
|
{ |
| 72 |
58 |
if ((fBlockType & IBlockTypes.LIST) != IBlockTypes.LIST) { |
| 73 |
17 |
if (!isInTable()) { |
| 74 |
13 |
closeBlock(); |
| 75 |
|
} else { |
| 76 |
4 |
checkStyleOpened(); |
| 77 |
4 |
fPreBlockType = fBlockType; |
| 78 |
|
} |
| 79 |
17 |
if (fListParams == null) { |
| 80 |
15 |
fListParams = WikiParameters.EMPTY; |
| 81 |
|
} |
| 82 |
17 |
IListListener listener = new IListListener() |
| 83 |
|
{ |
| 84 |
|
private Deque<WikiParameters> fListParamsStack = new ArrayDeque<WikiParameters>(); |
| 85 |
|
|
| |
|
| 53.8% |
Uncovered Elements: 6 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 86 |
49 |
public void beginRow(char treeType, char rowType)... |
| 87 |
|
{ |
| 88 |
49 |
if (rowType == ':') { |
| 89 |
0 |
fBlockType = IBlockTypes.LIST_DL_DD; |
| 90 |
0 |
fListener.beginDefinitionDescription(); |
| 91 |
49 |
} else if (rowType == ';') { |
| 92 |
0 |
fBlockType = IBlockTypes.LIST_DL_DT; |
| 93 |
0 |
fListener.beginDefinitionTerm(); |
| 94 |
|
} else { |
| 95 |
49 |
fBlockType = IBlockTypes.LIST_LI; |
| 96 |
49 |
fListener.beginListItem(); |
| 97 |
|
} |
| 98 |
49 |
beginStyleContainer(); |
| 99 |
|
} |
| 100 |
|
|
| |
|
| 75% |
Uncovered Elements: 4 (16) |
Complexity: 3 |
Complexity Density: 0.19 |
|
| 101 |
37 |
public void beginTree(char type)... |
| 102 |
|
{ |
| 103 |
37 |
fListParamsStack.push(fListParams); |
| 104 |
|
|
| 105 |
37 |
closeFormat(); |
| 106 |
37 |
switch (type) { |
| 107 |
8 |
case '#': |
| 108 |
8 |
fListener.beginList(fListParams, true); |
| 109 |
8 |
fBlockType = IBlockTypes.LIST; |
| 110 |
8 |
break; |
| 111 |
0 |
case 'd': |
| 112 |
0 |
fListener.beginDefinitionList(fListParams); |
| 113 |
0 |
fBlockType = IBlockTypes.LIST_DL; |
| 114 |
0 |
break; |
| 115 |
29 |
default: |
| 116 |
29 |
fListener.beginList(fListParams, false); |
| 117 |
29 |
fBlockType = IBlockTypes.LIST; |
| 118 |
29 |
break; |
| 119 |
|
} |
| 120 |
|
|
| 121 |
37 |
fListParams = WikiParameters.EMPTY; |
| 122 |
|
} |
| 123 |
|
|
| |
|
| 44.4% |
Uncovered Elements: 10 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
| 124 |
49 |
public void endRow(char treeType, char rowType)... |
| 125 |
|
{ |
| 126 |
49 |
closeFormat(); |
| 127 |
49 |
endStyleContainer(); |
| 128 |
49 |
if (rowType == ':') { |
| 129 |
0 |
fListener.endDefinitionDescription(); |
| 130 |
0 |
fBlockType = IBlockTypes.LIST_DL; |
| 131 |
49 |
} else if (rowType == ';') { |
| 132 |
0 |
if ((fBlockType & IBlockTypes.LIST_DL_DT) == IBlockTypes.LIST_DL_DT) { |
| 133 |
0 |
fListener.endDefinitionTerm(); |
| 134 |
|
} else { |
| 135 |
0 |
fListener.endDefinitionDescription(); |
| 136 |
|
} |
| 137 |
0 |
fBlockType = IBlockTypes.LIST_DL; |
| 138 |
|
} else { |
| 139 |
49 |
fListener.endListItem(); |
| 140 |
49 |
fBlockType = IBlockTypes.LIST; |
| 141 |
|
} |
| 142 |
|
} |
| 143 |
|
|
| |
|
| 71.4% |
Uncovered Elements: 4 (14) |
Complexity: 3 |
Complexity Density: 0.21 |
|
| 144 |
37 |
public void endTree(char type)... |
| 145 |
|
{ |
| 146 |
37 |
switch (type) { |
| 147 |
8 |
case '#': |
| 148 |
8 |
fListener.endList(fListParamsStack.peek(), true); |
| 149 |
8 |
fBlockType = IBlockTypes.LIST; |
| 150 |
8 |
break; |
| 151 |
0 |
case 'd': |
| 152 |
0 |
fListener |
| 153 |
|
.endDefinitionList(fListParamsStack.peek()); |
| 154 |
0 |
fBlockType = IBlockTypes.LIST; |
| 155 |
0 |
break; |
| 156 |
29 |
default: |
| 157 |
29 |
fListener.endList(fListParamsStack.peek(), false); |
| 158 |
29 |
fBlockType = IBlockTypes.LIST; |
| 159 |
29 |
break; |
| 160 |
|
} |
| 161 |
|
|
| 162 |
37 |
fListParamsStack.pop(); |
| 163 |
|
} |
| 164 |
|
}; |
| 165 |
17 |
fListBuilder = new ListBuilder(listener) |
| 166 |
|
{ |
| |
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 167 |
79 |
@Override... |
| 168 |
|
protected char getTreeType(char rowType) |
| 169 |
|
{ |
| 170 |
79 |
if (rowType == ';' || rowType == ':') { |
| 171 |
0 |
return 'd'; |
| 172 |
|
} |
| 173 |
79 |
return rowType; |
| 174 |
|
} |
| 175 |
|
}; |
| 176 |
17 |
fBlockType = IBlockTypes.LIST; |
| 177 |
|
} |
| 178 |
|
} |
| 179 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 180 |
43 |
@Override... |
| 181 |
|
public void endList() |
| 182 |
|
{ |
| 183 |
43 |
if ((fBlockType & IBlockTypes.LIST) != 0) { |
| 184 |
17 |
fListBuilder.alignContext(""); |
| 185 |
17 |
fListBuilder = null; |
| 186 |
|
|
| 187 |
17 |
fBlockType = fPreBlockType; |
| 188 |
17 |
fPreBlockType = IBlockTypes.NONE; |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 192 |
55 |
public boolean isExplicitInTable()... |
| 193 |
|
{ |
| 194 |
55 |
return super.isInTable() |
| 195 |
|
|| (((fPreBlockType & IBlockTypes.TABLE) == IBlockTypes.TABLE) && |
| 196 |
|
(fBlockType & IBlockTypes.LIST) == IBlockTypes.LIST); |
| 197 |
|
} |
| 198 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 199 |
27 |
private void checkListOpened()... |
| 200 |
|
{ |
| 201 |
27 |
if (isExplicitInTable()) { |
| 202 |
27 |
endList(); |
| 203 |
|
} |
| 204 |
|
} |
| 205 |
|
} |