From 4ff3feb4c306e236eec68e61c0405d7767034002 Mon Sep 17 00:00:00 2001 From: Paul Rambags Date: Mon, 14 Oct 2019 13:27:57 +0200 Subject: [PATCH] #106: Issue a warning message when inline content is used in a toc-entry element. --- .../formatter/impl/obfl/ObflParserImpl.java | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java b/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java index a75e6677..9d284874 100644 --- a/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java +++ b/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java @@ -1193,12 +1193,16 @@ private void parseTocEntry(XMLEvent event, XMLEventIterator input, TableOfConten while (input.hasNext()) { event=input.nextEvent(); if (event.isCharacters()) { - tocEntryAddChars(toc, event, tp); + // TODO: deprecated (#106) - remove in a future version + logger.warning("the use of characters in a toc-entry element is deprecated, put them in the child toc-text element"); + toc.addChars(event.asCharacters().getData(), tp); } else if (equalsStart(event, ObflQName.TOC_TEXT)) { parseTocText(event, input, toc, tp); } else if (equalsStart(event, ObflQName.TOC_ENTRY)) { parseTocEntry(event, input, toc, tp); - } else if (tocEntryProcessAsBlockContents(toc, event, input, tp)) { + } else if (processAsBlockContents(toc, event, input, tp)) { + // TODO: deprecated (#106) - remove this if clause in a future version + logger.warning("the use of block contents in a toc-entry element is deprecated, put them in the child toc-text element"); //done! } else if (equalsEnd(event, ObflQName.TOC_ENTRY)) { @@ -1210,24 +1214,6 @@ else if (equalsEnd(event, ObflQName.TOC_ENTRY)) { } } - /** - * Adds characters from a toc-entry to the toc - * @deprecated the characters should be placed inside the toc-text element, see #106 - */ - @Deprecated - private void tocEntryAddChars(TableOfContents toc, XMLEvent event, TextProperties tp) { - toc.addChars(event.asCharacters().getData(), tp); - } - - /** - * Adds block contents from a toc-entry to the toc - * @deprecated the block contents should be placed inside the toc-text element, see #106 - */ - @Deprecated - private boolean tocEntryProcessAsBlockContents(TableOfContents toc, XMLEvent event, XMLEventIterator input, TextProperties tp) throws XMLStreamException { - return processAsBlockContents(toc, event, input, tp); - } - private void parseTocText(XMLEvent event, XMLEventIterator input, TableOfContents toc, TextProperties tp) throws XMLStreamException { tp = getTextProperties(event, tp); while (input.hasNext()) {