Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#332 closed enhancement (fixed)

Configurable blacklist of macros in blog summary

Reported by: athomas Owned by: pacopablo
Priority: lowest Component: TracBlogPlugin
Severity: trivial Keywords:
Cc: Trac Release: 0.9

Description (last modified by athomas)

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 9 years ago by athomas

  • Description modified (diff)

comment:2 Changed 9 years ago by coderanger

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 9 years ago by athomas

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 9 years ago by coderanger

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 9 years ago by pacopablo

  • Status changed from new to 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_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 9 years ago by athomas

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 9 years ago by coderanger

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 9 years ago by pacopablo

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:9 Changed 9 years ago by pacopablo

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

Add Comment

Modify Ticket

Action
as closed The owner will remain pacopablo.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.