it worked beatifully -- many thanks!!!

I'll try and submit that to trac-hacks,
for the benefit of future users.

the py code deployment is trivial,
just not sure how to deploy the css.
manually I had to modify templates/
site.html, then htdocs/site.css --
how could I do this without breaking
the existing user settings?

It might be easier to just insert
the style sheet info in the .py
and generate it on the fly...




On Tue, Sep 3, 2013 at 3:15 PM, Peter Suter <[email protected]> wrote:

> I would propose an alternative approach. Do not put the {{{...}}} into the
> stored wiki page. (Then you don't have to worry about reversing all the
> effects that this has.) Instead write a plugin that only puts the {{{...}}}
> into the wiki page when it is prepared for display.
>
> I think this can be done with the IWikiPageManipulator.
> http://trac.edgewall.org/wiki/**TracDev/PluginDevelopment/**
> ExtensionPoints/trac.wiki.api.**IWikiPageManipulator<http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.wiki.api.IWikiPageManipulator>
>
> You would have to come up with a different trick to specify which wiki
> pages should be handled in this way. For example you could use a special
> naming scheme, like a special ".txt" ending.
>
> That plugin could also add a special CSS class (e.g. class="dottxt") by
> wrapping the page in {{{#!div class="dottxt" ... }}}.
> http://trac.edgewall.org/wiki/**WikiHtml#HowtoUseDivSpan<http://trac.edgewall.org/wiki/WikiHtml#HowtoUseDivSpan>
>
> The entire thing could then look like this:
>
> {{{
> from trac.core import *
> from trac.wiki.api import IWikiPageManipulator
>
> class PlainTextWikiPagePreparer(**Component):
>
>     implements(**IWikiPageManipulator)
>
>     # A custom CSS class name that can be used for styling
>     CSS_CLASSNAME = 'dottxt'
>
>     def prepare_wiki_page(self, req, page, fields):
>         if self._is_special_page(page):
>             fields['text'] = self._escape_wikitext(page.**text)
>
>     def validate_wiki_page(self, req, page):
>         return []
>
>     def _is_special_page(self, page):
>         """Should the page be treated as special pre-formatted plain text?
>         For example, let's treat all wiki pages ending in .txt special.
>         """
>         return page.name.endswith('.txt')
>
>     def _escape_wikitext(self, wikitext):
>         """Return the escaped wikitext of a pre-formatted plain text.
>         For example, let's wrap the entire thing in {{{...}}}.
>         """
>         return '{{{#!div class="' + self.CSS_CLASSNAME + '"\n{{{\n' +
> wikitext + '\n}}}\n}}}'
> }}}
>
> You could put this - without the {{{ }}} - into a single file plugin in
> your plugins folder. Or extend it to a full plugin including the custom CSS.
> http://trac.edgewall.org/wiki/**TracPlugins#/dropped<http://trac.edgewall.org/wiki/TracPlugins#/dropped>
>
> ---
> Peter
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Trac Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/trac-users/Kh6Rm2s_n9A/**unsubscribe<https://groups.google.com/d/topic/trac-users/Kh6Rm2s_n9A/unsubscribe>
> .
> To unsubscribe from this group and all its topics, send an email to
> trac-users+unsubscribe@**googlegroups.com<trac-users%[email protected]>
> .
> To post to this group, send email to [email protected].
> Visit this group at 
> http://groups.google.com/**group/trac-users<http://groups.google.com/group/trac-users>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to