Jon Rosen | 3 Jun 03:50 2008

hyperlinks in tables

Help please: I'm struggling to get a table in reStructuredText to represent hyperlinks without having to create giant table columns just to contain the target URLs. 

In other words, I want a table with narrow columns that contain hyperlinks.  How does one do this?

I also want the same table to display jpeg images within some cells.

Any advice will be greatly appreciated!!
joncrosen <at> deviantart.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
David Goodger | 3 Jun 03:56 2008

Re: hyperlinks in tables

[Jon Rosen - 2008-06-02 21:50]
> Help please: I'm struggling to get a table in reStructuredText to 
> represent hyperlinks without having to create giant table columns just 
> to contain the target URLs. 
> 
> In other words, I want a table with narrow columns that contain 
> hyperlinks.  How does one do this?

In the table, put

     `link text`_

Elsewhere in the document, put the URL:

     .. _link text: http://very-very-long-url-here

> I also want the same table to display jpeg images within some cells.

Use the "image" directive.

--

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
John Hunter | 5 Jun 17:27 2008
Picon

sphinx autodoc errors

If this is not the correct list to post sphinx questions on, please
let me know ..

We are using sphinx 0.3 from svn r63955 to build the matplotlib
documentation.  We have some api documentation files which use sphinx
autodoc and so are quite short (ie see artist_api.rst below).  When we
use sphinx to build our documentation, we occassionally get errors or
warnings because the rest in one of the included automod module
docstrings is malformed.  Eg::

    reading... api/artist_api api/index api/pyplot_api
devel/add_new_projection devel/coding_guide devel/documenting_mpl
devel/index devel/transformations faq/howto_faq faq/index
faq/installing_faq faq/troubleshooting_faq index users/artists
users/customizing users/event_handling users/index users/intro
users/mathtext users/navigation_toolbar users/pyplot_tutorial
    WARNING: /home/titan/johnh/python/svn/matplotlib.trunk/matplotlib/doc/api/artist_api.rst:110:
(ERROR/3) Malformed table.
    No bottom table border found.

    =================   ==============================================
    WARNING: /home/titan/johnh/python/svn/matplotlib.trunk/matplotlib/doc/api/artist_api.rst:111:
(WARNING/2) Block quote ends without a blank line; unexpected
unindent.
    WARNING: /home/titan/johnh/python/svn/matplotlib.trunk/matplotlib/doc/api/artist_api.rst:247:
(ERROR/3) Malformed table.
    No bottom table border found.

    =================   ==============================================
    WARNING: /home/titan/johnh/python/svn/matplotlib.trunk/matplotlib/doc/api/artist_api.rst:248:
(WARNING/2) Block quote ends without a blank line; unexpected
unindent.

The problem is, artist_api.rst has no lines 111, 247 or 248.  I assume
these numbers are some rest file sphinx is creating, perhaps located
in build/doctrees/api/artist_api.doctree (?).  But these warnings are
not too helpful to us in finding the actual part of our documentation
that is causing the trouble.

If we could get more verbose output, either giving us the actual line
number of the  python module generating the problem, or more verbose
context from the module docs in which the strings are occurring it
would help us debug these problems more efficiently.  Is such a thing
currently possible, or could it be added?

Thanks,
John Hunter

The artist_api.rst file:

******************
matplotlib artists
******************

:mod:`matplotlib.artist`
=============================

.. automodule:: matplotlib.artist
   :members:
   :undoc-members:

:mod:`matplotlib.lines`
=============================

.. automodule:: matplotlib.lines
   :members:
   :undoc-members:

:mod:`matplotlib.patches`
=============================

.. automodule:: matplotlib.patches
   :members:
   :undoc-members:

:mod:`matplotlib.text`
=============================

.. automodule:: matplotlib.text
   :members:
   :undoc-members:

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Darren Dale | 5 Jun 17:50 2008
Picon

Re: sphinx autodoc errors

Hi John,

On Thursday 05 June 2008 11:27:52 am John Hunter wrote:
> If this is not the correct list to post sphinx questions on, please
> let me know ..

I think this list is what you are looking for:
sphinx-dev <sphinx-dev <at> googlegroups.com>

Darren

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
John Hunter | 5 Jun 18:12 2008
Picon

Re: sphinx autodoc errors

On Thu, Jun 5, 2008 at 10:50 AM, Darren Dale <darren.dale <at> cornell.edu> wrote:

> I think this list is what you are looking for:
> sphinx-dev <sphinx-dev <at> googlegroups.com>

Thanks, I've moved the conversation over there.

JDH

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
David Goodger | 5 Jun 21:17 2008

