Trent W. Buck | 1 Dec 2008 01:30
Picon

Re: Help wanted to better understand nodes.Node.walk, and solving some issues

"Leo" <fhaxbox66 <at> googlemail.com> writes:
> I am in the very first experimental stage of developing a writer for
> Braille printing.

I have some interest in accessibility issues, and I'd like a definition
of the problem you're trying to code for.  I assume you're talking about
embossing onto paper rather than a piezo-based braille tty.

What advantages would a "native" writer have over using the HTML writer
and printing it as you would a web page?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Goodger | 1 Dec 2008 02:35
Favicon

Re: Help wanted to better understand nodes.Node.walk, and solving some issues

On Sun, Nov 30, 2008 at 16:22, Leo <fhaxbox66 <at> googlemail.com> wrote:
> I am in the very first experimental stage of developing a writer for Braille
> printing. However, I am afraid of getting bogged down on some subtle issue.
> And as I am fairly new to docutils and only a seasoned programmer, I thought
> I'd better ask the friendly docutils community for help.
>
> Here is my first attempt to get acquainted with the - excellent -
> architecture of docutils:

I guess your code is just experimental, in which case the
questions/comments below the code don't apply.

> class Writer(docutils.writers.Writer):
>     def __init__(self):
>         docutils.writers.Writer.__init__(self)

This __init__ method isn't necessary if you don't have any further code.

>     def translate(self):
>         self.visitor = BrailleVisitor(self.document)
>         self.document.walk(self.visitor)
>         self.output = " "
>
>
> class BrailleVisitor(NodeVisitor):
>     def __init__(self, document):
>         NodeVisitor.__init__(self, document)

Also not necessary.

(Continue reading)

Leo | 1 Dec 2008 22:07

Re: Help wanted to better understand nodes.Node.walk, and solving some issues

Thank you very much for these first comments. The whole thing is attached, including the output file. I
don't know right now how to redirect traceback info when executing python myscript.py from the shell. So I
refer to my earlier description of what happens:

> The script then exits with an AttributeError as walk doesn't stop at the end
> of the tree. Rather, it passes None to the dispatcher which calls
> unknown_visit. The latter then tries to access a non-existing settings
> attribute of None.

Your help is very much appreciated. There is in fact no high-quality cross-platform open source solution
for preparing text documents for Braille printing. I consider this a shame because commercial software
in this area is hugely expensive as luckily the audience is limited. And the expenses are often born by the
tax payer or some charity. More importantly, I believe that an RSt based Braille production tool chain
with multilingual contraction tables would really be a must-use in this field, because unlike a number of
proprietary software it would be open to all kinds of mixed notations such as for music, math, chemistry
etc. Perhaps I should mention that the Braille system is based on combinations of six dots per character to
represent all this, so it uses all kinds of what technical people would probably call escape sequences.

Yes, the prints in the visit methods are just for debugging purposes. So nothing in these code lines is close
to production. But once I'm on track, I guess it would be easy to work through the different node types,
implement formatting features maybe by adding some rst directives, style sheets etc. So I guess I'll want
to get back to you or the docutils list from time to time when stumbling over problems I cannot sort out on my own.

There is another more advanced project called yabt (Yet another Braille translator). It is maintained by
someone else . Its goal is to provide a rules-based text manipulation tool powerful enough to efficiently
perform translation of natural text into the language-specific Braille notation which contains a lot of
contractions to save paper and increase reading speed. rst2brl will use yabt extensively. 

By the way, I'm not a complete novice. My first and so far only project is a hyphenator for Python:
http://pypi.python.org/pypi/PyHyphen. The rst2pdf folks use it in connection with Wordaxe to
(Continue reading)

Leo | 1 Dec 2008 22:16

Re: Help wanted to better understand nodes.Node.walk, and solving some issues

I've just learned how to redirect stderr to something else using the 2> operator. So here is the transcript.

------------------------
Thank you very much for these first comments. The whole thing is attached, including the output file. I
don't know right now how to redirect traceback info when executing python myscript.py from the shell. So I
refer to my earlier description of what happens:

> The script then exits with an AttributeError as walk doesn't stop at the end
> of the tree. Rather, it passes None to the dispatcher which calls
> unknown_visit. The latter then tries to access a non-existing settings
> attribute of None.

