Referencing a file outside of the document root

1,252 views
Skip to first unread message

Reinout van Rees

unread,
Dec 6, 2010, 8:47:07 AM12/6/10
to sphin...@googlegroups.com
Hi,

In my project, I've got a doc/ subdirectory with the index.txt and the
rest of the documentation, so something like this:

myproject/
myproject/README.txt
myproject/setup.py
myproject/doc/
myproject/doc/index.txt
myproject/doc/conf.py


What I want: include the README.txt, CHANGES.txt, TODO.txt and so on.
But they're in the parent directory of my index.txt.

What are my options? Just putting ../README in a toctree doesn't seem
to work.


Reinout

--
Reinout van Rees - rei...@vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"

Michael P. Soulier

unread,
Dec 8, 2010, 1:22:00 PM12/8/10
to sphin...@googlegroups.com
On 06/12/10 Reinout van Rees said:

> Hi,
>
> In my project, I've got a doc/ subdirectory with the index.txt and the
> rest of the documentation, so something like this:
>
> myproject/
> myproject/README.txt
> myproject/setup.py
> myproject/doc/
> myproject/doc/index.txt
> myproject/doc/conf.py
>
>
> What I want: include the README.txt, CHANGES.txt, TODO.txt and so on.
> But they're in the parent directory of my index.txt.
>
> What are my options? Just putting ../README in a toctree doesn't seem
> to work.

What about the include directive?

Mike

signature.asc

Reinout van Rees

unread,
Dec 8, 2010, 4:51:03 PM12/8/10
to sphin...@googlegroups.com
On 12/08/2010 07:22 PM, Michael P. Soulier wrote:
>>
>> What are my options? Just putting ../README in a toctree doesn't seem
>> to work.
>
> What about the include directive?

Thanks, that works fine.

I completely forgot to look at restructuredtext itself :-)

Marius Gedminas

unread,
Dec 8, 2010, 3:55:54 PM12/8/10
to sphin...@googlegroups.com
On Mon, Dec 06, 2010 at 02:47:07PM +0100, Reinout van Rees wrote:
> In my project, I've got a doc/ subdirectory with the index.txt and
> the rest of the documentation, so something like this:
>
> myproject/
> myproject/README.txt
> myproject/setup.py
> myproject/doc/
> myproject/doc/index.txt
> myproject/doc/conf.py
>
> What I want: include the README.txt, CHANGES.txt, TODO.txt and so
> on. But they're in the parent directory of my index.txt.
>
> What are my options? Just putting ../README in a toctree doesn't
> seem to work.

I ended up creating symlinks to solve this. That's not portable, but I
don't care about Windows support for that particular internal project.

The other suggested solution with include directives sounds interesting.
http://pypi.python.org/pypi/objgraph does something like that: index.txt
includes snippets from README.txt, although I at the moment cheat by
having my Sphinx directory be the project root.

Marius Gedminas
--
2B OR NOT 2B == FF

signature.asc

Reinout van Rees

unread,
Dec 9, 2010, 4:06:19 AM12/9/10
to sphin...@googlegroups.com
On 12/08/2010 09:55 PM, Marius Gedminas wrote:
>
> I ended up creating symlinks to solve this. That's not portable, but I
> don't care about Windows support for that particular internal project.

I still have two windows colleagues, so... :-)

> The other suggested solution with include directives sounds interesting.
> http://pypi.python.org/pypi/objgraph does something like that: index.txt
> includes snippets from README.txt, although I at the moment cheat by
> having my Sphinx directory be the project root.

I use the include directive now and it works fine:

http://reinout.vanrees.org/weblog/2010/12/08/include-external-in-sphinx.html

Susanne

unread,
Dec 10, 2010, 5:58:54 AM12/10/10
to sphinx-dev
I started out with the include-directive, but the html got very long
(license info for 3rd party software), now i use :download: which i
like much better, especially, since the files i link to often dont
comply to rst-formatting, see

http://sphinx.pocoo.org/markup/inline.html?highlight=link%20text%20file#referencing-downloadable-files

cheers, susanne
Reply all
Reply to author
Forward
0 new messages