currentParagraph.add(chunk);
currentReference = "#" + ref;
if (settings().enableTOCPageNum) {
currentParagraph.add(new Chunk(new DottedLineSeparator()));
addPageNumTemplate(settings().tocPageNumFormat);
}
addElement(currentParagraph);
currentReference = null;