Re: hyperlinks in tables

[quoting with permission]

On Thu, Jun 5, 2008 at 2:32 PM, Jon Rosen <joncrosen <at> deviantart.com> wrote:
> Similarly, the "image" directive seems to require my inserting the whole IRL
> into the table cell. This too seems to also necessitate creating extra wide
> table columns to accommodate it.  I want a table with column or cell that
> tightly fits the image. How would I do that? (I.e., Is there a way to
> minimize the margin around images in tables.)
>
> Thanks again,
> Jon

There are lots of ways to build tables in Docutils/reST. Tables are
tricky, and Docutils doesn't give you as much control as, say, raw
HTML. If you need that level of control, reST may not be the right
thing for you.

There are two direct syntaxes for tables: grid tables & simple tables
(see http://docutils.sourceforge.net/docs/user/rst/quickref.html#tables).
Grid tables allow for funky layouts, but are hard to "draw", and if
you have long URLs etc. you do have to allow space for them. There is
a trick you can use with the image directive though. You can break up
a URL onto multiple lines:

.. image:: http://
   example.org/
   very/very/very/
   long/path/to/
   image.png

The directive will join them back together (stripping spaces). See
http://docutils.sourceforge.net/docs/ref/rst/directives.html#image for
details.

For simple tables, the trick above works, except in the first column
(where entries may not have multiple lines; see
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables).
Another trick possible in simple tables: in the last (rightmost)
column, the cell content can extend beyond the right edge:

====  ====
one    ..image:: http://example.org/very/very/very/long/path/to/image.png
====  ====

The rendered table's column widths will keep the relative widths of
the top borders.

If that won't do it for you, there are ways to define tables
indirectly, with CSV data or lists. The "list-table" directive is
simplest; I recommend you give it a try. (See
http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table
& http://docutils.sourceforge.net/docs/ref/rst/directives.html#csv-table).

A different approach that might appeal to you is to define your images
as substitutions, and use substitution references in your tables:

.. |biohazard| image:: biohazard.png

===========  =====================
Symbol       Definition
===========  =====================
|biohazard|  Nasty stuff; don't touch.
===========  =====================

See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions

Hope this helps.

-- David

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Zeth | 6 Jun 01:22 2008
Picon

Newbie question about getting docinfo out of rst document

Hello guys,

I am new to Docutils so I don't really know what I am doing yet.
However, my aim is to read the bibliographic fields out of a
reStructuredText document into a Python dictionary. I achieved it by
just poking it (see code below), but this seems a bit meandrous, what
is the correct way to do this please? Cheers,

Best Wishes,
Zeth

"""Trying to use docutils."""
import docutils.core

def get_docinfo(document):
    """Get the bibliographic fields out of the reStructuredText document."""
    docinfo = {}
    for i in [x for x in docutils.core.publish_doctree(document).children \
                  if x.tagname == 'docinfo'][0].children:
        docinfo[i.tagname] = str(i.children[0])
    return docinfo

def main():
    """Little example."""
    webpage = 'http://docutils.sourceforge.net/docs/user/rst/quickstart.txt'
    import urllib2
    document = ''.join(urllib2.urlopen(webpage).readlines())
    return get_docinfo(document)

# start the ball rolling
if __name__ == "__main__":
    print main()

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
André Roberge | 9 Jun 03:03 2008
Picon

Next official release?

Hi everyone,

Is there any plan for doing an official release in the near future?  The reason
I am asking is that I make use of docutils Directives in one of my project
(Crunchy) relying on the "latest snapshot" where Directives are implemented via
classes. 

Some users rely on the official release (available from some Linux
distributions) where directives are implemented via a function.  I fully realize
how "painful" doing an official release can be, but having an official release
that is more than 2 years old where there's been active development is a bit
difficult to understand.

Please consider this to be a constructive criticism - and an endorsement of the
very good development work that has been done in the past 2+ years.

Cheers,

André

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
David Goodger | 9 Jun 03:57 2008

Re: Next official release?

[André Roberge - 2008-06-08 21:03]
> Is there any plan for doing an official release in the near future?

There is no plan for a release.  While I sympathize with the need, I currently 
don't have time.

I would encourage and welcome anyone who steps forward to help with releases.

--

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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Alan G Isaac | 9 Jun 04:34 2008
Picon

Re: Next official release?

On Sun, 08 Jun 2008, David Goodger apparently wrote:
> I would encourage and welcome anyone who steps forward to help with releases. 

Didn't Leah suggest she could do this, about a month ago?
Perhaps she is still willing.

Cheers,
Alan Isaac

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Gmane