@Override public void beginHeading(int level, Attributes attributes) { if (level > 6) { level = 6; } writer.writeStartElement(htmlNsUri, "h" + level); //$NON-NLS-1$ applyAttributes(attributes); }
private void applyListAttributes(Attributes attributes) { applyAttributes(attributes); if (attributes instanceof ListAttributes) { ListAttributes listAttributes = (ListAttributes) attributes; if (listAttributes.getStart() != null) { writer.writeAttribute("start", listAttributes.getStart()); //$NON-NLS-1$ } } }
private void applyQuoteAttributes(Attributes attributes) { applyAttributes(attributes); if (attributes instanceof QuoteAttributes) { QuoteAttributes quoteAttributes = (QuoteAttributes) attributes; if (quoteAttributes.getCitation() != null) { writer.writeAttribute("cite", quoteAttributes.getCitation()); //$NON-NLS-1$ } } }
@Override public void beginSpan(SpanType type, Attributes attributes) { String elementName = spanTypeToElementName.get(type); if (elementName == null) { throw new IllegalStateException(type.name()); } writer.writeStartElement(htmlNsUri, elementName); if (type == SpanType.LINK && attributes instanceof LinkAttributes) { String href = ((LinkAttributes) attributes).getHref(); emitAnchorHref(href); applyLinkAttributes(attributes, href); } else { applyAttributes(attributes); } }
private void applyLinkAttributes(Attributes attributes, String href) { applyAttributes(attributes); boolean hasTarget = false; String rel = linkRel;
@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(); } } }
applyAttributes(attributes); boolean haveAlt = false;
private void applyTableRowAttributes(Attributes attributes) { applyAttributes(attributes); if (attributes.getTitle() != null) { writer.writeAttribute("title", attributes.getTitle()); //$NON-NLS-1$ } if (attributes instanceof TableRowAttributes) { TableRowAttributes tableRowAttributes = (TableRowAttributes) attributes; if (tableRowAttributes.getBgcolor() != null) { writer.writeAttribute("bgcolor", tableRowAttributes.getBgcolor()); //$NON-NLS-1$ } if (tableRowAttributes.getAlign() != null) { writer.writeAttribute("align", tableRowAttributes.getAlign()); //$NON-NLS-1$ } if (tableRowAttributes.getValign() != null) { writer.writeAttribute("valign", tableRowAttributes.getValign()); //$NON-NLS-1$ } } }
private void applyCellAttributes(Attributes attributes) { applyAttributes(attributes); if (attributes.getTitle() != null) { writer.writeAttribute("title", attributes.getTitle()); //$NON-NLS-1$ } if (attributes instanceof TableCellAttributes) { TableCellAttributes tableCellAttributes = (TableCellAttributes) attributes; if (tableCellAttributes.getScope() != null) { writer.writeAttribute("scope", tableCellAttributes.getScope()); //$NON-NLS-1$ } if (tableCellAttributes.getBgcolor() != null) { writer.writeAttribute("bgcolor", tableCellAttributes.getBgcolor()); //$NON-NLS-1$ } if (tableCellAttributes.getAlign() != null) { writer.writeAttribute("align", tableCellAttributes.getAlign()); //$NON-NLS-1$ } if (tableCellAttributes.getValign() != null) { writer.writeAttribute("valign", tableCellAttributes.getValign()); //$NON-NLS-1$ } if (tableCellAttributes.getRowspan() != null) { writer.writeAttribute("rowspan", tableCellAttributes.getRowspan()); //$NON-NLS-1$ } if (tableCellAttributes.getColspan() != null) { writer.writeAttribute("colspan", tableCellAttributes.getColspan()); //$NON-NLS-1$ } } }
private void applyTableAttributes(Attributes attributes) { applyAttributes(attributes); if (attributes.getTitle() != null) { writer.writeAttribute("title", attributes.getTitle()); //$NON-NLS-1$