Compare commits

...

2 Commits

5 changed files with 61 additions and 5 deletions

View File

@ -2,6 +2,7 @@ archive.pdf: intro.pdf requirements.pdf design-doc.pdf \
binary/techreview-ryan.pdf techreview-daniel.pdf binary/techreview-matt.pdf \
binary/blog-ryan.pdf blog-daniel.pdf binary/blog-matt.pdf \
readme.pdf resources.pdf reflection.pdf listings.pdf images.pdf review.pdf todo.pdf
ruby toc.rb
pdfjam --no-tidy --outfile archive.pdf -- intro.pdf requirements.pdf design-doc.pdf \
binary/techreview-ryan.pdf techreview-daniel.pdf binary/techreview-matt.pdf \
binary/blog-ryan.pdf blog-daniel.pdf binary/blog-matt.pdf \
@ -72,7 +73,10 @@ review-collar.tex: external/collar/REVIEW.md
review.pdf: review-app.tex review-server.tex review-collar.tex review.tex
pdflatex review.tex
intro.pdf: intro.tex
generated.toc:
touch generated.toc
intro.pdf: intro.tex generated.toc
pdflatex intro.tex
blog-daniel.pdf: external/blog-daniel/blog.tex

View File

@ -2,6 +2,8 @@ with import <nixpkgs> {};
mkShell {
buildInputs = [
pdftk
ruby
pandoc
(texlive.combine {
inherit (texlive)

View File

@ -72,8 +72,8 @@
\end{titlepage}
\pagebreak
\section*{Foreword}
% TODO
\section*{Table of Contents}
\input{generated.toc}
\pagebreak
\section{Project Introduction}

View File

@ -34,8 +34,11 @@ All of these components work together to provide the required functionality of t
\begin{figure}[h]
\centering
\includegraphics[width=0.8\linewidth]{stack.png}
\caption{Project Structure Diagram}
\end{figure}
The following sections are generated from the README files found in the repositories for this project. In case there are some visual bugs (which is not uncommon with LaTeX generated from Markdown), please refer to the original markdown files found in the project archive.
\pagebreak
\input{readme-app.tex}
@ -47,8 +50,6 @@ All of these components work together to provide the required functionality of t
\pagebreak
\input{readme-gateway.tex}
\pagebreak
\input{readme-collar.tex}
\end{document}

49
toc.rb Normal file
View File

@ -0,0 +1,49 @@
def all_pages(name, pdf)
return [:pdf, name, pdf]
end
def all_no_entry(name, pdf)
return [:pdf_no_entry, name, pdf]
end
def section_offset(name, page)
return [:section, name, page]
end
pdf_structure = [
all_no_entry("Introduction", "intro.pdf"),
all_pages("Requirements Document", "requirements.pdf"),
all_pages("Design Document", "design-doc.pdf"),
all_pages("Ryan Alder's Tech Review", "binary/techreview-ryan.pdf"),
all_pages("Danila Fedorin's Tech Review", "techreview-daniel.pdf"),
all_pages("Matthew Sessions' Tech Review", "binary/techreview-matt.pdf"),
all_pages("Ryan Alder's Blog Posts", "binary/blog-ryan.pdf"),
all_pages("Danila Fedorin's Blog Posts", "blog-daniel.pdf"),
all_pages("Matthew Sessions' Blog Posts", "binary/blog-matt.pdf"),
all_pages("Project Documentation and READMEs", "readme.pdf"),
all_pages("Learning Resources", "resources.pdf"),
all_pages("Conclusions and Reflections", "reflection.pdf"),
all_pages("Appendix 1: Essential Code Listings", "listings.pdf"),
all_pages("Appendix 2: Project Images", "images.pdf"),
all_pages("Appendix 2: Code Review Changes", "review.pdf"),
all_pages("Appendix 4: Remaining Work", "todo.pdf")
]
toc = File.open("generated.toc", "w")
page_tally = 1
section_counter = 1
pdf_structure.each do |entry|
next unless entry[0] == :pdf or entry[0] == :pdf_no_entry
type, name, pdf = entry
page_count = `pdftk #{pdf} dump_data | grep NumberOfPages`.split(":")[1].to_i
output = "\\contentsline {section}{\\numberline {#{section_counter}}#{name}}{#{page_tally}}%"
if type == :pdf
toc.puts output
puts output
end
section_counter += 1
page_tally += page_count
end