mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
fixed ToC processing
This commit is contained in:
parent
f2e3ec218b
commit
49d3f2bfe5
4 changed files with 16 additions and 7 deletions
|
@ -349,12 +349,7 @@ void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlatt
|
|||
if (link[0] == '#') {
|
||||
link = reader.myReferenceAlias + link;
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
link = reader.normalizedReference(reader.myReferenceDirName + link);
|
||||
}
|
||||
}
|
||||
myHyperlinkStack.push(hyperlinkType);
|
||||
|
@ -687,6 +682,15 @@ bool XHTMLReader::processNamespaces() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
const std::string XHTMLReader::normalizedReference(const std::string &reference) const {
|
||||
const size_t index = reference.find('#');
|
||||
if (index == std::string::npos) {
|
||||
return fileAlias(reference);
|
||||
} else {
|
||||
return fileAlias(reference.substr(0, index)) + reference.substr(index);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &XHTMLReader::fileAlias(const std::string &fileName) const {
|
||||
std::map<std::string,std::string>::const_iterator it = myFileNumbers.find(fileName);
|
||||
if (it != myFileNumbers.end()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue