mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
fixed footnotes processing (do not trim footnotes if several paragraphs have ids)
This commit is contained in:
parent
8f5723782f
commit
1c04d1b5e5
2 changed files with 12 additions and 1 deletions
|
@ -37,6 +37,7 @@ FB2BookReader::FB2BookReader(BookModel &model) : myModelReader(model) {
|
||||||
mySectionDepth = 0;
|
mySectionDepth = 0;
|
||||||
myBodyCounter = 0;
|
myBodyCounter = 0;
|
||||||
myReadMainText = false;
|
myReadMainText = false;
|
||||||
|
myFootnoteTagDepth = 0;
|
||||||
myCurrentImageStart = -1;
|
myCurrentImageStart = -1;
|
||||||
mySectionStarted = false;
|
mySectionStarted = false;
|
||||||
myInsideTitle = false;
|
myInsideTitle = false;
|
||||||
|
@ -64,10 +65,15 @@ bool FB2BookReader::processNamespaces() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
|
void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
|
||||||
|
if (!myReadMainText && myFootnoteTagDepth > 0) {
|
||||||
|
++myFootnoteTagDepth;
|
||||||
|
}
|
||||||
|
|
||||||
const char *id = attributeValue(xmlattributes, "id");
|
const char *id = attributeValue(xmlattributes, "id");
|
||||||
if (id != 0 && tag != _BINARY) {
|
if (id != 0 && tag != _BINARY) {
|
||||||
if (!myReadMainText) {
|
if (!myReadMainText && myFootnoteTagDepth == 0) {
|
||||||
myModelReader.setFootnoteTextModel(id);
|
myModelReader.setFootnoteTextModel(id);
|
||||||
|
myFootnoteTagDepth = 1;
|
||||||
}
|
}
|
||||||
myModelReader.addHyperlinkLabel(id);
|
myModelReader.addHyperlinkLabel(id);
|
||||||
}
|
}
|
||||||
|
@ -255,6 +261,10 @@ void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FB2BookReader::endElementHandler(int tag) {
|
void FB2BookReader::endElementHandler(int tag) {
|
||||||
|
if (!myReadMainText && myFootnoteTagDepth > 0) {
|
||||||
|
--myFootnoteTagDepth;
|
||||||
|
}
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case _P:
|
case _P:
|
||||||
case _LI:
|
case _LI:
|
||||||
|
|
|
@ -40,6 +40,7 @@ private:
|
||||||
int mySectionDepth;
|
int mySectionDepth;
|
||||||
int myBodyCounter;
|
int myBodyCounter;
|
||||||
bool myReadMainText;
|
bool myReadMainText;
|
||||||
|
int myFootnoteTagDepth;
|
||||||
bool myInsideCoverpage;
|
bool myInsideCoverpage;
|
||||||
std::size_t myParagraphsBeforeBodyNumber;
|
std::size_t myParagraphsBeforeBodyNumber;
|
||||||
std::string myCoverImageReference;
|
std::string myCoverImageReference;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue