}
} else { // close tag found
if (!stack.isEmpty() && stack.peek().equalsIgnoreCase(matcher.group(4))) {
stack.pop();
} else {
throw new TubainaException("Tag " + matcher.group(4) + " closed unproperly");
}
}
}
if (!stack.isEmpty()) {
throw new TubainaException("There is(are) unclosed tag(s) : " + stack.toString());
}
if (chunkStart < 0) { // if item was not found
throw new TubainaException("There is no item inside a list tag on chapter " + Chapter.getChaptersCount());
// chunks.add(new ParagraphChunk(text));
// return "";
}
String textBefore = text.substring(0, chunkStart - 1).trim();
if (textBefore.length() > 0) {
throw new TubainaException("There is some inside a list tag, but outside an item on chapter "
+ Chapter.getChaptersCount());
// chunks.add(new ParagraphChunk(textBefore));
}
if (chunkEnd < 0) {