@Throws(javax.swing.text.BadLocationException::class, IOException::class) protected fun emptyTag(elem: Element) { if (!inContent && !inPre) { indentSmart() } val attr: AttributeSet = elem.getAttributes() closeOutUnwantedEmbeddedTags(attr) writeEmbeddedTags(attr) if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.CONTENT)) { inContent = true text(elem) } else if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.COMMENT)) { comment(elem) } else { val isBlock: Boolean = isBlockTag(elem.getAttributes()) if (inContent && isBlock) { writeLineSeparator() indentSmart() } val nameTag: Any? = if (attr != null) attr.getAttribute(javax.swing.text.StyleConstants.NameAttribute) else null val endTag: Any? = if (attr != null) attr.getAttribute(javax.swing.text.html.HTML.Attribute.ENDTAG) else null var outputEndTag = false if (nameTag != null && endTag != null && endTag is String && endTag == "true") { outputEndTag = true } if (completeDoc && matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.HEAD)) { if (outputEndTag) { writeStyles((getDocument() as HTMLDocument).getStyleSheet()) } wroteHead = true } write('<') if (outputEndTag) { write('/') } write(elem.getName()) writeAttributes(attr) write('>') if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.TITLE) && !outputEndTag) { val doc: Document = elem.getDocument() val title = doc.getProperty(Document.TitleProperty) as String write(title) } else if (!inContent || isBlock) { writeLineSeparator() if (isBlock && inContent) { indentSmart() } } } }
Writes out all empty elements ( all tags that have no corresponding end tag ) .