After giving it some thought, I think filters would be something like this:
@bus
@inside=yes
@ref~^1[0-9][0-9][^0-9]*$
# data goes here...
@@
This allows any arbitrary filter, using any properties that are available in the catalog that was previously built. Filters of @field=value
require an exact match, while filters of @field~regex
would use Python’s re for regex. By putting each filter on a separate line, I avoid having to deal with delimiting, quoting, escaping, and all that nonsense.
Later, it would be pretty easy to separate the “building the catalog from GTFS data” part from the “filling the template with the data from the catalog” part. This would make it possible to adapt to other GTFS feeds, without needing to maintain separate versions of the template filling script.
The structure of the catalog right now is a bit too specially-crafted for Israel’s feed for now, but that’ll be easy to change so that it’s more fit for being adapted to other feeds.
Unrelatedly, the script name “ptnaGenerate.py” is very much a placeholder, I’m open to suggestions for a better name