Skip to content

Commit

Permalink
Merge pull request #14 from thomasoca/fix-unescape-latex-character
Browse files Browse the repository at this point in the history
Fix unescape latex character
  • Loading branch information
thomasoca authored Jan 20, 2023
2 parents 8e124bf + 2b8c395 commit 209b4ef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ A web app and CLI tool to generate beautiful LaTeX resume using available open s
https://cv-generator-40m5.onrender.com

## Available templates
* A slightly modified [AltaCV](https://github.com/liantze/AltaCV). The original altacv latex class was written by LianTze Lim (liantze@gmail.com).

- A slightly modified [AltaCV](https://github.com/liantze/AltaCV). The original altacv latex class was written by LianTze Lim (liantze@gmail.com).

### Template Modifications

Expand All @@ -32,7 +33,7 @@ cv-generator serve

Optional flags:

- `--port [PORT]`: specify port to run, default at `8080`
- `--port [PORT]`: specify port to run, default at `8170`

### Run as CLI app

Expand All @@ -46,13 +47,13 @@ Optional flags:

## Installation

### Docker (web app)
### Docker

Make sure to install Docker in your system

1. Navigate to the project roots directory, and build the Docker image `docker build -t [TAG_NAME] .`
2. Run the image and bind the port, i.e. on port 8080 `docker run -p 8080:8080 [TAG_NAME]`
3. Navigate to `localhost:8080` or any other ports that defined in the previous step
2. Run the image and bind the port, i.e. on port 8080 `docker run -p 8170:8170 [TAG_NAME]`
3. Navigate to `localhost:8170` or any other ports that defined in the previous step

### Local Installation

Expand Down
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func serveHttpServer(port string) {
mux.HandleFunc("/api/v1/generate", handlers.GenerateFileHandler)
mux.HandleFunc("/api/v1/example", handlers.ExampleFileHandler)
if port == "" {
port = "8080"
port = "8170"
log.Printf("defaulting to port %s", port)
}
if err := http.ListenAndServe(":"+port, mux); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"build": "react-app-rewired build",
"test": "react-scripts test --env=jsdom"
},
"proxy": "http://localhost:8080",
"proxy": "http://localhost:8170",
"eslintConfig": {
"extends": [
"react-app",
Expand Down
12 changes: 11 additions & 1 deletion pkg/generator/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ import (
)

func replaceUnescapedChar(str string) string {
return strings.ReplaceAll(str, "_", "{\\_}")
s := strings.NewReplacer(
"_", "{\\_}",
"#", "{\\#}",
"%", "{\\%}",
"&", "{\\&}",
"$", "{\\$}",
"{", "{\\{}",
"}", "{\\}}",
)

return s.Replace(str)
}

func createLatexFile(fg FileGenerator) error {
Expand Down

0 comments on commit 209b4ef

Please sign in to comment.