add missing tr to header generated by map_to_html_table expression function

This commit is contained in:
uclaros 2024-05-09 12:45:49 +03:00 committed by Nyall Dawson
parent c22c31cf62
commit 03f967848c
3 changed files with 4 additions and 4 deletions

View File

@ -8,8 +8,8 @@
"description": "the input map"
}],
"examples": [{
"expression": "map_to_html_table(map('qgis','rocks'))",
"returns": "<table><thead><th>qgis</th></thead><tbody><tr><td>rocks</td></tr></tbody></table>"
"expression": "map_to_html_table(map('1','one','2','two'))",
"returns": "<table><thead><tr><th>1</th><th>2</th></tr></thead><tbody><tr><td>one</td><td>two</td></tr></tbody></table>"
}],
"tags": ["formatted", "map", "html"]
}

View File

@ -1901,7 +1901,7 @@ static QVariant fcnMapToHtmlTable( const QVariantList &values, const QgsExpressi
QString table { R"html(
<table>
<thead>
<th>%1</th>
<tr><th>%1</th></tr>
</thead>
<tbody>
<tr><td>%2</td></tr>

View File

@ -1750,7 +1750,7 @@ class TestQgsExpression: public QObject
QTest::newRow( "array_replace (map)" ) << "array_replace(array('APP','SHOULD','ROCK'),map('APP','QGIS','SHOULD','DOES'))" << false << QVariant( QVariantList() << "QGIS" << "DOES" << "ROCK" );
// map HTML formatting
QTest::newRow( "map_to_html_table (map)" ) << "map_to_html_table(map('APP','QGIS','<SHOULD>','DOES'))" << false << QVariant( "\n <table>\n <thead>\n <th>&lt;SHOULD&gt;</th><th>APP</th>\n </thead>\n <tbody>\n <tr><td>DOES</td><td>QGIS</td></tr>\n </tbody>\n </table>" );
QTest::newRow( "map_to_html_table (map)" ) << "map_to_html_table(map('APP','QGIS','<SHOULD>','DOES'))" << false << QVariant( "\n <table>\n <thead>\n <tr><th>&lt;SHOULD&gt;</th><th>APP</th></tr>\n </thead>\n <tbody>\n <tr><td>DOES</td><td>QGIS</td></tr>\n </tbody>\n </table>" );
QTest::newRow( "map_to_html_dl (map)" ) << "map_to_html_dl(map('APP','QGIS','<SHOULD>','DOES'))" << false << QVariant( "\n <dl>\n <dt>&lt;SHOULD&gt;</dt><dd>DOES</dd><dt>APP</dt><dd>QGIS</dd>\n </dl>" );
//fuzzy matching