1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

* Some incorrect FB2 files support (li/i/b tags, href attributes with no namespace and with unknown namespace ids)

This commit is contained in:
Nikolay Pultsin 2013-02-17 03:38:57 +04:00
parent 9e771a22ed
commit ccfdf0cf04
6 changed files with 46 additions and 1 deletions

View file

@ -80,6 +80,16 @@ void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
}
myModelReader.beginParagraph();
break;
case _LI:
{
if (mySectionStarted) {
mySectionStarted = false;
}
myModelReader.beginParagraph();
static const std::string BULLET_NBSP = "\xE2\x80\xA2\xC0\xA0";
myModelReader.addData(BULLET_NBSP);
break;
}
case _V:
myModelReader.pushKind(VERSE);
myModelReader.beginParagraph();
@ -163,6 +173,9 @@ void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
case _A:
{
const char *ref = attributeValue(xmlattributes, myHrefPredicate);
if (ref == 0) {
ref = attributeValue(xmlattributes, myBrokenHrefPredicate);
}
if (ref != 0) {
if (ref[0] == '#') {
const char *type = attributeValue(xmlattributes, "type");
@ -186,6 +199,9 @@ void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
case _IMAGE:
{
const char *ref = attributeValue(xmlattributes, myHrefPredicate);
if (ref == 0) {
ref = attributeValue(xmlattributes, myBrokenHrefPredicate);
}
const char *vOffset = attributeValue(xmlattributes, "voffset");
char offset = (vOffset != 0) ? atoi(vOffset) : 0;
if ((ref != 0) && (*ref == '#')) {
@ -232,6 +248,7 @@ void FB2BookReader::startElementHandler(int tag, const char **xmlattributes) {
void FB2BookReader::endElementHandler(int tag) {
switch (tag) {
case _P:
case _LI:
myModelReader.endParagraph();
break;
case _V: