On 12/20/12, Olemis Lang <[email protected]> wrote:
> On 12/20/12, Gary Martin <[email protected]> wrote:
>>
> [...]
>>
>> Olemis: if you think that another solution is to use the oneliner wiki
>> formatter, could you test that assumption?
>
> I'll do , just give me a few minutes please ... ;)
>
My quick research
{{{
#!py
>>> wikitext = r"""Wiki text with ...
...
...
[[Image(https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png)]]
...
... ... and more ..."""
>>> from bhdashboard.util import dummy_request
>>> from trac.env import open_environment
>>> env = open_environment('/path/to/trac/env')
>>> env._abs_href = lambda : 'http://example.org/bh/'
>>> req = dummy_request(env)
>>> from trac.web.chrome import web_context
>>> ctx = web_context(req)
>>> from trac.wiki import format_to_oneliner, format_to_html
>>> print format_to_html(env, ctx, wikitext)
<p>
Wiki text with ...
</p>
<p>
<a style="padding:0; border:none"
href="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"><img
src="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
alt="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
title="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
/></a>
</p>
<p>
... and more ...
</p>
>>> print format_to_oneliner(env, ctx, wikitext)
Wiki text with ...
<a style="padding:0; border:none"
href="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"><img
src="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
alt="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
title="https://issues.apache.org/bloodhound/raw-attachment/wiki/Proposals/BEP-0003/Product_envs_small.png"
/></a>
... and more …
>>> print format_to_oneliner(env, ctx, wikitext, shorten=True)
Wiki text with ...
…
>>>
}}}
>> If it is not quite right, it
>> sounds like we could create another wiki formatter.
>
> yes it's possible ,
of course , if the previous example is not enough then we can develop
oour own wiki formatter .
> and afaicr wiki style may be specified in the
> rendering context too ...
>
These are the context hints I was talking about ;)
context.get_hint('shorten_lines', False)
context.get_hint('wiki_flavor', 'oneliner')
>> I expect that the
>> oneliner formatter would be in use when abbreviated_messages is
>> specified in the timeline section of the configuration.
>>
>
> I'll try to check that too .
>
timeline.abbreviated_messages works in Trac timeline view like the
last example I pasted above . Not the same in the widget .
IMO we should add a new parameter to the widget and include support
for abbreviated_messages ;)
All this seems to be a matter of setting context hints ;)
--
Regards,
Olemis.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Featured article: