private void writeBlockElements(Attributes attributes, ElementInfo elementInfo) { writer.writeStartElement(htmlNsUri, elementInfo.name); String originalCssClasses = attributes.getCssClass(); if (elementInfo.cssClass != null) { attributes.appendCssClass(elementInfo.cssClass); } if (useInlineStyles && !suppressBuiltInStyles && elementInfo.cssStyles != null) { attributes.appendCssStyle(elementInfo.cssStyles); } if (elementInfo.next != null) { if (originalCssClasses != null) { writer.writeAttribute("class", originalCssClasses); //$NON-NLS-1$ } Attributes childAttributes = new Attributes(); childAttributes.setCssClass(originalCssClasses); writeBlockElements(childAttributes, elementInfo.next); } }
@Override public void beginBlock(BlockType type, Attributes attributes) { ElementInfo elementInfo = blockTypeToElementInfo.get(type); if (elementInfo == null) { throw new IllegalStateException(type.name()); } writeBlockElements(attributes, elementInfo); blockState.push(elementInfo); if (type == BlockType.TABLE) { applyTableAttributes(attributes); } else if (type == BlockType.TABLE_ROW) { applyTableRowAttributes(attributes); } else if (type == BlockType.TABLE_CELL_HEADER || type == BlockType.TABLE_CELL_NORMAL) { applyCellAttributes(attributes); } else if (type == BlockType.BULLETED_LIST || type == BlockType.NUMERIC_LIST) { applyListAttributes(attributes); } else if (type == BlockType.QUOTE) { applyQuoteAttributes(attributes); } else { applyAttributes(attributes); // create the titled panel effect if a title is specified if (attributes.getTitle() != null) { beginBlock(BlockType.PARAGRAPH, new Attributes()); beginSpan(SpanType.BOLD, new Attributes()); characters(attributes.getTitle()); endSpan(); endBlock(); } } }