Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF build for documentation #18

Merged
merged 2 commits into from
Sep 17, 2024
Merged

PDF build for documentation #18

merged 2 commits into from
Sep 17, 2024

Conversation

cristianmihaipopa
Copy link
Collaborator

@cristianmihaipopa cristianmihaipopa commented Sep 10, 2024

Using RTF2PDF, there is now the option for outputting the whole HDL documentation in PDF format. The following changes were made:

  • new variable used to signal PDF output mode, called ADOC_MEDIA_PRINT (export ADOC_MEDIA_PRINT=value)
    • 1 for PDF output mode, which changes the HTML output a little bit (only visually, for example some things are not highlighted anymore); used this only when exporting to PDF
    • 0 default, no need to be set
  • to build the PDF, use this command sphinx-build -b pdf . _build/pdfbuild in docs folder after setting the ADOC_MEDIA_PRINT variable; these libraries are needed to be installed
    • rst2pdf
    • matplotlib
    • svglib
  • conf.py file from each repo needs to be changed to include rst2pdf.pdfbuilder extension
  • the code that handles tables, collapsible etc. was changed so that the exported text is rendered correctly in PDF

There are a few more issues that need to be tackled, but these problems are more styling related:

  • some pictures are not properly sized, meaning that in some cases they are too small or too big
  • in some cases, code examples (blocks which contain highlighted code) exit the page, they are not wrapped to continue on the next line
  • a few .svg diagrams are not properly rendered (missing port names or connections between blocks)

This is a prototype, a bit more styling is needed, but functionally, all the info that is contained in HDL documentation can be found in the new outputted PDF document (no missing tables, like in the case of collapsible content which contained other pieces of information).
The new PDF output method was tested on a select batch of pages from HDL (taken from docs/projects & docs/library) & on the whole HDL documentation.

@cristianmihaipopa cristianmihaipopa added enhancement New feature or request documentation Improvements or additions to documentation labels Sep 10, 2024
@cristianmihaipopa cristianmihaipopa self-assigned this Sep 10, 2024
Copy link
Contributor

@gastmaier gastmaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add relevant docs for ADOC_MEDIA_PRINT on docs_guidelinesr.rst .
Can be after the Versioning section.

@@ -6,15 +6,20 @@
project = 'Doctools'
copyright = '2024, Analog Devices, Inc.'
author = 'Analog Devices, Inc.'
version = '0.3'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I don't want to manually increment this every time.
I prefer injecting it in CI with the ADOC_DOC_VERSION environment variable based on the git release tag, that may or may not be a python version variable.
The option from ..adi_doctools/__init__ import __version__ as version is fine for python projects like this one and pyadi-iio, but not for others like scopy, iio-osc, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is necessary as it specifies on the first page of the PDF the mentioned version of the document. If we don't want to specify the version, I will remove this field or will change it so that it automatically updates.

- This method converts directly to PDF using the .rst files
(rst2pdf method)
- Build by running 'sphinx-build -b pdf' in the docs folder
and choose the output folder
- New parameter called ADOC_MEDIA_PRINT; This parameters is used to
signal the PDF export mode and can be either 1 or 0
- Tables export as they should now (wihtout empty columns)
- Collapsibles are converted into tables
- Dropdowns which contain tables like the ones found in
'Generic AXI ADC' && 'Generic AXI DAC' wouldn't render
properly, but now they are fixed
- Fixed larger tables, usually appear under 'Configuration Parameters'
section, which contain a larger number of columns
- Added a new section called 'Exporting to PDF' where the PDF
export mode is explained
- Added in requirments.txt the three libraries needed to build
the PDF documentation
- Fixed conflicts

Signed-off-by: Cristian Mihai Popa <cristianmihai.popa@analog.com>
Signed-off-by: Cristian Mihai Popa <cristianmihai.popa@analog.com>
@cristianmihaipopa cristianmihaipopa merged commit d70ba6a into main Sep 17, 2024
3 of 5 checks passed
@cristianmihaipopa cristianmihaipopa deleted the doctools_pdf_output branch September 17, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants