Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Can macros and ITemplateStreamFilters communicate?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Manuel Holtgrewe  
View profile  
 More options Jul 4 2012, 5:12 am
From: Manuel Holtgrewe <zyklenf...@gmail.com>
Date: Wed, 4 Jul 2012 02:12:08 -0700 (PDT)
Local: Wed, Jul 4 2012 5:12 am
Subject: Can macros and ITemplateStreamFilters communicate?

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?

Cheers,
Manuel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steffen Hoffmann  
View profile  
 More options Jul 4 2012, 7:34 pm
From: Steffen Hoffmann <hoff...@web.de>
Date: Thu, 05 Jul 2012 01:34:04 +0200
Local: Wed, Jul 4 2012 7:34 pm
Subject: Re: [Trac-dev] Can macros and ITemplateStreamFilters communicate?

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/ExtensionPoin...

  smime.p7s
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RjOllos  
View profile  
 More options Jul 4 2012, 8:44 pm
From: RjOllos <ry...@physiosonics.com>
Date: Wed, 4 Jul 2012 17:44:05 -0700 (PDT)
Local: Wed, Jul 4 2012 8:44 pm
Subject: Re: Can macros and ITemplateStreamFilters communicate?

I think that Steffen's suggestion is correct if you are to continue
implementing this by working with ITemplateStreamFilter.

However, I did some experimenting, and from the simple description you
provided and assuming you don't need to do something more complex, I think
this can be implemented without messing with ITemplateStreamFilter. You can
just make a macro that returnd an empty string, and add a stylesheet to the
page in `expand_macro`.

I took that approach in the attached example plugin. It allows
[[NarrowContent]] to be added to the page, and results in:

<https://lh6.googleusercontent.com/-Bz2flnWHNHA/T_TjNUasj8I/AAAAAAAAAX...>

  narrowmacro.zip
2K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Manuel Holtgrewe  
View profile  
 More options Jul 5 2012, 4:13 am
From: Manuel Holtgrewe <zyklenf...@gmail.com>
Date: Thu, 5 Jul 2012 01:13:58 -0700 (PDT)
Local: Thurs, Jul 5 2012 4:13 am
Subject: Re: Can macros and ITemplateStreamFilters communicate?

Thanks to both of you! This solves my problem.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RjOllos  
View profile  
 More options Jul 21 2012, 3:27 pm
From: RjOllos <ry...@physiosonics.com>
Date: Sat, 21 Jul 2012 12:27:56 -0700 (PDT)
Local: Sat, Jul 21 2012 3:27 pm
Subject: Re: Can macros and ITemplateStreamFilters communicate?

On Thursday, July 5, 2012 4:13:58 AM UTC-4, Manuel Holtgrewe wrote:

> Thanks to both of you! This solves my problem.

I came across #10626 (1) today, which points to (2), which has little
button that narrows/expands the widths of the page content. Thought it
might be interesting to you.

(1) http://trac.edgewall.org/ticket/10626
(2) http://code.optaros.com/trac/oforge/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »