[IronPython] FlowDocument XAML syntax highlighting and restructured text

Harry Pierson Harry.Pierson at microsoft.com
Tue Aug 11 01:56:46 CEST 2009


Very cool Michael.

FYI, pygments runs in IronPython except for a but in their _automodule class in pygments/lexers/__init__.py (http://dev.pocoo.org/projects/pygments/browser/pygments/lexers/__init__.py). If you comment out the last 6 lines of lexers/__init__.py, pygments will run under IronPython, but without the lexer module automodule support. That means you have to write

from pygments.lexers.agile import PythonLexer

instead of

from pygments.lexers import PythonLexer

Dino assures me this bug is fixed and will be available in source "soon" - definitely by RC.

Harry

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Monday, August 10, 2009 4:35 PM
To: Discussion of IronPython
Subject: [IronPython] FlowDocument XAML syntax highlighting and restructured text

Hello all,

Just to let you know I've started a project to generate FlowDocument XAML from reStructuredText source. There is also a pygments formatter so that source code can be formatted.

The project, rst2xaml is at:

    http://code.google.com/p/rst2xaml/

So far it can cope with rest documents consisting of bold, italics, blockquotes and the sourcecode directive!

The pygments formatter looks quite nice though - here is the output shown in a FlowDocumentReader:

    http://twitpic.com/dfwu5

The goal is to be able to show highlighted Python examples / tutorials alongside an interactive interpreter in the browser with Silverlight / Moonlight.

Currently rst2xaml.py itself runs under CPython, but the xaml it generates is intended to be used from IronPython with WPF. There is an example script, display_xaml.py, that will show generated xaml in a window.

Michael

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list