26 views

### Franz

Oct 27, 2011, 3:27:27 AM10/27/11
to Trac Development
Hi,

when I edit some Wiki page or ticket in Trac like this:
= The [[span(Sandbox, style=background-color: yellow)]] =

the output is as following:
The [[span(...)]]

When trying
[[span(= The Sandbox =, style=background-color: yellow)]]
it outputs (with yellow background)
= The Sandbox =

It should however print the text "Sandbox" with yellow background
(which works with other wiki formats).

Is this behavior a (known) bug? Or was the span macro not intended for

Thanks,
Franz

### Christian Boos

Oct 27, 2011, 5:43:46 PM10/27/11

It's a known limitation, yes. We currently have no way to express that
we expect inline content ''only'' from a macro. So I think that we need
to expand the API a bit, for example by adding an `is_inline` method on
the macro providers. That way we could only expand the macros which give
us the guarantee to produce inline content.

Ok, so here's a patch that implements this. It also illustrates how a
macro can sometimes produce inline content, sometimes not (here the
TicketQueryMacro, producing inline content for the count and compact
format). In addition, if a macro wants to adapt its generated content to
the current expected output, it could look at the type of the formatter.
But in general it should be the other way round: the macro generates
some content, and the formatter adapts to it.

-- Christian

0001-wiki-macros-can-declare-that-they-produce-inline-con.patch

### Christian Boos

Jan 3, 2012, 5:39:10 PM1/3/12
On 10/27/2011 11:43 PM, Christian Boos wrote:
> On 10/27/2011 9:27 AM, Franz wrote:
>> Hi,
>>
>> when I edit some Wiki page or ticket in Trac like this:
>> = The [[span(Sandbox, style=background-color: yellow)]] =
>>
...

>> Is this behavior a (known) bug? Or was the span macro not intended for
>
> It's a known limitation, yes. ...

>
> Ok, so here's a patch that implements this. It also illustrates how a
> macro can sometimes produce inline content, sometimes not (here the
> TicketQueryMacro, producing inline content for the count and compact
> format). In addition, if a macro wants to adapt its generated content to
> the current expected output, it could look at the type of the formatter.
> But in general it should be the other way round: the macro generates
> some content, and the formatter adapts to it.
>

Btw, I still have the corresponding patch series aging on my laptop...
and I'd like to commit that. OK?

-- Christian

### Remy Blank

Jan 3, 2012, 6:16:32 PM1/3/12
Christian Boos wrote:
> Btw, I still have the corresponding patch series aging on my laptop...
> and I'd like to commit that. OK?

Looks good on a quick scan.

-- Remy

signature.asc

### Franz

Jan 17, 2012, 8:56:31 AM1/17/12
to Trac Development
Hi,

I tried with Trac 0.13dev-r10909 the following Wiki and worked
flawlessly (also highlighting in PageOutline-macro):
= [[span(Sandbox, style=background-color: yellow)]] =

Thanks,
Franz