use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class DitaTopicDocumentBuilderTest method testNoFormatting.
public void testNoFormatting() {
parser = new MarkupParser();
parser.setMarkupLanguage(new TextileLanguage());
out = new StringWriter();
DefaultXmlStreamWriter xmlStreamWriter = new DefaultXmlStreamWriter(out);
builder = new DitaTopicDocumentBuilder(xmlStreamWriter, false);
parser.setBuilder(builder);
parser.parse("h1. Title1\n\nsome content in a para");
xmlStreamWriter.close();
String dita = out.toString();
assertTrue(dita.contains("<topic id=\"Title1\"><title>Title1</title><body><p>some content in a para</p></body></topic>"));
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class DitaTopicDocumentBuilderTest method setUp.
@Override
public void setUp() {
parser = new MarkupParser();
parser.setMarkupLanguage(new TextileLanguage());
out = new StringWriter();
builder = new DitaTopicDocumentBuilder(out);
parser.setBuilder(builder);
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderIntegrationTest method setUp.
@Override
public void setUp() {
parser = new MarkupParser();
parser.setMarkupLanguage(new TextileLanguage());
out = new StringWriter();
builder = new DocBookDocumentBuilder(out);
parser.setBuilder(builder);
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class ParagraphBlock method processLineContent.
@Override
public int processLineContent(String line, int offset) {
if (blockLineCount == 0) {
Attributes attributes = new Attributes();
if (offset == 0) {
// 0-offset matches may start with the "p. " prefix.
Matcher matcher = startPattern.matcher(line);
if (matcher.matches()) {
Textile.configureAttributes(attributes, matcher, 1, true);
offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET);
} else {
if (line.charAt(0) == ' ') {
offset = 1;
if (enableUnwrapped) {
unwrapped = true;
}
}
}
}
if (!unwrapped) {
builder.beginBlock(BlockType.PARAGRAPH, attributes);
}
}
if (markupLanguage.isEmptyLine(line)) {
setClosed(true);
return 0;
}
TextileLanguage textileLanguage = (TextileLanguage) getMarkupLanguage();
// however we cause them to end the paragraph rather than being nested.
for (Block block : textileLanguage.getParagraphBreakingBlocks()) {
if (block.canStart(line, offset)) {
setClosed(true);
return offset;
}
}
if (blockLineCount != 0) {
if (unwrapped) {
// $NON-NLS-1$
builder.characters("\n");
} else {
builder.lineBreak();
}
}
++blockLineCount;
textileLanguage.emitMarkupLine(getParser(), state, line, offset);
return -1;
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class AbstractSaxParserTest method performTest.
protected void performTest(String html, String expectedResult) throws IOException, SAXException {
parser.parse(sourceForHtml(html), builder, true);
String generatedMarkup = out.toString();
assertEquals(expectedResult, generatedMarkup);
MarkupParser markupParser = new MarkupParser(new TextileLanguage());
StringWriter out = new StringWriter();
HtmlDocumentBuilder htmlBuilder = new HtmlDocumentBuilder(out);
htmlBuilder.setEmitAsDocument(false);
markupParser.setBuilder(htmlBuilder);
markupParser.parse(generatedMarkup);
}
Aggregations