Your help is very much appreciated. There is in fact no high-quality cross-platform open source solution
for preparing text documents for Braille printing. I consider this a shame because commercial software
in this area is hugely expensive as luckily the audience is limited. And the expenses are often born by the
tax payer or some charity. More importantly, I believe that an RSt based Braille production tool chain
with multilingual contraction tables would really be a must-use in this field, because unlike a number of
proprietary software it would be open to all kinds of mixed notations such as for music, math, chemistry
etc. Perhaps I should mention that the Braille system is based on combinations of six dots per character to
represent all this, so it uses all kinds of what technical people would probably call escape sequences.

Yes, the prints in the visit methods are just for debugging purposes. So nothing in these code lines is close
to production. But once I'm on track, I guess it would be easy to work through the different node types,
implement formatting features maybe by adding some rst directives, style sheets etc. So I guess I'll want
to get back to you or the docutils list from time to time when stumbling over problems I cannot sort out on my own.

There is another more advanced project called yabt (Yet another Braille translator). It is maintained by
someone else . Its goal is to provide a rules-based text manipulation tool powerful enough to efficiently
perform translation of natural text into the language-specific Braille notation which contains a lot of
contractions to save paper and increase reading speed. rst2brl will use yabt extensively. 
(Continue reading)

Stefan Merten | 1 Dec 2008 21:46
Picon
Favicon

rst2beamer (was: Re: LaTeX stylesheet survey)


Hi!

Last week (7 days ago) Stefan Merten wrote:
> I'm currently working on a `rst2beamer` converter producing LaTeX
> Beamer PDFs. At the moment it is a subclass of the `latex2e` writer.
> I'll commit something into the sandbox soon.

A first version is now available under

	sandbox/rst2beamer

It does what I wanted in the first place - including dropping handout
classed paragraphs for a start.

Meanwhile I took a look in the documentation of LaTeX Beamer
[file:///usr/share/doc/latex-beamer/beameruserguide.pdf.gz on Debian
based systems]. Wow, this is even more awesome than I thought... I
guess I will add more features now and then.

						Grüße

						Stefan
David Goodger | 2 Dec 2008 15:30
Favicon

Re: Idea: Connecting paragraphs in reStructuredText

On Fri, Nov 28, 2008 at 09:56, Guenter Milde <milde <at> users.berlios.de> wrote:
> First step: accept comma-separated list of stylesheets for
> --stylesheet and --stylesheet path.

