[Techtalk] sphinx rst-- generate 2 different HTML index pages from one source file

Michelle Murrain michelle at murrain.net
Sat Mar 7 00:07:01 UTC 2015


Is the content of the pages in the different domains the same? If so, this
might be more of a Web server configuration question...
On Mar 6, 2015 3:52 PM, "Carla Schroder" <carla at bratgrrl.com> wrote:

> Hi Miriam,
>
> The more I look at this the more I think having an .html and an .htm
> page is a dead end, because it means mucking with the Sphinx makefile.
> so it doesn't save any hassle.
>
> Here is a simple example to illustrate what I want to do. This is a
> snippet from index.rst:
>
> ------------
> Foo Manuals
> ------------
>
> This documents the *latest* version of foo, suitable for
> production use.
>
> * `Administration Manual
>   <http://doc.example.org/admin_manual/>`_
> * `Administration Manual
>   <http://doc.example.com/admin_manual/>`_
>
> * `User Manual
>   <http://doc.example.org/user_manual/>`_
> * `User Manual
>   <http://doc.example.com/user_manual/>`_
>
> From this single source file I want Sphinx to build two different
> index.html pages, which are called with make html and make html-com,
> and it automagically builds each page with the correct .org or .com
> URLs:
>
> ------------
> Foo Manuals
> ------------
>
> This documents the *latest* version of foo, suitable for
> production use.
>
> * `Administration Manual
>   <http://doc.example.org/admin_manual/>`_
>
> * `User Manual
>   <http://doc.example.org/user_manual/>`_
>
> and
>
> ------------
> Foo Manuals
> ------------
>
> This documents the *latest* version of foo, suitable for
> production use.
>
> * `Administration Manual
>   <http://doc.example.com/admin_manual/>`_
>
> * `User Manual
>   <http://doc.example.com/user_manual/>`_
>
> With Bash this would be some straightforward if-else and regex
> stuff, but in Sphinx/rst/Python I am clueless.
>
>
> Carla
>
>
> On Sat, 07 Mar 2015 09:17:25 +1000
> Miriam English <mim at miriam-english.org> wrote:
>
> > Hi Carla,
> >
> > I may be barking up the wrong tree completely and misunderstanding
> > what you want, but it sounds like a symbolic link is all that's
> > required. So you could, for instance make the .htm a link to
> > the .html file. That way when you update the .html file nothing needs
> > to be done for the .htm one because when fetched it will still
> > actually be the .html one.
> >
> > Cheers,
> >
> >       - Miriam
> >
> >
> > On 07/03/15 04:20, Carla Schroder wrote:
> > >
> > > Hola techtalkers,
> > >
> > > I have been assigned the task of creating a single source .rst file,
> > > index.html, to create a documentation index for two domains,
> > > one .com and one .org. The doc index is the same except for the
> > > domains, so the output needs to look like this:
> > >
> > >
> > > http://doc.example.com/admin_manual < print this link in index.html
> > > only for the .com site
> > >
> > > http://doc.example.org/admin_manual < print this link in index.html
> > > only for the .org site
> > >
> > > The site builder (Jenkins) automatically builds the manuals from a
> > > single repo to both sites. That part is easy, because Sphinx' Make
> > > targets automatically build both .com and .org versions, and then
> > > there are two separate Jenkins jobs, one for .com and one for .org.
> > >
> > > One option is to create two documentation index pages: one html and
> > > one htm. But my overlords really want a single source page all full
> > > of conditionals for html only, and I'm pretty sure it can be done.
> > > I know how to to do simple subsitutions with .. ifconfig:: , but I
> > > haven't a clue how to write conditionals that parse URLs for
> > > specific domains.
> > >
> > > Sphinx is abundantly-documented, but unfortunately not in a very
> > > helpful way.
> > >
> > > TIA,
> > > Carla
> > >
> >
>
>
>
> --
> ++++++++++++++++++++++++++++++++++++++++
> Ace Linux guru                         +
> carlaschroder.com                      +
> There's a dance in the old dame yet    +
> ++++++++++++++++++++++++++++++++++++++++
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
>


More information about the Techtalk mailing list