@Override
 public void endHeader(int level, WikiParameters params) {
   if (toc != null) {
     if (mark == -1) {
       throw new IllegalStateException("marker was not set");
     }
     toc.tail.title = writer.getBuffer().substring(mark);
     mark = -1;
     print("</a>");
     super.endHeader(level, params);
   } else {
     super.endHeader(level, params);
   }
   endElement();
 }
 @Override
 public void beginHeader(int level, WikiParameters params) {
   beginElement();
   super.beginHeader(level, params);
   if (toc != null) {
     String id = toc.addHeading(null, level); // we don't know the title yet
     print("<a name=\"heading_" + id + "\">");
     mark = writer.getBuffer().length();
   }
 }
 @Override
 public void endPropertyBlock(String propertyUri, boolean doc) {
   endElement();
   if (propertyUri.startsWith("block:")) {
     writer = writer.getParent();
     if (writer == null) {
       throw new IllegalStateException("block macro underflow");
     }
   } else {
     super.endPropertyBlock(propertyUri, doc);
   }
 }
 @Override
 public void beginPropertyBlock(String propertyUri, boolean doc) {
   beginElement();
   if (propertyUri.startsWith("block:")) {
     String name = propertyUri.substring(6);
     WikiBlockWriter bwriter = new WikiBlockWriter(writer, name);
     writer.writeText(bwriter);
     writer = bwriter;
   } else {
     super.beginPropertyBlock(propertyUri, doc);
   }
 }
 @Override
 public void endQuotation(WikiParameters params) {
   endElement();
   super.endQuotation(params);
 }
 @Override
 public void beginTableRow(WikiParameters params) {
   beginElement();
   super.beginTableRow(params);
 }
 @Override
 public void onNewLine() {
   flushWords();
   super.onNewLine();
 }
 @Override
 public void onVerbatimBlock(String str) {
   flushWords();
   super.onVerbatimBlock(str);
 }
 @Override
 public void onReference(String ref, boolean explicitLink) {
   flushWords();
   super.onReference(ref, explicitLink);
 }
 @Override
 public void onHorizontalLine() {
   flushWords();
   super.onHorizontalLine();
 }
 @Override
 public void endTableRow(WikiParameters params) {
   endElement();
   super.endTableRow(params);
 }
 @Override
 public void beginQuotationLine() {
   beginElement();
   super.beginQuotationLine();
 }
 @Override
 public void endFormat(WikiFormat format) {
   endElement();
   super.endFormat(format);
 }
 @Override
 public void endDocument() {
   endElement();
   super.endDocument();
 }
 @Override
 public void endDefinitionTerm() {
   endElement();
   super.endDefinitionTerm();
 }
 @Override
 public void endDefinitionList(WikiParameters parameters) {
   endElement();
   super.endDefinitionList(parameters);
 }
 @Override
 public void endDefinitionDescription() {
   endElement();
   super.endDefinitionDescription();
 }
 @Override
 public void endQuotationLine() {
   endElement();
   super.endQuotationLine();
 }
 @Override
 public void endTableCell(boolean tableHead, WikiParameters params) {
   endElement();
   super.endTableCell(tableHead, params);
 }
 @Override
 public void endInfoBlock(char infoType, WikiParameters params) {
   endElement();
   super.endInfoBlock(infoType, params);
 }
 @Override
 public void onEmptyLines(int count) {
   flushWords();
   super.onEmptyLines(count);
 }
 @Override
 public void endList(WikiParameters parameters, boolean ordered) {
   endElement();
   super.endList(parameters, ordered);
 }
 @Override
 public void onLineBreak() {
   flushWords();
   super.onLineBreak();
 }
 @Override
 public void endListItem() {
   endElement();
   super.endListItem();
 }
 @Override
 public void onTableCaption(String str) {
   flushWords();
   super.onTableCaption(str);
 }
 @Override
 public void endParagraph(WikiParameters params) {
   endElement();
   super.endParagraph(params);
 }
 @Override
 public void onVerbatimInline(String str) {
   flushWords();
   super.onVerbatimInline(str);
 }
 @Override
 public void endPropertyInline(String inlineProperty) {
   endElement();
   super.endPropertyInline(inlineProperty);
 }
 @Override
 public void onEscape(String str) {
   flushWords();
   super.onEscape(str);
 }
 @Override
 public void beginTableCell(boolean tableHead, WikiParameters params) {
   beginElement();
   super.beginTableCell(tableHead, params);
 }