Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#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 Alec Thomas)

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 18 years ago by Alec Thomas

Description: modified (diff)

comment:2 Changed 18 years ago by Noah Kantrowitz

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.

comment:3 Changed 18 years ago by Alec Thomas

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 18 years ago by Noah Kantrowitz

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 18 years ago by John Hampton

Status: newassigned

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_installable)

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 18 years ago by Alec Thomas

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 18 years ago by Noah Kantrowitz

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 18 years ago by John Hampton

Resolution: fixed
Status: assignedclosed

(In [742]) * Fixed macro_blacklist option. Thanks alect for helping me see my obvious error. Closes #332

comment:9 Changed 18 years ago by John Hampton

I didn't bother implementing wildcards. If it becomes that usefull then I'll think about revisiting the issue.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.