qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.39k stars 2.98k forks source link

Inconsistent parsing/rendering of html tags in plugin metadata.txt #53320

Open AlisterH opened 1 year ago

AlisterH commented 1 year ago

What is the bug or the crash?

https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/plugins/releasing.html says "use the description field in metadata for a 1 line description, the About field for more detailed instructions" But if you try using multiple lines simply by including multiple lines of plain text, you will find that the plugin fails to load. You may conclude that multiple lines are not supported, and give up. Or, as I did with the Coverage Builder plugin, you may have noticed that some other plugin authors have used html tags, and try that, which seems to work for the installed plugin: image Unfortunately when the plugin is not installed, various html tags are either ignored and removed, or rendered as plain code in the plugin manager (although it looks like <p> tags are handled). Both of these behaviours make it harder to read, and you don't know what will happen to different tags unless you try them out! image

If you read this page you will find out that:

But html tags can be useful, for example for hyperlinking to a separate project that a plugin provides an interface to. Authors of plugins like "Value Tool" even include a donation button, and have worked out what html tags can be used without causing any readability problems.

Since html tags in metadata.txt are supported when a plugin is already installed, it would be nice if they were also supported for plugins that aren't installed (I note that html code is also supported in the plugin About page on https://plugins.qgis.org/)

But if this is not possible or desirable, feel free to close this ticket, and I'll go and make some suggestions to improve the documentation so that new plugin authors are less likely to have difficulty (saying something like "html tags can be used, however some tags will not be rendered when a plugin is not yet installed...") Is there any way of knowing which tags will be problematic, without experimenting with them?

Steps to reproduce the issue

Open the plugin manager and find and click on the Coverage Builder plugin. Install the Coverage Builder plugin. Observe how the html tags are rendered when the plugin is installed, but not when it is not installed.

Versions

QGIS version 3.30.2-'s-Hertogenbosch QGIS code revision 0992b533973 Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.7.0 PROJ version 9.2.0 EPSG Registry database version v10.082 (2023-02-06) GEOS version 3.11.2-CAPI-1.17.2 SQLite version 3.41.1 PDAL version 2.5.3 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.13.1 OS version Windows 10 Version 2009

Active Python plugins annotationManager 0.5 annotation_labels 1.0.1 AnotherDXF2Shape 1.2.7 changeDataSource 3.1 civilplan 1.0 Equal_area_slope_QGIS_Plugin 0.1 file_management 0.1 FlowEstimator 0.21 geometry_paster 0.2 joinmultiplelines Version 0.4.1 LayerBoard 1.0.1 layout_panel-main 0.3 MemoryLayerSaver 4.0.4 nominatim 1.4.5 pathfinder version 0.4.2 plugin_reloader 0.9.3 precisioncursor4qgis-main 0.2E QCopycanvas 0.7 qgis_resource_sharing 1.0.0 quick_map_services 0.19.33 StyleLoadSave 1.0 switch_active_layer 0.1 valuetool 3.0.15 workbench 0.0.4 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

No response

agiudiceandrea commented 1 year ago

@AlisterH, it seems to me the different rendering of the About field content containing HTML code between installed and not installed plugin may be due to some issue in the plugin repository server code which "rewrites" the About field text.

E.g. for the "Coverage builder" plugin, the About field in metadata.txt contains the following text: This is an updated version of the &quot;Grids for Atlas&quot; plugin, previously published by:<p align="center">Experts SIG / <a href="https://www.biotope.fr/">Biotope</a><br/>Bertrand Chaussat<br/>Dmitry Kiselev</p> while the About field for the same plugin returned by the Plugin repository server in the plugins.xml document contains the following text:

<![CDATA[This is an updated version of the &amp;quot;Grids for Atlas&amp;quot; plugin, previously published by:
Experts SIG / &lt;a href=&quot;https://www.biotope.fr/&quot;&gt;Biotope&lt;/a&gt;
Bertrand Chaussat
Dmitry Kiselev]]>