diff src/converter.cpp @ 56:5410f9f279ea

Redefine question pattern to be more robust We now assume that a question begins after two empty lines.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 09 Aug 2016 09:59:16 +0200
parents aaaf8cdbc85c
children 4d65e654abf7
line wrap: on
line diff
--- a/src/converter.cpp	Wed Jul 20 16:57:52 2016 +0200
+++ b/src/converter.cpp	Tue Aug 09 09:59:16 2016 +0200
@@ -180,12 +180,13 @@
     QRegularExpression choiceEx(CHOICE_PATTERN);
     QRegularExpression choiceAltEx(CHOICE_UNFILLED_PATTERN);
     QRegularExpression freetxtEx(FREETXT_PATTERN);
+    QRegularExpression firstQuestionEx(FIRST_QUESTION_PATTERN);
 
     input.replace("\r\n", "\n");
     input.replace("\n\r", "\n");
     input.replace("#NAME?\n", "");
 
-    QRegularExpressionMatch match = questionEx.match(input);
+    QRegularExpressionMatch match = firstQuestionEx.match(input);
     bool foundSomething = false;
     int cursor = match.capturedEnd();
     while (match.hasMatch() && cursor != -1) {
@@ -227,7 +228,7 @@
                 html << mChoiceTextStyle.arg(choiceName.toHtmlEscaped());
                 qDebug() << "Captured for choice: " << choiceMatch.captured(0);
                 bool ok;
-                const QString percentStr = choiceMatch.captured("percent");
+                QString percentStr = choiceMatch.captured("percent");
                 double percent;
                 if (percentStr.isNull()) {
                     percent = 0;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)