[fbreader] Fixed FB2 footnotes
FB2 reader strips the leading hash sign from href, XHTML wasn't doing it. Unified their behavior.
This commit is contained in:
parent
02d86ffa67
commit
7a7067869d
2 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2017 Jolla Ltd.
|
* Copyright (C) 2015-2018 Jolla Ltd.
|
||||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
|
@ -956,19 +956,20 @@ void BooksPageWidget::onLongPressTaskDone()
|
||||||
}
|
}
|
||||||
} else if (task->iKind == FOOTNOTE) {
|
} else if (task->iKind == FOOTNOTE) {
|
||||||
if (iModel && task->iLink.length() > 0) {
|
if (iModel && task->iLink.length() > 0) {
|
||||||
std::string ref = task->iLink.substr(1);
|
shared_ptr<ZLTextModel> note = iModel->footnoteModel(task->iLink);
|
||||||
shared_ptr<ZLTextModel> note = iModel->footnoteModel(ref);
|
|
||||||
BooksBook* book = iModel->book();
|
BooksBook* book = iModel->book();
|
||||||
if (!note.isNull() && book) {
|
if (!note.isNull() && book) {
|
||||||
// Render the footnote
|
// Render the footnote
|
||||||
HDEBUG("footnote" << ref.c_str());
|
HDEBUG("footnote" << QString(task->iLink.c_str()));
|
||||||
if (iFootnoteTask) iFootnoteTask->release(this);
|
if (iFootnoteTask) iFootnoteTask->release(this);
|
||||||
iFootnoteTask = new FootnoteTask(task->iX, task->iY,
|
iFootnoteTask = new FootnoteTask(task->iX, task->iY,
|
||||||
width()*3/4, height()*10, book->path(), task->iLinkText,
|
width()*3/4, height()*10, book->path(), task->iLinkText,
|
||||||
QString::fromStdString(ref), note, iTextStyle,
|
QString::fromStdString(task->iLink), note, iTextStyle,
|
||||||
iSettings->invertColors());
|
iSettings->invertColors());
|
||||||
iTaskQueue->submit(iFootnoteTask, this,
|
iTaskQueue->submit(iFootnoteTask, this,
|
||||||
SLOT(onFootnoteTaskDone()));
|
SLOT(onFootnoteTaskDone()));
|
||||||
|
} else {
|
||||||
|
HDEBUG("bad footnote" << QString(task->iLink.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (task->iKind == IMAGE) {
|
} else if (task->iKind == IMAGE) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
||||||
* Copyright (C) 2016-2017 Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -341,7 +341,8 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
||||||
std::string link;
|
std::string link;
|
||||||
if (type && !strcmp(type, "noteref")) {
|
if (type && !strcmp(type, "noteref")) {
|
||||||
hyperlinkType = FOOTNOTE;
|
hyperlinkType = FOOTNOTE;
|
||||||
link = href;
|
link = MiscUtil::decodeHtmlURL(href);
|
||||||
|
if (link[0] == '#') link = link.substr(1);
|
||||||
} else {
|
} else {
|
||||||
hyperlinkType = MiscUtil::referenceType(href);
|
hyperlinkType = MiscUtil::referenceType(href);
|
||||||
link = MiscUtil::decodeHtmlURL(href);
|
link = MiscUtil::decodeHtmlURL(href);
|
||||||
|
|
Loading…
Reference in a new issue