-
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 70ad222
Showing
8 changed files
with
129 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Fedora 40) (preloaded format=pdflatex 2024.11.11) 11 NOV 2024 15:42 | ||
entering extended mode | ||
restricted \write18 enabled. | ||
%&-line parsing enabled. | ||
**/home/theo/projects/Anemon/assets/latex/output/.gitignore | ||
(/home/theo/projects/Anemon/assets/latex/output/.gitignore | ||
LaTeX2e <2022-11-01> patch level 1 | ||
L3 programming layer <2023-02-22> | ||
! You can't use `macro parameter character #' in vertical mode. | ||
l.1 # | ||
Ignore everything in this directory | ||
? | ||
! Emergency stop. | ||
l.1 | ||
|
||
End of file on the terminal! | ||
|
||
|
||
Here is how much of TeX's memory you used: | ||
17 strings out of 476041 | ||
526 string characters out of 5793163 | ||
1849388 words of memory out of 6000000 | ||
20570 multiletter control sequences out of 15000+600000 | ||
512287 words of font info for 32 fonts, out of 8000000 for 9000 | ||
1137 hyphenation exceptions out of 8191 | ||
13i,0n,12p,126b,10s stack positions out of 10000i,1000n,20000p,200000b,200000s | ||
! ==> Fatal error occurred, no output PDF file produced! |
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