#14 better rule tracking

open
nobody
5
2006-04-02
2006-04-02
Anonymous
No

I just started playing with middleman. It looks great, very robust and flexible.

However I can't find any way to show which rules are applied to a given page and in what order. There are url commands to show filters, profiles, and mime rules, but nothing to show the rewrite rules applied to a page. I've been through all the documentation, but maybe I missed something.

The only way to get this information seems to be to go through the list of profiles used on a url and manually match them to the corresponding rewrite rules. Needless to say, this is tedious and error-prone.

I'd expect to see a url command that shows the rewrites to a page in the order they are applied. Something like rewrites..foo.com. The output would look similar to the mman rewrite config page: a series of rules shown in the order they're applied to that page.

Rewrites which aren't used on that page wouldn't be shown so the enabled field doesn't need to be shown. The up/down and top/bottom links can also be removed (since presumably they owuld be useless), and the edit/delete links could be enabled only for users with permission to alter the rule. It would also be nice if the profile names that triggered each rule were shown.

Here's a rough mock-up of the output I envision from rewrites..foo.com:

3 rules applied to this page

Rules from profile: mask-referrer
---------------------------------
Comment prevent scripts from seeing referrer
MIME type text/html
Pattern (<script.*)document\.referrer(.*</script>)
Replace $1"nevermind"$2
Applies to ,,body,
Edit Delete

Comment prevent javascript's from seeing referrer
MIME type application/x-javascript
Pattern document\.referrer
Replace "nevermind"
Applies to ,,body,
Edit Delete

Rules from profile: anti-window-altering
----------------------------------------
Comment ensure new windows are resizable
MIME type text/html
Pattern (<a\s+href[^>]+)resizable=['"]?(no|0|false)['"]?(.*>)
Replace $1resizable="1"$3
Applies to ,,body,
Edit Delete

Discussion