Am 04.07.2012 11:12, wrote Manuel Holtgrewe: > Dear all, > > I would like to write a plugin that does the following: > > 1. Provide a Macro [[NarrowPage()]] that marks the current Wiki page as > "narrow". > 2. A ITemplateStreamFilter Component that looks for a "narrow" mark on > the current page and adds a "narrow" class to div#content. > > I have already figured out how to do (2) but I have so far not found a > way for the Macro to communicate with the ITemplateStreamFilter. > > Is this possible at all?
You could attach an additional req.args['narrow'] to formatter.req on macro execution time, that should be available later on in req object passed in filter_stream method. But I see, that using Request object is or at least is planned to be depreciated according to the wiki docs [1]. So a more sustainable way leaving the req alone would be to add a minimal, unique HTML snipped like <div id="narrow_marker"></div> and create a matching XPATH filter like xpath_match = "//div[@id='narrow_marker']" to * find it (and possibly remove it) * finally add the 'narrow' class to div#content as you already know how to do by a secondary filter expression, that should be triggered by the first one. Sincerely, Steffen Hoffmann [1] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.wiki.api.IWikiMacroProvider#Usage
smime.p7s
Description: S/MIME Cryptographic Signature