diff --git a/zim.cc b/zim.cc index 048317db..d30d7d72 100644 --- a/zim.cc +++ b/zim.cc @@ -600,24 +600,24 @@ string ZimDictionary::convert( const string & in ) text.replace( QRegExp( "<\\s*body\\s*([^>]*)background:([^;\"]*)" ), QString( "]*)src=(\"|)/" ), + text.replace( QRegExp( "<\\s*(img|script)\\s*([^>]*)src=(\"|)(\\.\\.|)/" ), QString( "<\\1 \\2src=\\3bres://%1/").arg( getId().c_str() ) ); // Fix links without '"' - text.replace( QRegExp( "href=/([^\\s>]+)" ), QString( "href=\"/\\1\"" ) ); + text.replace( QRegExp( "href=(\\.\\.|)/([^\\s>]+)" ), QString( "href=\"\\1/\\2\"" ) ); - text.replace( QRegExp( "<\\s*link\\s*([^>]*)href=\"/" ), + text.replace( QRegExp( "<\\s*link\\s*([^>]*)href=\"(\\.\\.|)/" ), QString( "]*)href=\"/[^\"]*\"\\s*title=\"([^\"]*)\"", + QRegExp linkRegexp1( "<\\s*a\\s*([^>]*)href=\"(?!(http(s|)|ftp)://)(/|)[^\"]*\"\\s*title=\"([^\"]*)\"", Qt::CaseSensitive, QRegExp::RegExp2 ); - QRegExp linkRegexp2( "<\\s*a\\s*([^>]*)href=\"/A/([^\"]*)\"", + QRegExp linkRegexp2( "<\\s*a\\s*([^>]*)href=\"(\\.\\.|)/A/([^\"]*)\"", Qt::CaseSensitive, QRegExp::RegExp2 ); - QRegExp linkRegexp3( ".(s|)htm(l|)", Qt::CaseInsensitive ); + QRegExp linkRegexp3( "\\.(s|)htm(l|)", Qt::CaseInsensitive ); int pos = 0; while( pos >= 0 ) @@ -629,7 +629,7 @@ string ZimDictionary::convert( const string & in ) QStringList list = linkRegexp1.capturedTexts(); QString tag = QString( "