List of usage examples for com.lowagie.text ElementTags ALT
String ALT
To view the source code for com.lowagie.text ElementTags ALT.
Click Source Link
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void text(String text) { if (StringUtils.isEmpty(text)) { return;//from ww w .ja v a 2 s.c om } switch (actionContext.getCurrentAction()) { case SinkActionContext.AUTHOR: header.addAuthor(text); break; case SinkActionContext.DATE: header.setDate(text); break; case SinkActionContext.TITLE: header.setTitle(text); break; case SinkActionContext.TABLE_CAPTION: this.tableCaptionXMLWriter.writeText(text); break; case SinkActionContext.VERBATIM: // Used to preserve indentation and formating LineNumberReader lnr = new LineNumberReader(new StringReader(text)); String line; try { while ((line = lnr.readLine()) != null) { writeStartElement(ElementTags.CHUNK); writeAddAttribute(ElementTags.FONT, font.getFontName()); writeAddAttribute(ElementTags.SIZE, font.getFontSize()); writeAddAttribute(ElementTags.STYLE, font.getFontStyle()); writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue()); writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen()); writeAddAttribute(ElementTags.RED, font.getFontColorRed()); write("<![CDATA[", true); // Special case line = StringUtils.replace(line, "<![CDATA[", "< ![CDATA["); line = StringUtils.replace(line, "]]>", "]] >"); write(line, true, false); write("]]>", true); writeEndElement(); lineBreak(); } } catch (IOException e) { throw new RuntimeException("IOException: ", e); } break; case SinkActionContext.FIGURE_CAPTION: writeAddAttribute(ElementTags.ALT, text); break; case SinkActionContext.SECTION_TITLE: case SinkActionContext.SECTION_1: case SinkActionContext.SECTION_2: case SinkActionContext.SECTION_3: case SinkActionContext.SECTION_4: case SinkActionContext.SECTION_5: case SinkActionContext.FIGURE: case SinkActionContext.FIGURE_GRAPHICS: case SinkActionContext.TABLE_ROW: case SinkActionContext.TABLE: case SinkActionContext.HEAD: case SinkActionContext.UNDEFINED: break; case SinkActionContext.ANCHOR: anchorDefined = true; case SinkActionContext.PARAGRAPH: case SinkActionContext.LINK: case SinkActionContext.TABLE_CELL: case SinkActionContext.TABLE_HEADER_CELL: case SinkActionContext.DEFINITION: case SinkActionContext.DEFINED_TERM: case SinkActionContext.NUMBERED_LIST_ITEM: case SinkActionContext.LIST_ITEM: case SinkActionContext.SECTION_TITLE_5: case SinkActionContext.SECTION_TITLE_4: case SinkActionContext.SECTION_TITLE_3: case SinkActionContext.SECTION_TITLE_2: case SinkActionContext.SECTION_TITLE_1: default: writeStartElement(ElementTags.CHUNK); writeAddAttribute(ElementTags.FONT, font.getFontName()); writeAddAttribute(ElementTags.SIZE, font.getFontSize()); writeAddAttribute(ElementTags.STYLE, font.getFontStyle()); writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue()); writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen()); writeAddAttribute(ElementTags.RED, font.getFontColorRed()); write(text); writeEndElement(); // ElementTags.CHUNK } }