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

How To Include Copyright Notice? #301

Open
tbpassin opened this issue Oct 30, 2021 · 5 comments
Open

How To Include Copyright Notice? #301

tbpassin opened this issue Oct 30, 2021 · 5 comments
Labels

Comments

@tbpassin
Copy link

Docutils outputs copyright information from the configuration file, because it appears in the HTML output. That same information does not appear in Rinoh pdf output, at least with standard templates.

How can we get copyright notices into the Rinoh output?

@brechtm
Copy link
Owner

brechtm commented Nov 4, 2021

Can you provide some more information, or an example reStructuredText file? Which docutils configuration file are you referring to? Or are you talking about conf.py in Sphinx projects?

@tbpassin
Copy link
Author

I'm sorry - I meant Sphinx, a Sphinx config file. My test document includes three little RsT files containing some text, code, and math. I'm using it to compare the HTML output with Rinoh, rst2pdf, and latex.

I can build the output with Sphinx from the command line without creating a Sphinx config file by using -D setting parameters. I like to avoid using a config file when possible for simplicity, especially when I am doing experiments.

My command line includes a -D parameter for a copyright:

-D "copyright=John X. Doe 2021"

Using Sphinx's html builder, this copyright notice is included at the end of each section of the document. I invoke Rinoh with

-D extensions=rinoh.frontend.sphinx

It builds a good-looking document but no copyright notice appears (I know Rinoh doesn't render math as yet, and I don't expect that). I'd like to include one without using a Sphinx config file. Presumably Sphinx supplies a copyright notice since it appears in the html output.

Pip shows that my Rinoh version is

rinohtype 0.5.3

@brechtm
Copy link
Owner

brechtm commented Mar 4, 2022

Sorry for the (very) long delay. A lack of time has prevented me from looking into rinohtype issues the past few months. In case you're no longer experimenting with this, I hope my answers below might still be helpful to others.

My command line includes a -D parameter for a copyright: -D "copyright=John X. Doe 2021"

This will indeed have the same effect as setting copyright in conf.py.

I invoke Rinoh with -D extensions=rinoh.frontend.sphinx

FYI: Passing -b rinoh should be enough as Sphinx is able to automatically find the corresponding rinohtype module.

It builds a good-looking document but no copyright notice appears (I know Rinoh doesn't render math as yet, and I don't expect that). I'd like to include one without using a Sphinx config file. Presumably Sphinx supplies a copyright notice since it appears in the html output.

The rinoh builder indeed doesn't do anything by default with the copyright string set for a Sphinx project. It is possible to include the copyright string into the output, however. Where you like this to appear? You could include it on the title page or in the page footer, for example.

Like many things, this isn't properly documented at this point, unfortunately.

Title page

You could for example show it where the author is normally shown by changing the rinoh_documents entries.

rinoh_documents = [
    dict(doc='index', target='manual', toctree_only=False,
         template='manual.rtt', logo='logo.pdf', author=copyright),
]

I don't think you can set rinoh_documents from the command line, though.

You could also design your own custom document template with a fully customized title page.

Footer

Without going into details, add the following to conf.py to achieve this:

rst_prolog = f".. |copyright| replace:: {copyright}"

or on the command line:

-D "rst_prolog=.. |copyright| replace:: John X. Doe 2021"

Now, in a template configuration, you can insert {UserStrings.copyright} in the footer_text of a page template:

[contents_page]
footer_text = IMAGE('img/company_logo.pdf', width=6mm, baseline=1.5mm)
              '  {UserStrings.copyright}\t{PAGE_NUMBER} of {NUMBER_OF_PAGES}'

@tbpassin
Copy link
Author

tbpassin commented Mar 7, 2022

Thank you for this effort! I will need to chew on it and try out some of these things.

@brechtm
Copy link
Owner

brechtm commented Mar 7, 2022

Don't hesitate to ask if you get stuck, as much of this isn't properly documented yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants