1 Oct 19:16 2006

### Using reporter observer pattern in a writer


While I was working on implementing a writer for Docutils ...  The
Writer/Translator design seems very powerful and has been very
useful to me, especially as I learn and understand it better.

So, I have a question (or two) ...

The translator (in my case, a subclass of nodes.GenericNodeVisitor)
has a document attribute, which has a reporter attribute.  The
reporter supports 'a modified form of the "Observer" pattern'.
When I attach an observer (a method), I find that it receives as
its argument an instance of class nodes.system_message.  How do I
use this system_message object?

- One thing that I want to be able to use in my observer method is
the current node.  I can't find it.  Is it in the system_message
object someplace?

- The system_message object has a tagname attribute.  But, that
seems to always return "system_message".  I was hoping for the
name of the current node.

- How would I write an observer method that prints out just the
name of the current node?  Ditto for the name of the current
visit_/depart_ method.  The system_message object has a string
representation that contains this information, and I suppose I
could parse that.  But, I suspect that is not the way this object
was intended to be used.

This observer and system_message thing seems very ingenious.  It


3 Oct 09:36 2006

I'm the author of UliPad, and I use ReST to write documents of UliPad,
and I see that FTE editor began to support ReST highlight, and I also
want to support it. And I'v finished some tech research, and already
finished some highlight funcationality, and I also want to implement
some more support, so I want to ask if anybody will be interesting in this.
to have a test. You can find the url from my signature.

How to make a ReST file syntax highlight
===============================

1. the filename suffix should be .rst

2. if the suffix isnot .rst, so you can choose [Document]->[Syntax
Highlight], then choose rst.

3. If you have many files need to be highlighted, and the suffix of
the filenames is not .txt, so you can write a "_project" file in the
directory, and the content could be:

[highlight]
.txt = rst

so all the files with .txt suffix in the directory and its
subdirectories will be auto apply rst highlight. This will be very
handy.

Auto apply ReST hightlight to txt file
============================



1 Oct 21:35 2006

### nabu blog related to python and docutils

Hello rst users,

I have setup an RSS feed with my presentation layer for my Nabu
datastore (for those not familiar with Nabu, it is a system I made to
automatically identify and extract information from text files using
rest and docutils).  For those interested, the following RSS URL will
track the Python and docutils entries from it:

(for the curious: one of the nabu extractors interprets the :Tags:
bibliographic field from the source documents.  Each tag gets a
corresponding index.  All I have to do to publish is... write a silly
little text file in reStructuredText format, and commit it to my
subversion server.  It then gets published automatically (there is a
svn hook that runs the new files through Nabu asynchyronously).  It
only looks like a blog because I support a date field and the indexes
sort by date... behind this public view lies much more content, I have
a variety of access levels, for friends, etc., the public view only
offers a small set of the documents, and not really enough to showcase
all the features of the presentation layer, but it's a start, see
http://furius.ca/nabu/ for more details, I will write a document about
Nabu's addition to reStructuredText to support detecting photos,
movies, books, contact info etc.)

cheers,

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your


1 Oct 16:27 2006

### UliPad will support ReST syntax highlight

I'm the author of UliPad, and I use ReST to write documents of UliPad,
and I see that FPE editor began to support ReST highlight, and I also
want to support. And I'v finished some tech research, and already
finished some highlight funcationality, and I also want to implement
some support, so I want to ask if anybody will be interesting in this.
to have a test. You can find the url from my signature.

How to make a ReST file syntax highlight
===============================

1. the filename suffix should be .rst

2. if the suffix isnot .rst, so you can choose [Document]->[Syntax
Highlight], then choose rst.

3. If you have many files need to be highlighted, and the suffix of
the filenames is not .txt, so you can write a "_project" file in the
directory, and the content could be:

[highlight]
.txt = rst

so all the files with .txt suffix in the directory and its
subdirectories will be auto apply rst highlight. This will be very
handy.

Other features of UliPad can be used for ReST support
==========================================



4 Oct 15:01 2006

### Directive for syntax highlight


Hi all,

I am looking for a directive for syntax highlight, I have searched
from net and finally found here was some body had a solution using
SilverCity:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252170

But when I installed SilverCity and used the code provided in this
article, I got following error:

TypeError: expected sequence of 2 WordLists (1 provided)
Exiting due to error.  Use "--traceback" to diagnose.
Include "--traceback" output, Docutils version (0.4 [release]),
Python version (2.4.3), your OS type & version, and the
command line used.

Is here anybody has experience in this? or other way to implement
syntax highlight?

--

--
- Skull

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your


5 Oct 18:55 2006

### Re: Directive for syntax highlight

