Skip to content

Commit

Permalink
Docs: add showcase section with Lekis example
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtm committed Oct 19, 2022
1 parent b2d080b commit 2e53f34
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Get tag
uses: olegtarasov/get-tag@v2
- name: Install Python ${{ env.current_python }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -294,7 +296,7 @@ jobs:
with:
submodules: true
- name: Get tag
uses: olegtarasov/get-tag@v2.1
uses: olegtarasov/get-tag@v2
- name: Install Python ${{ env.current_python }}
uses: actions/setup-python@v4
with:
Expand All @@ -305,7 +307,7 @@ jobs:
- name: Get package version from Poetry
run: echo "PKG_VERSION=$(poetry version --short)" >> $GITHUB_ENV
- name: Check whether the tag matches the package version
uses: jannekem/run-python-script-action@utilities
uses: jannekem/run-python-script-action@v1
with:
script: |
if '${{ env.GIT_TAG_NAME }}' != 'v${{ env.PKG_VERSION }}':
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Release History
Release 0.5.5 (in development)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Documentation changes:

* A showcase section was added to the manual to show examples of documents that
can be produces by rinohtype.

New Features:

* Enumerated list item labels now also respect the *number_separator* style
Expand Down
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ rinohtype

rinohtype is a batch-mode document processor. It renders structured documents
to PDF based on a document template and a style sheet. An important design goal
of rinohtype is make document layout and style customization user-friendly. See
the documentation_ to learn how to customize the style of your document.
of rinohtype is make document layout and style customization user-friendly. Have
a look at the showcase_ to get an idea of the level of customization that is
possible. See the documentation_ to learn how to customize the style of your
document.

.. _showcase: https://www.mos6581.org/rinohtype/master/showcase.html
.. _documentation: http://www.mos6581.org/rinohtype/master/


Call for Contributions
Expand Down Expand Up @@ -92,7 +97,6 @@ a look at the `rinohtype manual`_ for an example of the output.
There is also a commercial DITA_ frontend, but it's development is currently
on hold. Please `contact me`_ if you are interested in testing it.

.. _documentation: http://www.mos6581.org/rinohtype/master/
.. _create a ticket: https://github.com/brechtm/rinohtype/issues/new/choose
.. _Google Fonts: https://fonts.google.com
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
Expand Down
12 changes: 10 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# serve to show the default.


import os
import time

try:
Expand All @@ -40,13 +41,14 @@
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.autosummary',
'sphinx.ext.githubpages',
'sphinx_immaterial',
'sphinxcontrib.autoprogram',
]
Expand Down Expand Up @@ -124,6 +126,12 @@
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'sphinx': ('https://www.sphinx-doc.org/en/master', None)}

GIT_TAG = os.environ.get('GIT_TAG_NAME')
SHOWCASE_URL = (f'http://www.mos6581.org/rinohtype/{GIT_TAG}/showcase/%s'
if GIT_TAG else './showcase/%s')

extlinks = {'showcase': (SHOWCASE_URL, '%s')}

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
2 changes: 0 additions & 2 deletions doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,3 @@ database or other data sources. When parsing the document tree from a
structured document format, a templating engine like Jinja2_ can be used.

.. _Jinja2: http://jinja.pocoo.org

.. todo:: sample documents
1 change: 1 addition & 0 deletions doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:hidden:

intro
showcase
install
quickstart
basicstyling
Expand Down
35 changes: 34 additions & 1 deletion doc/rinohtype.rts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ number_format=None
font_color=#4d4d4d

[external hyperlink]
base=internal hyperlink
font_color=#004d4d

[broken hyperlink]
font_color=#ff0000
Expand Down Expand Up @@ -297,6 +297,39 @@ font_slant=italic
base=body
space_above=1pt

[image]
space_above=10pt
horizontal_align=CENTER

[figure]
space_above=10pt
space_below=12pt

[figure image]
base=image
keep_with_next=true

[caption : Caption]
base=default
font_size=9pt
line_spacing=Fixed(10pt)
indent_first=0pt
space_above=4pt
space_below=0pt
text_align=CENTER
label_suffix=' '

[figure caption]
base=caption

[figure legend]
margin_left=30pt

[figure legend paragraph]
base=caption
space_above=5pt
text_align=LEFT

# (Sphinx) object descriptions

[object description]
Expand Down
50 changes: 50 additions & 0 deletions doc/showcase.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. _showcase:

Showcase
========

Some examples of PDF documents produced by rinohtype are collected here. This
section mainly serves to give users an idea of the level of customization that
is achievable by means of custom templates and style sheets.


Lekis
-----

:showcase:`Odpisy.pdf` makes use of both a custom template and style sheet. The
custom template (Python) and configuration (INI file):

- configures Czech as the document's language, which prevents a line break
after specific words (following Czech typography rules)
- defines custom title (with vector logo) and colophon pages
- sets a background for content pages, marking the page header
- defines a custom back page, listing company contact details

Actually, there are two template configuration files: a base configuration and
one for a special type of documents. The latter inherits from the base template
configuration and only overrides what needs changing. In this case, it omits
the table of contents part from the document. The PDF linked to above is an
example of such a document.


.. magick montage -density 20 "doc/showcase/Odpisy.pdf[0,2,5]" -background grey
-tile x1 -border 4 -bordercolor white -geometry +0+0 doc/showcase/Odpisy.png
.. figure:: showcase/Odpisy.png

Some pages from :showcase:`Odpisy.pdf`


A single style sheet is used for both types of documents. It does not specify
the Sphinx style sheet included with rinohtype as a base stylesheet so as to
avoid unexpected changes in the document style in case the Sphinx style sheet
is updated in a future rinohtype release. The style sheet defines:

- the ``[VARIABLES]`` section defines monospaced, serif and sans-serif
typefaces and a set of key colors that are referenced in style definitions
- custom 'numbering' for headings (square glyph) and bullet lists (fast forward
glyph)
- a top border for certain headings
- custom in-line titles (in-line images or specific font glyphs) for
admonitions
- coloured styling for the ``menuselection`` role
- small-capital styling for keyboard shortcuts
Binary file added doc/showcase/Odpisy.pdf
Binary file not shown.
Binary file added doc/showcase/Odpisy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ def build_docs(session):
'sphinxcontrib-autoprogram'])
session.chdir('doc')
session.run('python', 'build.py', *session.posargs)
for pdf in glob.glob("_build/rinoh/*.pdf"):
shutil.copy(pdf, "_build/html")
# copy 'showcase' directory to the HTML output directory
shutil.copytree('showcase', '_build/html/showcase', dirs_exist_ok=True)
# copy PDF docs to the HTML output directory
for pdf in glob.glob('_build/rinoh/*.pdf'):
shutil.copy(pdf, '_build/html')



@nox_poetry.session(python=PYTHONS)
Expand Down

0 comments on commit 2e53f34

Please sign in to comment.