mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
reference shortening in ePubs; updated TODO
This commit is contained in:
parent
fbce4d979a
commit
b783fa99b9
3 changed files with 19 additions and 12 deletions
5
TODO.1.5
5
TODO.1.5
|
@ -8,13 +8,14 @@ litres: author photos
|
||||||
* <hr/> tag
|
* <hr/> tag
|
||||||
* the SJ book:
|
* the SJ book:
|
||||||
** empty pages at start (in emulator)
|
** empty pages at start (in emulator)
|
||||||
** hyperlinks (including button image)
|
DONE hyperlinks (including button image)
|
||||||
|
** TOC!!!
|
||||||
* Network library initialization in ProcessHyperlinkAction :(
|
* Network library initialization in ProcessHyperlinkAction :(
|
||||||
* "Use embedded fonts" option
|
* "Use embedded fonts" option
|
||||||
* "Scan hidden directories" option
|
* "Scan hidden directories" option
|
||||||
* ePub:
|
* ePub:
|
||||||
DONE reference resolver (Имя розы)
|
DONE reference resolver (Имя розы)
|
||||||
** reference shortening in native code (like java code shortening)
|
DONE reference shortening in native code (like java code shortening)
|
||||||
DONE large covers (cover mark for images in native code)
|
DONE large covers (cover mark for images in native code)
|
||||||
* "modes" for wallpapers: tile, fullscreen, etc.
|
* "modes" for wallpapers: tile, fullscreen, etc.
|
||||||
* zip: re-use open files
|
* zip: re-use open files
|
||||||
|
|
|
@ -346,10 +346,16 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
||||||
const FBTextKind hyperlinkType = MiscUtil::referenceType(href);
|
const FBTextKind hyperlinkType = MiscUtil::referenceType(href);
|
||||||
std::string link = MiscUtil::decodeHtmlURL(href);
|
std::string link = MiscUtil::decodeHtmlURL(href);
|
||||||
if (hyperlinkType == INTERNAL_HYPERLINK) {
|
if (hyperlinkType == INTERNAL_HYPERLINK) {
|
||||||
link = (link[0] == '#') ?
|
if (link[0] == '#') {
|
||||||
reader.myReferenceName + link :
|
link = reader.myReferenceAlias + link;
|
||||||
reader.myReferenceDirName + link;
|
} else {
|
||||||
link = ZLFileUtil::normalizeUnixPath(link);
|
const size_t index = link.find('#');
|
||||||
|
if (index == std::string::npos) {
|
||||||
|
link = reader.fileAlias(reader.myReferenceDirName + link);
|
||||||
|
} else {
|
||||||
|
link = reader.fileAlias(reader.myReferenceDirName + link.substr(0, index)) + link.substr(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
myHyperlinkStack.push(hyperlinkType);
|
myHyperlinkStack.push(hyperlinkType);
|
||||||
bookReader(reader).addHyperlinkControl(hyperlinkType, link);
|
bookReader(reader).addHyperlinkControl(hyperlinkType, link);
|
||||||
|
@ -359,7 +365,7 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
||||||
const char *name = reader.attributeValue(xmlattributes, "name");
|
const char *name = reader.attributeValue(xmlattributes, "name");
|
||||||
if (name != 0) {
|
if (name != 0) {
|
||||||
bookReader(reader).addHyperlinkLabel(
|
bookReader(reader).addHyperlinkLabel(
|
||||||
reader.myReferenceName + "#" + MiscUtil::decodeHtmlURL(name)
|
reader.myReferenceAlias + "#" + MiscUtil::decodeHtmlURL(name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,12 +494,12 @@ XHTMLReader::XHTMLReader(BookReader &modelReader) : myModelReader(modelReader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XHTMLReader::readFile(const ZLFile &file, const std::string &referenceName) {
|
bool XHTMLReader::readFile(const ZLFile &file, const std::string &referenceName) {
|
||||||
myModelReader.addHyperlinkLabel(referenceName);
|
|
||||||
|
|
||||||
fillTagTable();
|
fillTagTable();
|
||||||
|
|
||||||
myPathPrefix = MiscUtil::htmlDirectoryPrefix(file.path());
|
myPathPrefix = MiscUtil::htmlDirectoryPrefix(file.path());
|
||||||
myReferenceName = referenceName;
|
myReferenceAlias = fileAlias(referenceName);
|
||||||
|
myModelReader.addHyperlinkLabel(myReferenceAlias);
|
||||||
|
|
||||||
const int index = referenceName.rfind('/', referenceName.length() - 1);
|
const int index = referenceName.rfind('/', referenceName.length() - 1);
|
||||||
myReferenceDirName = referenceName.substr(0, index + 1);
|
myReferenceDirName = referenceName.substr(0, index + 1);
|
||||||
|
|
||||||
|
@ -528,7 +534,7 @@ void XHTMLReader::startElementHandler(const char *tag, const char **attributes)
|
||||||
static const std::string HASH = "#";
|
static const std::string HASH = "#";
|
||||||
const char *id = attributeValue(attributes, "id");
|
const char *id = attributeValue(attributes, "id");
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
myModelReader.addHyperlinkLabel(myReferenceName + HASH + id);
|
myModelReader.addHyperlinkLabel(myReferenceAlias + HASH + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string sTag = ZLUnicodeUtil::toLower(tag);
|
const std::string sTag = ZLUnicodeUtil::toLower(tag);
|
||||||
|
|
|
@ -82,7 +82,7 @@ private:
|
||||||
|
|
||||||
BookReader &myModelReader;
|
BookReader &myModelReader;
|
||||||
std::string myPathPrefix;
|
std::string myPathPrefix;
|
||||||
std::string myReferenceName;
|
std::string myReferenceAlias;
|
||||||
std::string myReferenceDirName;
|
std::string myReferenceDirName;
|
||||||
bool myPreformatted;
|
bool myPreformatted;
|
||||||
bool myNewParagraphInProgress;
|
bool myNewParagraphInProgress;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue