brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
498 stars 59 forks source link

Customising the title page #378

Closed techauthoruk closed 1 year ago

techauthoruk commented 1 year ago

Is there an existing issue for this?

Your suggestion

I know this was raised in #157 but wondered if there had been any progress?

I too would prefer to have 'version' rather than 'release' (or have the option to choose?). In similar vein, is it possible to append text in front of the date? I would like to add something like 'Issue date: ' and then the date.

I can edit the final file in Acrobat, but it would be good to be able to do this without resorting to using Acrobat.

brechtm commented 1 year ago

I too would prefer to have 'version' rather than 'release' (or have the option to choose?).

If you set subtitle in the rinoh_documents entry, it will override the default document subtitle.

In similar vein, is it possible to append text in front of the date? I would like to add something like 'Issue date: ' and then the date.

You can pre/append arbitrary text to any document element from the style sheet. For the date on the title page, the title page date style is already defined, so you can simply set before for this element.

[title page date]
before = 'Issue date: ' (title page date prefix)
; note that you can also omit elements from the output by setting its 'hide' attribute
; hide = true

[title page date prefix : StyledText('title page date prefix')]
font_weight = bold
font_color = #aaa

The (title page date prefix) following the before text sets that text's style to title page date prefix, which is then used in the next style definition to apply some custom styling. This is yet another thing to be documented :-)

Consult the style log to find out which style definition is mapped to the document element you want to style. If the mapped style is too generic, you need to specify a custom selector to match the document element. The recommended way to do this is to set a unique class for the document element using the class directive (rst-class in Sphinx) or attribute. Now, match on the class by means of a selector's _hasclass argument:

[special paragraph : Paragraph(has_class='special')]
base = body
font_color = #f00

P.S. You are welcome to add a comment to an existing issue in this case instead of opening a new issue.

techauthoruk commented 1 year ago

WOW!!!!!!

Amazing - thank you @brechtm this has solved my issue. I am just blown away with the capabilities of rinohtype with Sphinx. It makes my life so much easier!

Closing this now as my issue is resolved.

brechtm commented 1 year ago

Amazing - thank you @brechtm this has solved my issue. I am just blown away with the capabilities of rinohtype with Sphinx. It makes my life so much easier!

With the exception of all the bugs you're running into! 🤣

techauthoruk commented 1 year ago

To be fair, most of the issues I am coming across aren't bugs, just my lack of knowledge of reST, LaTeX, Sphinx, and rinohtype!

It's a learning curve, but one that is proving very rewarding!