Skip to content

Commit

Permalink
Merge pull request #615 from neerdoc/publisher_restruct
Browse files Browse the repository at this point in the history
Publisher restruct
  • Loading branch information
jacebrowning committed Jan 10, 2024
2 parents e91dc8f + 20e3ab4 commit 2ae66f4
Show file tree
Hide file tree
Showing 46 changed files with 3,609 additions and 2,161 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/execute-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
name: Python ${{ matrix.python-version }}

defaults:
Expand Down Expand Up @@ -60,14 +60,22 @@ jobs:
# very slow. Especially any client/server tests seems to be problematic.
# This is a simple attempt to re-run the tests up to three times if they
# fail. Does not add any execution time if successful.
- name: Run tests attempt 1
run: make test
- name: Run tests attempt 2
if: ${{ failure() }}
run: make test
- name: Run tests attempt 3
if: ${{ failure() }}
run: make test
- uses: Wandalen/wretry.action@v1.0.20
name: Run tests
with:
command: make test
current_path: ${{ inputs.workpath }}
attempt_limit: 3
attempt_delay: 2000

# - name: Run tests attempt 1
# run: make test
# - name: Run tests attempt 2
# if: ${{ failure() }}
# run: make test
# - name: Run tests attempt 3
# if: ${{ failure() }}
# run: make test

- name: Upload coverage
uses: codecov/codecov-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = GNU Make
[Python]

cli = python
version = 3.8 || 3.9 || 3.10
version = 3.8 || 3.9 || 3.10 || 3.11 || 3.12

[Poetry]

Expand Down
27 changes: 27 additions & 0 deletions docs/cli/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,30 @@ Supported formats:
- Markdown: `.md`
- HTML: `.html`
- LaTeX: `.tex`

# Templates

Each output format also has support for templates that can adjust the formatting of the output. Any folder named `template` that is placed alongside the `.doorstop.yml` configuration file will be copied during the publishing process into the output folder. _Note: If multiple documents contain the `template` _folder, they will **all** be copied, although no overwriting is performed._

A command line `--template` flag is provided to allow choosing the template by name. By default, both LaTeX and HTML publishing formats _require_ a template! Therefore, _doorstop_ provides standard templates for these formats that will be used automatically if no template name is given during publishing.

The flag is used by providing the name of the template, i.e., `--template sidebar`.

## HTML templates

HTML template name will instruct the publisher to use the `<name>.css` file in the template folder as formatting. E.g., the default HTML template name is `sidebar`, which then will publish the HTML documents with the `sidebar.css` included in the output.

## LaTeX templates

LaTex template name will similarly instruct the publisher to use the `<name>.yml` _and_ the `<name>.cls` files in the template folder for formatting the output documents.

Due to the rather high complexity of typesetting LaTeX documents, a configuration file `<name>.yml` must be provided to allow _doorstop_ to understand how to typeset the output documents as well as a normal LaTeX class template to provide the LaTeX specific formatting.

The default LaTeX template is `doorstop`, and is included with _doorstop_. The `doorstop.yml` file is commented to provided guidance on how to write your own LaTeX template.

# Assets

In addition to the `template` folder, an `assets` folder placed next to the
`.doorstop.yml` file for a document will also be copied in the same manner to
the output folder. The purpose of the `assets` folder is to contain images or
other external artifacts that can be included in the published documents.
4 changes: 2 additions & 2 deletions doorstop/cli/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from doorstop.core.builder import _clear_tree
from doorstop.core.document import Document

REQ_COUNT = 18
ALL_COUNT = 50
REQ_COUNT = 23
ALL_COUNT = 55


class TempTestCase(unittest.TestCase):
Expand Down
File renamed without changes.
15 changes: 8 additions & 7 deletions doorstop/core/files/templates/latex/doorstop.cls
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
%% and modify, as long as reference to the original author
%% is given.
%%
%% Original author: Gustav Johansson, gustav@neer.se
%% Original author: Gustav Wulf, gustav@neer.se
%%
%% Last modified by: Gustav Johansson, February 16, 2022.
%% Last modified by: Gustav Wulf, December 29, 2023.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
Expand All @@ -19,12 +19,12 @@
% Identification
% ******************************************************
\def\classversion{1.0}
\def\classdate{Feb 16, 2022}
\def\classdate{Dec 29, 2023}

\typeout{Document class version: \classversion}
\typeout{Last modified: \classdate}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{doorstop}
\ProvidesClass{template/doorstop}

% ******************************************************
% Declare Options
Expand Down Expand Up @@ -87,15 +87,16 @@
\newenvironment{plantuml}[1]{\VerbatimOut{#1.txt}}{\endVerbatimOut}

% Process a PlantUML code:
\newcommand{\process}[3]{%
\newcommand{\process}[4]{%
% Call PlantUML to produce a svg vector graphcis:
\immediate\write18{plantuml -tsvg #1.txt}
% Call Inkscape to convert the svg to a pdf (pdflatex cannot use svg):
\immediate\write18{inkscape #1.svg --export-pdf=#1.pdf}
% Include the pdf:
\begin{figure}[h]
\includegraphics[width=#2]{#1.pdf}
\begin{figure}[!h]
\includegraphics[width=#2]{#1.pdf}
\caption{#3}
\label{fig:plant#4}\zlabel{fig:plant#4}
\end{figure}
% Remove all intermediate files:
\immediate\write18{rm #1.txt #1.svg #1.pdf}
Expand Down
File renamed without changes.

0 comments on commit 2ae66f4

Please sign in to comment.