| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.component.wiki.internal.bridge; |
| 21 |
|
|
| 22 |
|
import javax.inject.Inject; |
| 23 |
|
import javax.inject.Singleton; |
| 24 |
|
|
| 25 |
|
import org.xwiki.component.annotation.Component; |
| 26 |
|
import org.xwiki.component.wiki.WikiComponentException; |
| 27 |
|
import org.xwiki.model.reference.EntityReference; |
| 28 |
|
import org.xwiki.rendering.block.XDOM; |
| 29 |
|
import org.xwiki.rendering.parser.MissingParserException; |
| 30 |
|
import org.xwiki.rendering.parser.ParseException; |
| 31 |
|
import org.xwiki.rendering.syntax.Syntax; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@version |
| 37 |
|
@since |
| 38 |
|
|
| 39 |
|
@Component |
| 40 |
|
@Singleton |
| |
|
| 42.9% |
Uncovered Elements: 4 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
| 41 |
|
public class DefaultContentParser implements ContentParser |
| 42 |
|
{ |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
@Inject |
| 47 |
|
private org.xwiki.rendering.parser.ContentParser contentParser; |
| 48 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
0 |
@Override... |
| 50 |
|
public XDOM parse(String content, Syntax syntax) throws WikiComponentException |
| 51 |
|
{ |
| 52 |
0 |
return parse(content, syntax, null); |
| 53 |
|
} |
| 54 |
|
|
| |
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 55 |
310 |
@Override... |
| 56 |
|
public XDOM parse(String content, Syntax syntax, EntityReference source) throws WikiComponentException |
| 57 |
|
{ |
| 58 |
310 |
try { |
| 59 |
310 |
return contentParser.parse(content, syntax, source); |
| 60 |
|
} catch (ParseException e) { |
| 61 |
0 |
throw new WikiComponentException(String.format("Failed to parse content [%s]", content), e); |
| 62 |
|
} catch (MissingParserException e) { |
| 63 |
0 |
throw new WikiComponentException(String.format("Failed to find a parser to parse syntax [%s]", syntax), e); |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
} |