wiki:TracWikiToHtmlConverterScript

Version 3 (modified by coldpizza, 7 years ago) (diff)

--

Convert tracwiki markup to HTML

Description

Converts tracwiki markup to HTML. Originally posted by Erik Bray on http://groups.google.com/group/trac-dev/msg/479decac43883dc0

Bugs/Feature Requests

Existing bugs and feature requests for TracWikiToHtmlConverterScript are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:tracwikitohtmlconverterscript here].

Source

You can check out TracWikiToHtmlConverterScript from here using Subversion, or browse the source with Trac.

Example

#!/usr/bin/env python
# found on trac google group:
# Originally posted by Erik Bray on http://groups.google.com/group/trac-dev/browse_thread/thread/2c97c6c514487778?q=#msg_479decac43883dc0

import sys
from trac.test import EnvironmentStub, Mock, MockPerm
from trac.mimeview import Context
from trac.wiki.formatter import HtmlFormatter
from trac.web.href import Href

env = EnvironmentStub()
req = Mock(href=Href('/'), abs_href=Href('http://www.example.com/'),
           authname='anonymous', perm=MockPerm(), args={})
context = Context.from_request(req, 'wiki')

wiki = '= Trac Wiki to HTML conversion demo ='

print HtmlFormatter(env, context, wiki).generate()

Recent Changes

4990 by coldpizza on 2008-12-09 11:52:59
tests for trac2html conversion
4988 by coldpizza on 2008-12-09 11:25:59
a variation which can read a file name from command line and outputs HTML to the console, attaches standard Trac CSS and adds HTML header/footer blocks
4986 by coldpizza on 2008-12-09 11:21:45
tracwiki to html conversion script
(more)

Author/Contributors

Author: coldpizza?
Contributors: