apluslms/a-plus-rst-tools

Support the Sphinx latex builder

Opened this issue · 1 comments

I cannot compile RST chapter content to a PDF (run make latexpdf in an RST course directory) if the RST code uses any aplus directives, such as aplusmeta in round index files. If I remove the aplus directives from the RST code, then make latexpdf works again. Note that a-plus-rst-tools/aplus_setup.py calls app.add_node with visitor functions only for the html builder. According to http://www.sphinx-doc.org/en/stable/extdev/appapi.html#sphinx.application.Sphinx.add_node it is then expected that the latex builder is unable to process the directive. It could be enough that the output of the directive is empty when the latex builder is used, basically ignoring the directives completely. Currently, the latex builder ignores the files with these aplus directives with a misleading error message: index.rst: WARNING: toctree contains ref to nonexisting file 'r02/index' (assume that `r02/index uses the aplusmeta directive). The output PDF does not include any r02 content in this case.

I have tried to define empty visitor functions for latex in the function calls app.add_node in the file aplus_setup.py, but it did not change anything. I think it should work, but something still gets wrong. Thus unfortunately, I have no working solution.

The merged pull request #10 did not fix the whole thing. It is possible to compile the PDF now (instead of crashing to errors during the compilation), but the aplus RST directives (such as questionnaire) do not behave well in PDFs. The PR added a comment in https://github.com/Mankro/a-plus-rst-tools/blob/37c2b1e24431b5d3347fbbf1a8f851456b1e77ef/aplus_setup.py#L42 which says the following:

Note: even though these latex visitor functions do nothing, the exercise directives nonetheless output some text to the Latex/PDF output. The text is even often duplicated multiple times. This is possibly caused by broken aplus_nodes classes that interfere with the builder output even though only the visitor functions should do that.