logo separator

[mkgmap-dev] Bug in subst

From Steve Ratcliffe steve at parabola.me.uk on Wed May 28 14:31:22 BST 2014

On 28/05/14 07:45, Colin Smale wrote:
> name=* & highway=* {set name='${name|subst:^(Doctor|Dokter) ~>Dr }'}
>
> then mkgmap crashes while loading the style files. After doing various
> tests my conclusion is that it is triggered by the "|" in the pattern. I
> tried escaping it with a backslash but it didn't change anything.

OK thanks for reporting this.  Yes it simply splits the value on
the '|' characters, so breaking up the argument.

Fixing this in a way that is backward compatible may be a bit tricky.
We will need to explicitly quote the argument in some way.

We could use:
	${name|subst:"^(Doctor|Dokter) ~>Dr "}

or:
	${name|subst("^(Doctor|Dokter) ~>Dr ")}

I think for backward compatibility we will have to include spaces
in unquoted arguments, since that is a very common occurrence in
existing styles.

The current syntax is similar to the syntax used for template filters
in django, and the first option above is how arguments are quoted in
django.

The second option is how the same problem is solved in the jinja2
template filters.

..Steve


More information about the mkgmap-dev mailing list