ikiwiki/doc/bugs/pagespec_can__39__t_match__...

45 lines
1.5 KiB
Plaintext
Raw Normal View History

2009-05-18 06:55:45 +02:00
I want match pages which have actually curly braces in the names (like this one), but this matches a lot of pages without the braces in their names :( :
2009-05-18 12:44:07 +02:00
[[!inline show="3" feeds="no" archive="yes" pages="*_{*}_*"]]
2009-05-18 12:39:36 +02:00
(note: the inline above has been restricted to 3 matches to keep this page
concise. Hopefully it is still clear that this page is not in the output set,
and the 3 pages in the output set do not contain curly braces in their
titles).
2009-05-18 06:55:45 +02:00
When escaped, it doesn't work at all:
2009-05-18 12:44:07 +02:00
[[!inline show="3" feeds="no" archive="yes" pages="*_\{*}_*"]]
2009-05-18 12:39:36 +02:00
2009-05-18 12:44:07 +02:00
[[!inline show="3" feeds="no" archive="yes" pages="*_{*\}_*"]]
2009-05-18 12:39:36 +02:00
More tests:
"\*{\*":
2009-05-18 12:44:07 +02:00
[[!inline show="3" feeds="no" archive="yes" pages="*{*"]]
2009-05-18 12:39:36 +02:00
2009-05-18 12:42:16 +02:00
"\*\\{\*":
2009-05-18 12:39:36 +02:00
2009-05-18 12:44:07 +02:00
[[!inline show="3" feeds="no" archive="yes" pages="*\{*"]]
2009-05-18 12:39:36 +02:00
2009-05-18 21:08:49 +02:00
> This is due to the current handling of quoting and escaping issues
> when converting a pagespec to perl code. `safequote` is used to
> safely quote an input string as a `q{}` quote, and it strips
> curlies when doing so to avoid one being used to break out of the `q{}`.
>
> Alternative ways to handle it would be:
2009-05-18 21:30:27 +02:00
>
2009-05-18 21:08:49 +02:00
> * Escape curlies. But then you have to deal with backslashes
> in the user's input as they could try to defeat your escaping.
> Gets tricky.
2009-05-18 21:30:27 +02:00
>
2009-05-18 21:08:49 +02:00
> * Avoid exposing user input to interpolation as a string. One
> way that comes to mind is to have a local string lookup hash,
> and insert each user specified string into it, then use the hash
> to lookup the specified strings at runtime. [[done]]
2009-05-18 21:08:49 +02:00
>
> --[[Joey]]
2009-05-18 21:46:57 +02:00
Thank you! I'll try it. --Ivan Z.