Skip to content

Commit

Permalink
#106: Issue a warning message when inline content is used in a toc-en…
Browse files Browse the repository at this point in the history
…try element.
  • Loading branch information
PaulRambags committed Oct 14, 2019
1 parent f94d4dd commit 4ff3feb
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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()) {
Expand Down

0 comments on commit 4ff3feb

Please sign in to comment.