#332 closed enhancement (fixed)
Configurable blacklist of macros in blog summary
Reported by: | Alec Thomas | Owned by: | John Hampton |
---|---|---|---|
Priority: | lowest | Component: | TracBlogPlugin |
Severity: | trivial | Keywords: | |
Cc: | Trac Release: | 0.9 |
Description (last modified by )
It'd be nice to have a default set of macros that are blacklisted from the blog summary, and also have it configurable. Something like:
blacklist = PageOutline, TOC, AddComment
Or maybe wildcards are a possibility?
I think a bit of regex magic would be sufficient.
Attachments (0)
Change History (9)
comment:1 Changed 19 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 19 years ago by
comment:3 Changed 19 years ago by
Yes, I understand that, but I don't think it's reasonable to expect all macros to be updated when an easier solution is to just regexp the calls out. PageOutline
is a good example, being built into Trac
comment:4 Changed 19 years ago by
The problem is that it is a more general problem than just with the Blog system. Doing something like this will work for the blog, but other than lots of copy+paste silliness, no other plugins can use it. Also there are some macros where it might be advantageous for the macro to still render, only differently. For example, AddComment could output "Please click here to comment", with a link to the page.
comment:5 Changed 19 years ago by
Status: | new → assigned |
---|
I'm not averse to adding this feature, however,
- I agree with coderanger in that this isn't the ideal solution
- I've got very poor regex-foo
As far as it not being useful for other plugins beyond "copy+paste silliness", I think it might make sense to create a PluginUtilsPlugin that includes useful pieces of code for other plugins. Originally we can include:
- tags macro args parsing
- blog and toc NoFloatFormatter
- macro blacklist
Once 0.10 comes out with the plugin dependency resoultion, requiring the plugin would be simple (now if only we can figure out how to make the plugins easy_install
able)
Also, if someone might be able to point me in the direction of a regex to accomplish the blacklisting task, I would greatly appreciate it.
comment:6 Changed 19 years ago by
Something like:
r'\[\[.*?\]\]'
Should be sufficient. It doesn't handle macro args containing double ]]
, but I don't think I've ever seen that used before anyway.
comment:7 Changed 19 years ago by
You wouldn't do this as a regex, it would be better implemented as part of the formatter. Just check the macro name before invoking it.
comment:8 Changed 19 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:9 Changed 19 years ago by
I didn't bother implementing wildcards. If it becomes that usefull then I'll think about revisiting the issue.
This is already done via the NoFloatFormatter. Any macro that sees req.no_float exists should not create any floating divs (either by producing nothing or by having a different output style.