useblocks / sphinx-simplepdf

A simple PDF builder for Sphinx documentations
https://sphinx-simplepdf.readthedocs.io
MIT License
32 stars 14 forks source link

Build several PDFs out of a single project #71

Open Samy-Oubouaziz opened 1 year ago

Samy-Oubouaziz commented 1 year ago

Hello,

I am considering switching from LaTeX to SimplePDF for a number of reasons. The first tests were very concluant, it works (almost) great out of the box, however, there is a quite important limitation due to our environment.

The documentation project is divided in 3 folders, Installation, Operation and Reference, with a single conf.py file at the root of the repo, and we build 3 separate PDFs, one for each folder, as the total reaches 1500 pages.

I am trying to use if/else statements for themaster_doc and exclude_patterns in the following form (pseudo code):

if html:
    master_doc = 'index'
    exclude_patterns.extend(['*/index_pdf])
else:
    if install:
      master_doc = 'installation/index_pdf'
      exclude_patterns.extend(['index', 'operation/*','reference/*'])

    elif operation: 
      master_doc = 'operation/index_pdf'
      exclude_patterns.extend(['index', 'installation/*','reference/*'])

   elif reference:
      master_doc = 'reference/index_pdf'
      exclude_patterns.extend(['index', 'installation/*','operation/*'])

BUT doing so does not allow cross-referencing (using :ref:<reference>) between Installation/Operation/Reference, as 2 out of the 3 are excluded when building PDFs.

Is there currently a way to build 3 PDFs out of 1 Sphinx project, or to disable/bypass cross-referencing?

I do not need internal links inside the PDF.

Thank you in advance for your help!

ubmarco commented 5 months ago

Do I understand correctly, that your build fails due to the missing references? So you can't have your PDF without these parts?

Why do you use exclude_patterns at all, can't you just set master_doc to the document you need and run the build?

Edit: Btw, if your issue is runtime, that should be ok as most time is consumed by writing, not reading. And writing is scoped to the master_doc and below.