useblocks / sphinx-simplepdf

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

css generation fails #4

Closed twodrops closed 1 year ago

twodrops commented 2 years ago

Inside a docker container where the tool is not running under a sudo user, the following error is raised and the generation stops

Generating css files from scss-templates Exception occurred: File "/usr/local/lib/python3.10/site-packages/sass.py", line 266, in compile_dirname with io.open( PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.10/site-packages/builders/../themes/sphinx_simplepdf/static/styles/main.css'

danwos commented 2 years ago

It looks like the sphinx generation gets called by a different user than the one used for installing the python packages. This can be a general problem and can happen on each system.

Looks like we need to generate the ``main.css``` inside the output folder of the sphinx documentation so that we can be sure to have the needed rights.
I'll try some stuff :)

kreuzberger commented 1 year ago

A main.css file is generated in the output folder.

So just a little confusing :-)

kreuzberger commented 1 year ago

How is pdf customization planed / intended? so currently 99% fits but i would like / need some adaptions. What is the intended way? Below is the generated css section in the html file. My "custom" fsp.css is included too early e.g. to overwrite settings in styles/main.css (but currently not generated/available) or is this the intended "personal" css file there i have to put my changes for sphinx_simplepdf?

  <link href="_static/pygments.css" rel="stylesheet" type="text/css"/>
  <link href="_static/main.css" rel="stylesheet" type="text/css"/>
  <link href="_static/css/fsp.css" rel="stylesheet" type="text/css"/>
  <link href="_static/styles/main.css" rel="stylesheet" type="text/css"/>
  <link href="_static/assets/jsonview.bundle.css" rel="stylesheet" type="text/css"/>
  <link href="_static/sphinx-needs/libs/html/datatables.min.css" rel="stylesheet" type="text/css"/>
  <link href="_static/sphinx-needs/common.css" rel="stylesheet" type="text/css"/>
  <link href="_static/sphinx-needs/styles.css" rel="stylesheet" type="text/css"/>
  <link href="_static/sphinx-needs/layouts.css" rel="stylesheet" type="text/css"/>
  <link href="_static/sphinx-needs/modern.css" rel="stylesheet" type="text/css"/>

Or should the simplepdf itself be extended for more configuration with config vars for "header-center", "footer-center", "header-left" and so on. These would e.g. the ones i would need first (e.g. to put a disclaimer/copyright into pdf)

danwos commented 1 year ago

There is no real strategy right now.

But my personal current goal is to make most important stuff available via option in the conf.py file.

So for new config vars, I add them to the _variables.scss. And then use this var at the related positions in the other scss files.

If needed, we can also add a simplepdf_css_files to the conf.py, which imports the custom user files.

I hope I find some time in the next few days to fix certain bugs here. Thanks for all the effort spend into reporting them :+1:

kreuzberger commented 1 year ago

So i would suggest new variables for footer/header configuration. If you would agree i would make a pull request with these variables / adapted _pages.scss:

I have to determine how to differ between the css functions and real strings in the variable definition.

danwos commented 1 year ago

Sure, I would be happy to get some support for this package :+1:

For adding content, I'm not sure if this should be done via scss. It would keep scss for the layout/style, and use the theme html files for content.

E.g. the themes/simplepdf_theme/cover.html gets some title information from the config. There `´jinja`` is used for voodoo.

kreuzberger commented 1 year ago

ok, i have a closer look at the cover, just watched the _pages.scss for usage of the counter and title in the header. i will contact on further questions.

danwos commented 1 year ago

This should be solved by #18, which does not make any more file operations in the site-package folder of the python installation.

Please reopen, if there are still problems in docker.