diff --git a/plab/tests/testsToLatex.go b/plab/tests/testsToLatex.go index 0eb2a77711e7780371559d2a3178996ea0db0340..30e3348ab98b2c633ca2df74f8b0bb117dacdd7a 100644 --- a/plab/tests/testsToLatex.go +++ b/plab/tests/testsToLatex.go @@ -18,7 +18,8 @@ var TestsToLatex = helpers.Subcommand{ if e != nil { panic(e) } - var buf bytes.Buffer + var seq bytes.Buffer + var com bytes.Buffer for _, t := range tests { e := runTest(dir + t.Name()) if e != nil { @@ -28,8 +29,16 @@ var TestsToLatex = helpers.Subcommand{ if e != nil { panic(e) } - b, e := ioutil.ReadFile("../seq.latex") - buf.WriteString("\\subsubsection{") + seqb, e := ioutil.ReadFile("../seq.latex") + if e != nil { + panic(e) + } + commb, e := ioutil.ReadFile("../comm.latex") + if e != nil { + panic(e) + } + seq.WriteString("\\subsubsection{") + com.WriteString("\\subsubsection{") testname := "" tmp := strings.Split(t.Name(), ".") for i, part := range tmp { @@ -40,21 +49,39 @@ var TestsToLatex = helpers.Subcommand{ testname += "." } } - buf.WriteString(testname) - buf.WriteString("}\n") - buf.WriteString(` + seq.WriteString(testname) + com.WriteString(testname) + seq.WriteString("}\n") + com.WriteString("}\n") + seq.WriteString(` \begin{figure}[H] \begin{center} \resizebox{\textwidth}{\textheight-2cm}{`) - buf.Write(b) - buf.WriteString(` + seq.Write(seqb) + seq.WriteString(` } \end{center} \end{figure} `) - buf.WriteString("\n\\newpage\n") + seq.WriteString("\n\\newpage\n") + + com.WriteString(` +\begin{figure}[H] + \begin{center} + \resizebox{\textwidth}{\textheight-2cm}{`) + com.Write(commb) + com.WriteString(` + } + \end{center} +\end{figure} +`) + com.WriteString("\n\\newpage\n") + } + e = ioutil.WriteFile("/tmp/testseq.latex", seq.Bytes(), os.ModePerm) + if e != nil { + panic(e) } - e = ioutil.WriteFile("/tmp/testseq.latex", buf.Bytes(), os.ModePerm) + e = ioutil.WriteFile("/tmp/testcom.latex", com.Bytes(), os.ModePerm) if e != nil { panic(e) } @@ -68,5 +95,10 @@ func plantumlToLatex() error { fmt.Println(string(b)) return e } + b, e = exec.Command("plantuml", "-tlatex:nopreamble", "../comm.puml").CombinedOutput() + if e != nil { + fmt.Println(string(b)) + return e + } return nil }