[Trac] Why does Trac use SQLite for Wiki? | NEW MACRO !!

François Harvey fharvey at securiweb.net
Wed Aug 18 11:16:34 UTC 2004
ladies and gentleman !

now introducing a new fantastic macro

The " display wiki from svn  " macro !!!!

[[DisplayWikiFromSVN(doc/some_wiki_page)]]

(a very quick hack, only tested about simple wiki page)

Francois Harvey
SecuriWeb inc.


Mario Ruggier wrote:

> Nice... where would this macro be available from ;-?
>
> mario
>
>
> On Aug 18, 2004, at 2:22 PM, François Harvey wrote:
>
>> As a  work around what about a new macro
>>
>> [[Include(File or Wiki)FromSVN('/path/inside/subversion') ]]
>>
>> work for wiki page, but also for included some source code (ex sample 
>> or contrib) , doc, etc.
>>
>> Francois Harvey
>> SecuriWeb inc.
>>
-------------- next part --------------
from trac.core import open_svn_repos

import trac.WikiFormatter
import svn

def execute(hdf, txt, env):

    args = txt

    repos_dir = env.get_config('trac', 'repository_dir')
    pool, rep, fs_ptr = open_svn_repos(repos_dir)
    rev = svn.fs.youngest_rev(fs_ptr, pool)
    root = svn.fs.revision_root(fs_ptr, rev, pool)

    fd = svn.fs.file_contents(root, args, pool)
    read_func = lambda x, f=fd: svn.util.svn_stream_read(f, x)
    data = read_func(254*1024)

    return trac.WikiFormatter.wiki_to_html(data,hdf, env, 0)