XDXF: Fix handling of "revision" attribute and "iref" tag

This commit is contained in:
Abs62 2015-07-07 18:02:06 +03:00
parent 1387a8b5bd
commit 043a10cc98
2 changed files with 10 additions and 2 deletions

View file

@ -38,6 +38,7 @@
#include <QDir>
#include <QPainter>
#include <QDebug>
#include <QRegExp>
#include <QSemaphore>
#include <QThreadPool>
@ -1208,7 +1209,10 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
idxHeader.langTo = LangCoder::findIdForLanguageCode3( str.c_str() );
bool isLogical = ( stream.attributes().value( "format" ) == "logical" );
idxHeader.revisionNumber = stream.attributes().value( "revision" ).toString().toUInt();
QRegExp regNum( "\\d+" );
regNum.indexIn( stream.attributes().value( "revision" ).toString() );
idxHeader.revisionNumber = regNum.cap().toUInt();
idxHeader.articleFormat = isLogical ? Logical : Visual;

View file

@ -310,8 +310,12 @@ string convert( string const & in, DICT_TYPE type, map < string, string > const
{
QDomElement el = nodes.at( 0 ).toElement();
QString ref = el.attribute( "href" );
if( ref.isEmpty() )
ref = el.text();
el.setAttribute( "href", ref );
el.setTagName( "a" );
el.setAttribute( "href", el.text() );
}
// Abbreviations