Skip to content

Commit

Permalink
Merge pull request #103 from neilt/fix_graphviz_latexml
Browse files Browse the repository at this point in the history
Fix logic for building dot files
  • Loading branch information
neilt authored Nov 26, 2024
2 parents 5396235 + 0b54d29 commit 78a433b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 81 deletions.
89 changes: 39 additions & 50 deletions part-customization.tex
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,34 @@ \section{Workflow configuration}
will be \texttt{posted}. E-mailing an invoice does not change its state: it
remains posted. Instead, a new workflow is created which manages state of the e-mail.

\IfFileExists{./wf1.pdf}{
\begin{figure}[H]
\centering
% \includegraphics[width=0.8\textwidth]{dmc-create-step1.png}
% HTML processing does not handle cropping of this image, need to figure out why?
% \includegraphics[width=\graphicswidth, trim={0pt 50 0 0}, clip]{\autoscreenshotdir/setup-pl-login.png}
\includegraphics[width=\graphicswidth]{wf1.pdf}
\caption{Workflow triggered from another workflow}
\label{fig:triggered-workflow}
\end{figure}
}{
\begin{figure}
\digraph[scale=0.4]{wf1}{
rankdir=LR;
subgraph invoice {
graph [label="Invoice"];
cluster = true;
saved -> posted [label="post"];
posted -> reversed [label="reverse"];
};

subgraph email {
graph [label="email"];
cluster = true;
created -> sent [label="send"];
};

posted -> created [label="e-mail"];
posted -> posted [label="e-mail"];

\begin{figure}[H]
\centering
\ifpdf
% File existence check is needed to keep from having an infinit loop
% Each pdf creation changes the hash, so latexmk never completes
\IfFileExists{wf1.pdf} {} {
\digraph[scale=0.4]{wf1}{
rankdir=LR;
subgraph invoice {
graph [label="Invoice"];
cluster = true;
saved -> posted [label="post"];
posted -> reversed [label="reverse"];
};
subgraph email {
graph [label="email"];
cluster = true;
created -> sent [label="send"];
};
posted -> created [label="e-mail"];
posted -> posted [label="e-mail"];
}
}
\caption{Workflow triggered from another workflow}
\label{fig:triggered-workflow}
\end{figure}
}
\fi
\includegraphics[width=\graphicswidth]{wf1.pdf}
\caption{Workflow triggered from another workflow}
\label{fig:triggered-workflow}
\end{figure}

Actions belonging to a state may (or may not) be available. This is determined by one or
more conditions. Examples are ``is the posting date of the transaction in a closed period''
Expand All @@ -115,18 +108,12 @@ \section{Workflow configuration}
By adding a condition on this action, it can be made required for invoices over 100.000 USD
(but not for other invoices).

\IfFileExists{./wf2.pdf}{
\begin{figure}[H]
\centering
% \includegraphics[width=0.8\textwidth]{dmc-create-step1.png}
% HTML processing does not handle cropping of this image, need to figure out why?
% \includegraphics[width=\graphicswidth, trim={0pt 50 0 0}, clip]{\autoscreenshotdir/setup-pl-login.png}
\includegraphics[width=\graphicswidth]{wf2.pdf}
\caption{Conditional workflow actions}
\label{fig:conditional-workflows}
\end{figure}
}{
\begin{figure}
\begin{figure}[H]
\centering
\ifpdf
% File existence check is needed to keep from having an infinit loop
% Each pdf creation changes the hash, so latexmk never completes
\IfFileExists{wf2.pdf} {} {
\digraph[scale=0.4]{wf2}{
rankdir=LR;
subgraph invoice {
Expand All @@ -138,10 +125,12 @@ \section{Workflow configuration}
posted -> reversed [label="reverse"]
}
}
\caption{Conditional workflow actions}
\label{fig:conditional-workflows}
\end{figure}
}
}
\fi
\includegraphics[width=\graphicswidth]{wf2.pdf}
\caption{Conditional workflow actions}
\label{fig:conditional-workflows}
\end{figure}

By changing association of the \texttt{save} action with its code, the application will act
differently when saving the invoice. Customizations may associate new behaviors with existing
Expand Down
4 changes: 3 additions & 1 deletion scripts/local-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ if [[ $1 = '--use-pdf-latex' ]]; then
elif [[ $1 = '--use-latex-mk' ]]; then

# Only builds files that have changed
# Have to use '-shell-escape' in order to build graphviz's dot files
# latexmk takes 3 runs to complete as of 26 Nov 2024
# -diagnostics \

latexmk -dvi- \
-shell-escape \
-interaction=nonstopmode \
-pdf \
-silent \
Expand Down
20 changes: 1 addition & 19 deletions wf1.dot
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
digraph wf1 {
rankdir=LR;
subgraph invoice {
graph [label="Invoice"];
cluster = true;
saved -> posted [label="post"];
posted -> reversed [label="reverse"];
};

subgraph email {
graph [label="email"];
cluster = true;
created -> sent [label="send"];
};

posted -> created [label="e-mail"];
posted -> posted [label="e-mail"];

}
digraph wf1 { rankdir=LR; subgraph invoice { graph [label="Invoice"]; cluster = true; saved -> posted [label="post"]; posted -> reversed [label="reverse"]; }; subgraph email { graph [label="email"]; cluster = true; created -> sent [label="send"]; }; posted -> created [label="e-mail"]; posted -> posted [label="e-mail"]; }
Binary file modified wf1.pdf
Binary file not shown.
12 changes: 1 addition & 11 deletions wf2.dot
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
digraph wf2 {
rankdir=LR;
subgraph invoice {
graph [label="Invoice"];
cluster=true;
saved -> posted [label="post (<100.000)"];
saved -> submitted [label="submit (>100.000)"];
submitted -> posted [label="post"];
posted -> reversed [label="reverse"]
}
}
digraph wf2 { rankdir=LR; subgraph invoice { graph [label="Invoice"]; cluster=true; saved -> posted [label="post (<100.000)"]; saved -> submitted [label="submit (>100.000)"]; submitted -> posted [label="post"]; posted -> reversed [label="reverse"] } }
Binary file modified wf2.pdf
Binary file not shown.

0 comments on commit 78a433b

Please sign in to comment.