3liz / qgis-pgmetadata-plugin

QGIS Plugin to manage some metadata from PostgreSQL layer
GNU General Public License v2.0
12 stars 10 forks source link

Some backslashes in links to files on Windows get mangled #115

Closed effjot closed 2 years ago

effjot commented 2 years ago

I’d like to put links to local Windows files (e.g. PDFs for further documentation) in the metadata. However, some (not all) backslashes in the path get removed. It seems to happen if a backslash precedes a number.

Gustry commented 2 years ago

Can you share some screenshots/example ? (source in the form versus HTML output ?)

effjot commented 2 years ago

I’ve already identified the culprit. The substitions strings for regexp_replace() can refer to subexpressions in the match pattern by \1 … \9.

You can have a look at https://github.com/effjot/qgis-pgmetadata-plugin/commit/3291e10521004fb3dfb0d0f853e36f63a911b230 If you like, I could prepare a PR tomorrow.

effjot commented 2 years ago

Also, I think the regexes could be simplified, as the capturing groups (round parentheses) and non-greedy quantifiers don’t seem to be necessary:

concat('\[% *"*', item.col, '"* *%\]')

Or even

concat('\[% *"?', item.col, '"? *%\]')

(assuming there should be at maximum one quote around the item).