From 043a10cc98fccc31200a876a0fbf74c36f91f360 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Tue, 7 Jul 2015 18:02:06 +0300 Subject: [PATCH] XDXF: Fix handling of "revision" attribute and "iref" tag --- xdxf.cc | 6 +++++- xdxf2html.cc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xdxf.cc b/xdxf.cc index dc90e58f..dd718910 100644 --- a/xdxf.cc +++ b/xdxf.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -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; diff --git a/xdxf2html.cc b/xdxf2html.cc index 21f8a6ea..24d2605d 100644 --- a/xdxf2html.cc +++ b/xdxf2html.cc @@ -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