On 10/4/06, Skull <skull <at> tuyasoft.com> wrote:
> I am looking for a directive for syntax highlight, I have searched
> from net and finally found here was some body had a solution using
> SilverCity:
>
>     http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252170
>
> But when I installed SilverCity and used the code provided in this
> article, I got following error:
>
>     TypeError: expected sequence of 2 WordLists (1 provided)
>     Exiting due to error.  Use "--traceback" to diagnose.
>     Include "--traceback" output, Docutils version (0.4 [release]),
>     Python version (2.4.3), your OS type & version, and the
>     command line used.
>
> Is here anybody has experience in this? or other way to implement
> syntax highlight?

The first step would be to follow the instructions: use "--traceback"
to diagnose the problem. I don't know what "WordLists" are. Probably
that error originates with SilverCity. The SilverCity and/or Docutils
you are using may have changed since the cookbook recipe was written.

--

--
David Goodger <http://python.net/~goodger>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT


5 Oct 19:53 2006

### Re: Using reporter observer pattern in a writer

On 10/1/06, Dave Kuhlman <dkuhlman <at> rexx.com> wrote:
> While I was working on implementing a writer for Docutils ...  The
> Writer/Translator design seems very powerful and has been very
> useful to me, especially as I learn and understand it better.
>
> So, I have a question (or two) ...
>
> The translator (in my case, a subclass of nodes.GenericNodeVisitor)
> has a document attribute, which has a reporter attribute.  The
> reporter supports 'a modified form of the "Observer" pattern'.
> When I attach an observer (a method), I find that it receives as
> its argument an instance of class nodes.system_message.  How do I
> use this system_message object?

That observer pattern is used to keep track of system messages. The
Parser (docutils.parsers.Parser) keeps a list of system messages
generated while parsing, and the Transformer
(docutils.transforms.Transformer) keeps a list of system message
generated while applying transforms.

What do *you* want to do with it?

> - One thing that I want to be able to use in my observer method is
>   the current node.  I can't find it.  Is it in the system_message
>   object someplace?

No. Why do you need it?

> - The system_message object has a tagname attribute.  But, that
>   seems to always return "system_message".  I was hoping for the


5 Oct 21:36 2006

### Re: Directive for syntax highlight

On Wed, 4 Oct 2006, Skull wrote:

> I am looking for a directive for syntax highlight, I have searched
> from net and finally found here was some body had a solution using
> SilverCity:
[...]
> Is here anybody has experience in this? or other way to implement
> syntax highlight?

I have (unsupported) pure Python code that's does Python syntax
highlighting (but only Python -- no support for other languages or file
formats).  I think I probably started from the same Silvercity/docutils
code you're using, but I forget.

If you want the code, email me and I'll send it over (or more likely point
you at the SVN repo).

John

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

6 Oct 05:17 2006

### pdflatex problem

I am a user of rst2latex.
I have a problem with it and with rst2newlatex.

1. Both Acrobat and GhostView claim that the documents
produced by pdflatex are broken, when I run pdflatex on
documents produced by either of these LaTeX writers.
Unfortunately, the problem does not arise with simple
test files, so I have not isolated it.  Is anyone else
having this problem?  Here is the error message::

AFPL Ghostscript 8.51 (2005-04-18)
This software comes with NO WARRANTY: see the file PUBLIC for details.
Scanning PDF file
**** Error: Cannot find a %%EOF marker anywhere in the file.
**** Warning:  An error occurred while reading an XREF table.
**** The file has been damaged.  This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
Error: /typecheck in --lt--
Operand stack:
]   47993.0
Execution stack:
%interp_exit   .runexec2   --nostringval--
--nostringval--   --nostringval--   2   %stopped_push
--nostringval--   --nostringval--   false
1   %stopped_push   1   3   %oparray_pop
1   3   %oparray_pop   1   3   %oparray_pop
1   3   %oparray_pop   .runexec2   --nostringval--
--nostringval--   --nostringval--   2   %stopped_push


6 Oct 08:53 2006

### Re: pdflatex problem

On Thu, 5 Oct 2006, Alan G Isaac wrote:

> I am a user of rst2latex.
> I have a problem with it and with rst2newlatex.
>
> 1. Both Acrobat and GhostView claim that the documents
>   produced by pdflatex are broken, when I run pdflatex on
>   documents produced by either of these LaTeX writers.
>   Unfortunately, the problem does not arise with simple
>   test files, so I have not isolated it.  Is anyone else
>   having this problem?  Here is the error message::

if you send me the rst or latex file i will see to it.

> 2. So I switched to latex and dvipdfm.
>   This is a little problem because now I cannot use my PNG files.
>   But it is a bigger problem because of the lack of
>   a dvipdfm option.

that simply wasnt requested and i, being ignorant as i am, dont know of
it.

> 3. Neither rst2latex nor rst2newlatex have a dvipdfm option,
>   so I have to intervene manually.  No biggie in rst2latex:
>   if I just fix the hyperref options I'm pretty much good
>   to go.  But rst2newlatex works without the hyperref
>   package. (WHY??  It is great!  Cannot you improve it
>   rather than avoid it?)  So I see no way to use dvipdfm
>   and get my hyperlinks with rst2newlatex.
>