@Override public void charactersUnescaped(String literal) { ensureOpenTopic(); // note: this *may* have HTML tags in it writer.writeLiteral(literal); }
@Override public void characters(String text) { ensureOpenTopic(); super.characters(text); }
@Override public void entityReference(String entity) { ensureOpenTopic(); if (entity.startsWith("#")) { //$NON-NLS-1$ String numeric = entity.substring(1); int base = 10; if (numeric.startsWith("x")) { //$NON-NLS-1$ numeric = entity.substring(1); base = 16; } int unicodeValue = Integer.parseInt(numeric, base); if (entityReferenceToUnicode.contains(unicodeValue)) { writer.writeCharacters("" + ((char) unicodeValue)); //$NON-NLS-1$ return; } } writer.writeEntityRef(entity); }
@Override public void acronym(String text, String definition) { ensureOpenTopic(); // TODO: definition? according to DITA 1.1 'term' is the right thing to use here, however DITA 1.1 has no provision for a glossary. // we may want to look at reference/refbody/simpletable to generate a glossary writer.writeStartElement("term"); //$NON-NLS-1$ characters(text); writer.writeEndElement(); }
@Override public void link(Attributes attributes, String hrefOrHashName, String text) { ensureOpenTopic(); writer.writeStartElement("xref"); //$NON-NLS-1$ writer.writeAttribute("href", computeDitaXref(hrefOrHashName)); //$NON-NLS-1$ if (text != null) { characters(text); } writer.writeEndElement(); }
@Override public void imageLink(Attributes linkAttributes, Attributes imageAttributes, String href, String imageUrl) { ensureOpenTopic(); writer.writeStartElement("xref"); //$NON-NLS-1$ writer.writeAttribute("href", computeDitaXref(href)); //$NON-NLS-1$ writer.writeAttribute("format", "html"); //$NON-NLS-1$ //$NON-NLS-2$ image(imageAttributes, imageUrl); writer.writeEndElement(); }
@Override public void image(Attributes attributes, String url) { ensureOpenTopic(); boolean emitAsFigure = attributes.getTitle() != null; if (emitAsFigure) { writer.writeStartElement("fig"); //$NON-NLS-1$ writer.writeStartElement("title");//$NON-NLS-1$ writer.writeCharacters(attributes.getTitle()); writer.writeEndElement(); } writer.writeEmptyElement("image"); //$NON-NLS-1$ writer.writeAttribute("href", url); //$NON-NLS-1$ applyImageAttributes(attributes); if (emitAsFigure) { writer.writeEndElement(); } }
@Override public void beginBlock(BlockType type, Attributes attributes) { ensureOpenTopic();
@Override public void beginSpan(SpanType type, Attributes attributes) { ensureOpenTopic(); switch (type) { case BOLD: