-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f42a1c
commit e68c97b
Showing
9 changed files
with
114 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
FROM golang:1.23 as build | ||
FROM golang:1.23 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download && go mod verify | ||
|
||
COPY . . | ||
RUN make build | ||
RUN ./anemon generate | ||
|
||
FROM debian:latest | ||
COPY --from=build /app/assets/latex/output/ /internal_output | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
texlive \ | ||
texlive-latex-extra \ | ||
texlive-fonts-extra \ | ||
texlive-xetex \ | ||
texlive-font-utils \ | ||
fonts-font-awesome \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
fonts-font-awesome && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN make build | ||
|
||
CMD mkdir -p /tmp_output && cd /internal_output && for i in *.tex; do pdflatex $i -output-directory=/tmp_output || true; done && ls && pwd && ls /tmp_output && cp /internal_output/*.pdf /output/ | ||
CMD ["./anemon", "generate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package output | ||
|
||
import ( | ||
"fmt" | ||
"log/slog" | ||
"os" | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
|
||
const COMPILER = "pdflatex" | ||
type LatexCompiler struct{} | ||
|
||
//Compile the template into PDF | ||
func (*LatexCompiler) CompileTemplate(root string)error{ | ||
templates,err := getListOfTemplate(root);if err != nil { | ||
return err | ||
} | ||
for _,template := range templates{ | ||
cmd := exec.Command(COMPILER,"-interaction=nonstopmode", | ||
"-output-directory="+root+"/assets/latex/output", template ) | ||
log, err := cmd.Output(); if err != nil { | ||
slog.Info("---FROM pdflatex ---\n"+string(log)) | ||
slog.Error("failed to compile file:"+template) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
//Return the path of latex file inside the template directory | ||
func getListOfTemplate(root string)([]string, error){ | ||
var res []string | ||
templates, err := os.ReadDir(root + "/assets/latex/output"); if err != nil { | ||
slog.Error("failed to read directory because: "+ err.Error()) | ||
return res,err | ||
} | ||
for _, template := range templates { | ||
if strings.HasSuffix(template.Name(),".tex"){ | ||
res = append(res, root+"/assets/latex/output/"+template.Name()) | ||
} | ||
} | ||
fmt.Println(res) | ||
return res,nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters