use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class ParagraphBlock method processLineContent.
@Override
protected int processLineContent(String line, int offset) {
// start of block
if (blockLineCount == 0) {
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
}
// empty line: start new block
if (markupLanguage.isEmptyLine(line)) {
setClosed(true);
return 0;
}
for (Block block : markupLanguage.getParagraphBreakingBlocks()) {
if (block.canStart(line, offset)) {
setClosed(true);
return offset;
}
}
// next line, does not convert to line break
if (blockLineCount > 0) {
// $NON-NLS-1$
builder.characters("\n");
}
getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset);
blockLineCount++;
return -1;
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testDiv.
public void testDiv() {
builder.beginDocument();
builder.beginBlock(BlockType.DIV, new Attributes());
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.characters("foo");
// PARAGRAPH
builder.endBlock();
builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
builder.characters("bar");
// PARAGRAPH
builder.endBlock();
// DIV
builder.endBlock();
builder.endDocument();
String docbook = out.toString();
String expectedContent = "<para>foo</para><para>bar</para>";
assertEquals(DOCBOOK_BEGIN_CHAPTER + expectedContent + DOCBOOK_END_CHAPTER, docbook);
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testOrderedListUpperromanType.
public void testOrderedListUpperromanType() {
builder.beginDocument();
ListAttributes listAttributes = new ListAttributes();
listAttributes.setCssStyle("list-style-type: upper-roman;");
builder.beginBlock(BlockType.NUMERIC_LIST, listAttributes);
builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
builder.characters("item");
// LI
builder.endBlock();
// OL
builder.endBlock();
builder.endDocument();
String docbook = out.toString();
String expectedContent = "<orderedlist numeration=\"upperroman\"><listitem><para>item</para></listitem></orderedlist>";
assertEquals(DOCBOOK_BEGIN_CHAPTER + expectedContent + DOCBOOK_END_CHAPTER, docbook);
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testTableClass.
public void testTableClass() {
builder.beginDocument();
TableAttributes tableAttributes = new TableAttributes();
tableAttributes.appendCssClass("foo");
builder.beginBlock(BlockType.TABLE, tableAttributes);
builder.beginBlock(BlockType.TABLE_ROW, new Attributes());
builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
builder.characters("text");
// cell
builder.endBlock();
// row
builder.endBlock();
// table
builder.endBlock();
builder.endDocument();
String docbook = out.toString();
String expectedContent = "<informaltable role=\"foo\"><tr><td>text</td></tr></informaltable>";
assertEquals(DOCBOOK_BEGIN_CHAPTER + expectedContent + DOCBOOK_END_CHAPTER, docbook);
}
use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.
the class DocBookDocumentBuilderTest method testOrderedListArabicType.
public void testOrderedListArabicType() {
builder.beginDocument();
ListAttributes listAttributes = new ListAttributes();
listAttributes.setCssStyle("list-style-type: decimal;");
builder.beginBlock(BlockType.NUMERIC_LIST, listAttributes);
builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
builder.characters("item");
// LI
builder.endBlock();
// OL
builder.endBlock();
builder.endDocument();
String docbook = out.toString();
String expectedContent = "<orderedlist numeration=\"arabic\"><listitem><para>item</para></listitem></orderedlist>";
assertEquals(DOCBOOK_BEGIN_CHAPTER + expectedContent + DOCBOOK_END_CHAPTER, docbook);
}
Aggregations