use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class MarkdownLanguageTestBase method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
parser = new MarkupParser(new MarkdownLanguage());
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class MarkdownRoundTripTest method parseMarkdownToHtml.
private String parseMarkdownToHtml(String markupContent) {
StringWriter htmlWriter = new StringWriter();
HtmlDocumentBuilder htmlDocumentBuilder = new HtmlDocumentBuilder(htmlWriter);
htmlDocumentBuilder.setEmitAsDocument(false);
MarkupParser markupParser = new MarkupParser(language, htmlDocumentBuilder);
markupParser.parse(markupContent);
return htmlWriter.toString();
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class BugzillaTextileLanguageTest method initParser.
private void initParser() throws IOException {
parser = new MarkupParser();
TextileLanguage markupLanguage = new TextileLanguage();
MarkupLanguageConfiguration configuration = Util.create("bugzilla");
markupLanguage.configure(configuration);
parser.setMarkupLanguage(markupLanguage);
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class CommonMarkLanguageDocumentOffsetsTest method assertSpanOffsets.
private void assertSpanOffsets(int offset, int length, String expectedHtml, String markup) {
final AtomicReference<Locator> spanLocator = new AtomicReference<Locator>();
CommonMarkLanguage language = new CommonMarkLanguage();
MarkupParser parser = new MarkupParser(language);
StringWriter out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out) {
@Override
public void beginSpan(SpanType type, Attributes attributes) {
assertNull(spanLocator.get());
spanLocator.set(new LocatorImpl(getLocator()));
super.beginSpan(type, attributes);
}
};
builder.setEmitAsDocument(false);
parser.setBuilder(builder);
parser.parse(markup);
assertEquals(expectedHtml, out.toString());
Locator locator = spanLocator.get();
assertNotNull(locator);
assertEquals(offset, locator.getDocumentOffset());
int actualLength = locator.getLineSegmentEndOffset() - locator.getLineCharacterOffset();
assertEquals(length, actualLength);
}
use of org.eclipse.mylyn.wikitext.parser.MarkupParser in project mylyn.docs by eclipse.
the class ConfluenceLanguageIntegrationTest method assertRoundTrip.
private void assertRoundTrip(String textileIn, String textileOut) {
Writer confluenceOut = new StringWriter();
ConfluenceLanguage confluenceLanguage = new ConfluenceLanguage();
MarkupParser parser = new MarkupParser(confluenceLanguage);
parser.setBuilder(confluenceLanguage.createDocumentBuilder(confluenceOut));
parser.parse(textileIn, false);
assertEquals(textileOut, confluenceOut.toString());
}
Aggregations