I think that may be all that is necessary. Adding search-path
processing is an example of YAGNI (you ain't gonna need it), IMO.

> The patch passes the existing functional test (i.e. nothing is changed as
> long as there is only one stylesheet argument) and produces valid html
> with several stylesheets with both, embedded or linked sheets.
>
> The implementation would be somewhat simpler, if
> utils.get_stylesheet_reference returned a list. However, joining it to a
> string keeps backwards compatibility (in case other writers use this util
> fun).

Why not add a new function,
"docutils.utils.get_stylesheet_references", which has that API? Then
replace the usage where appropriate. This will avoid
incompatibilities. We could mark the original deprecated, or even
remove it, but there's no harm in leaving it in. There may be
3rd-party code that relies on the old behavior.

Actually, the best thing might be to add a validator function to
docutils.frontend (like "validate_comma_separated_string_list"), and
define the options in terms of a list ('action': 'append'). There's
already a docutils.frontend.validate_colon_separated_string_list
function, used by the expose_internals setting
(--expose-internal-attributes option); see how those are used.

(Continue reading)

Scott Meyers | 2 Dec 2008 18:49
Favicon

Newbie Questions: reST vs LaTeX

[Apologies if this appears twice.  I tried posting via gmane nearly 12 hours ago, but nothing has appeared,
so I'm trying email this time.]

I'm getting ready to write a new book, and just when I thought my likely choice of LaTeX over DocBook had
settled the matter of what to use, I was pointed to reST, which, not being a Python programmer, I'd not heard
of.  I've now looked at some examples and played around with DocUtils a bit, and while some things look
easier in reST than in LaTeX, I was unable to find out how to create tables with cell contents that are
centered horizontally and vertically.  In fact, googling around for information on how to center text in
general yielded nothing, although I did see that there is a "center" alignment attribute that can be
applied to images and figures.  (The word "center" does not appear on <http://docutils.sourceforge.net/docs/user/rst/quickref.html>http://docutils.sourceforge.net/docs/us
 er/rst/quickref.html,
<http://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt>http://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt,
or <http://docutils.sourceforge.net/rst.html>http://docutils.sourceforge.net/rst.html.) 

This leads to a specific question and a general question.  The specific question is:  how do I center the
contents of a table cell in reST?  The general question is:  where can I find a summary of how reST and LaTeX
compare to one another in terms of expressive power?  I've used LaTeX before, and I'm pretty sure you can do
anything you want with it, although possibly with considerable pain. Documents like 
<http://docs.python.org/library/multiprocessing.html>http://docs.python.org/library/multiprocessing.html
demonstrate that reST can also do a lot, but my inability to quickly find a way to center text in a table cell
makes me a little nervous, and reST vs. LaTeX comparisons aren't easy to come by. 

It's perhaps worth noting that I plan to write the book with both paper and electronic publication in mind,
and in the realm of electronic publication, I want to be able to support output devices with different
sizes, aspect ratios, and capabilities, e.g., possibly without color capability (e.g., Kindle),
possibly quite small (e.g., iPhone), possibly a large computer monitor with extensive color
facilities).  I should also mention that the book is likely to include very few code samples, so the ability
to format code is not a particularly big concern for me. 

Thanks for any help and insights you can offer. 
(Continue reading)

m h | 2 Dec 2008 19:15
Picon

Re: Newbie Questions: reST vs LaTeX

Hey Scott-

On Tue, Dec 2, 2008 at 10:49 AM, Scott Meyers <smeyers <at> aristeia.com> wrote:
> [Apologies if this appears twice.  I tried posting via gmane nearly 12 hours ago, but nothing has appeared,
so I'm trying email this time.]
snip snip
>
> This leads to a specific question and a general question.  The specific question is:  how do I center the
contents of a table cell in reST?  The general question is:  where can I find a summary of how reST and LaTeX
compare to one another in terms of expressive power?  I've used LaTeX before, and I'm pretty sure you can do
anything you want with it, although possibly with considerable pain. Documents like 
<http://docs.python.org/library/multiprocessing.html>http://docs.python.org/library/multiprocessing.html
demonstrate that reST can also do a lot, but my inability to quickly find a way to center text in a table cell
makes me a little nervous, and reST vs. LaTeX comparisons aren't easy to come by.
>

First off I'll say that I haven't messed with tables much in reST.
But I have written (a couple now) rst2odp tools (convert rst to
openoffice impress (aka powerpoint)) now, so I can give you my
perspective.  Formatting is somewhat limited in pure reST.  This is
both good and bad.  Good in that the plain text files are nice to look
at (unlike say XML or LaTex....), but this limits the formatting.  Of
course you can put center class attributes and hope that the backend
does the right* thing (where right is right for what you had in mind,
which hopefully meshes with what the developer of that backend thought
as well ;)).

I'm just guessing here (since the only stuff I've done with reST and
tex is my resume), but I'm going to assume that you'll probably need
to hack the backend a bit so it tweaks the table output to your
(Continue reading)

David Goodger | 2 Dec 2008 19:25
Favicon

Re: Newbie Questions: reST vs LaTeX

On Tue, Dec 2, 2008 at 12:49, Scott Meyers <smeyers <at> aristeia.com> wrote:
> This leads to a specific question and a general question.  The
> specific question is: how do I center the contents of a table
> cell in reST?

In general, formatting is done via classes and stylesheets.  People
are working on adding generic support for class attributes in LaTeX;
I'll let someone else talk about that.

Right now there is no way to specify a class for a single cell or row
or column in a table.  You can put a class on a whole table easily,
but not a portion.  I am working on extending the "class" directive to
allow that, but no ETA.

You can put a class on a paragraph or other body element (including a
"container", which can hold multiple body elements).

> The general question is: where can I find a summary of how reST and
> LaTeX compare to one another in terms of expressive power?

In terms of expressive power, LaTex > reST.  In terms of readability
and convenience, reST > LaTeX.  Take your pick.  If you're picky about
the formatting details, reST may not be for you.

--

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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
(Continue reading)

Scott Meyers | 2 Dec 2008 19:54
Favicon

Re: Newbie Questions: reST vs LaTeX

David Goodger wrote: 
>Right now there is no way to specify a class for a single cell or row 
>or column in a table.  You can put a class on a whole table easily, 
>but not a portion. 

Can you elaborate a bit on what a class is?  The reST docs I've been consulting all seem to assume the reader
already knows what things like classes, directives, attributes, and roles are, but I haven't found a
document that explains these things for newbies like me. 

Is there a class for centering things?  I have not been able to find mention of one. 

I've attached a table I took from one of my documents generated from LaTeX. Here, everything is centered
both vertically and horizontally.  Can this be expressed in reST?  If so, can you sketch how? 

Thanks, 

Scott 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
(Continue reading)


Gmane