Skip to content

Commit

Permalink
Merge pull request #9 from uasal/u/sfrinaldi/latex-template-fix
Browse files Browse the repository at this point in the history
U/sfrinaldi/latex template fix
  • Loading branch information
douglase authored Jan 5, 2025
2 parents 620a2dd + d406d5f commit 6068c09
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 92 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ coverage.xml

# Eclipse
.settings


# Local Build Testing
/reqs/*
/rtm_doorstop/*
5 changes: 0 additions & 5 deletions doorstop/cli/tests/docs/.doorstop.yml

This file was deleted.

16 changes: 0 additions & 16 deletions doorstop/cli/tests/docs/HLT001.yml

This file was deleted.

12 changes: 0 additions & 12 deletions doorstop/cli/tests/docs/HLT002.yml

This file was deleted.

13 changes: 0 additions & 13 deletions doorstop/cli/tests/docs/HLT003.yml

This file was deleted.

11 changes: 0 additions & 11 deletions doorstop/cli/tests/docs/HLT004.yml

This file was deleted.

10 changes: 0 additions & 10 deletions doorstop/cli/tests/docs/HLT005.yml

This file was deleted.

5 changes: 3 additions & 2 deletions doorstop/core/files/templates/latex/doorstop.cls
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
\pagestyle{fancy}
\fancyhf{}% Clear all settings
\fancyhead[RE,RO]{\raisebox{0.5cm}{\textsf{\begin{tabular}{p{5cm}p{2.5cm}p{3.5cm}}
\textbf{\large\docname} & {\footnotesize\textbf{Repository:}} &{\footnotesize\textbf{Workflow:}}\tabularnewline
\textbf{\large\doctitle} & {\footnotesize\textbf{Repository:}} &{\footnotesize\textbf{Workflow:}}\tabularnewline
\multirow{3}{5cm}[1ex]{\textit{\docdef}}&\textrm{\small\gitlabrepo} & \textrm{\small\gitBranch} \tabularnewline
&{\footnotesize\textbf{Date:}} & {\footnotesize\textbf{Commit:}}\tabularnewline
&\textrm{\small\today} & \textrm{\small\gitDescribe} \tabularnewline
Expand Down Expand Up @@ -294,7 +294,8 @@
\includegraphics[height=3in]{\logo}\\[1mm]
\vspace{0.5cm} \mbox{}\hrulefill \mbox{}\\[1cm]
{\Huge \textbf{\doctitle\\[0.5cm]}}
{\LARGE \textit{\docdef}}\\[0.5cm]
{\LARGE \textit{\subtitle}}\\[0.5cm]
{\large \textit{\docdef}}\\[0.2cm]
{\large \textbf{Date: }\today} \vfill
{\large \textbf{\gitlabrepo} \textit{- Full Requirements Generation Repository}}\\[0.2cm]
{\large \textbf{\githubrepo} \textit{- Levels 0-3 Requirements Repository}}\\[0.2cm]
Expand Down
6 changes: 5 additions & 1 deletion doorstop/core/files/templates/latex/doorstop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ usepackage:
# Define custom lines before \begin{document}
before_begin_document:
# Define the title for the published document output
- \def\docname{Pearl Requirements}
- \def\doctitle{Pearl Requirements}
- \def\subtitle{Level 0-4 Requirements}
# Define / update the repository link requirements are located for reference
- \def\repourl{https://gitlab.sc.ascendingnode.tech/pearl-systems/pearl_requirements}
- \def\githuburl{https://github.com/uasal/pearl_requirements}
Expand All @@ -58,5 +59,8 @@ include_graphics:
after_begin_document:
- \maketitle
- \maketoc
# For adding the traceability matrix at the end of the document
traceability_matrix:
- False


2 changes: 1 addition & 1 deletion doorstop/core/publishers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_document_attributes(obj, is_html=False, extensions=None):
"""Try to get attributes from document."""
doc_attributes = {}
doc_attributes["name"] = "doc-" + obj.prefix
doc_attributes["title"] = "Pearl Requirements"
doc_attributes["title"] = "Requirements"
doc_attributes["ref"] = "GitLab"
doc_attributes["by"] = "-"
doc_attributes["major"] = "-"
Expand Down
48 changes: 27 additions & 21 deletions doorstop/core/publishers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,9 @@ def _generate_latex_wrapper(self):
t=_latex_convert(extract_prefix(self.document))
)
)
wrapper.append(
"\\def\\doctitle{{{n}}}".format(n=_latex_convert(doc_attributes["title"]))
)
#wrapper.append(
# "\\def\\doctitle{{{n}}}".format(n=_latex_convert(doc_attributes["title"]))
#)
wrapper.append(
"\\def\\docref{{{n}}}".format(n=_latex_convert(doc_attributes["ref"]))
)
Expand Down Expand Up @@ -868,24 +868,30 @@ def _generate_latex_wrapper(self):

graphics_present = False
# To include graphics listed in yaml file after the beginning of the document but before the matrix.
for graphics, label in template_data["include_graphics"].items():
graphics_present = True
if label:
adjusted_label = str(label).replace("['", "").replace("']", "")
label_line = "\\section{" + adjusted_label + "}"
else:
label_line = "section{Image_1}"
wrapper.append(label_line)
wrapper.append("\\begin{figure}[ht!]")
wrapper.append("\\begin{center}")
wrapper.append("\\includegraphics[angle=90, height=20cm, width=\\textwidth]{" + graphics + "}")
wrapper.append("\\end{center}")
wrapper.append("\\end{figure}")
wrapper.append("\\newpage")
wrapper = _add_comment(
wrapper, "END data from the template configuration file."
)
if "include_graphics" in template_data:
for graphics, label in template_data["include_graphics"].items():
graphics_present = True
if label:
adjusted_label = str(label).replace("['", "").replace("']", "")
label_line = "\\section{" + adjusted_label + "}"
else:
label_line = "section{Image_1}"
wrapper.append(label_line)
wrapper.append("\\begin{figure}[ht!]")
wrapper.append("\\begin{center}")
wrapper.append("\\includegraphics[angle=90, height=20cm, width=\\textwidth]{" + graphics + "}")
wrapper.append("\\end{center}")
wrapper.append("\\end{figure}")
wrapper.append("\\newpage")
wrapper = _add_comment(
wrapper, "END data from the template configuration file."
)
else:
wrapper = _add_comment(
wrapper, "No graphics information in template to be added to published document. Skipping..."
)
wrapper.append("")

if graphics_present:
wrapper = _add_comment(
wrapper, "No empty page needed before traceability matrix / graphics present."
Expand All @@ -900,7 +906,7 @@ def _generate_latex_wrapper(self):
wrapper.append("")

# Include traceability matrix
if self.matrix:
if template_data["traceability_matrix"] == True:
wrapper = _add_comment(wrapper, "Add traceability matrix.")
wrapper.append("\\section{Traceability Matrix}")
wrapper.append("\\input{traceability.tex}")
Expand Down

0 comments on commit 6068c09

Please sign in to comment.