Skip to content

Commit

Permalink
Add sorting and Params
Browse files Browse the repository at this point in the history
* Change project to hexagonal
* Add params.yml
* Add sorting
* add yaml adapter
* add compiler
* modify CI to use compiler
* Change base img for quicker start
* Add section removal in case of pageOverflow
* Change service to builder pattern
* Add Sections name translation
* Add threshold
* Add log to md parser
* Add info flag
* Update Readme
  • Loading branch information
Theo-Hafsaoui committed Dec 22, 2024
1 parent 4014157 commit 12f75a7
Show file tree
Hide file tree
Showing 33 changed files with 1,978 additions and 899 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ jobs:
run: docker build . -t anemon

- name: Run Docker container
run: docker run --rm -v ${{ github.workspace }}/assets/latex/output:/output anemon
run: docker run --rm -v ${{ github.workspace }}/assets/latex/output:/app/assets/latex/output anemon

- name: LSINFO
run: ls -al && tree

- name: Upload compiled PDF
uses: actions/upload-artifact@v4
Expand Down
18 changes: 2 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23 as build
FROM ghcr.io/theo-hafsaoui/go-latex-img:c800f95

WORKDIR /app

Expand All @@ -7,19 +7,5 @@ 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 \
texlive \
texlive-latex-extra \
texlive-fonts-extra \
texlive-xetex \
texlive-font-utils \
fonts-font-awesome \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

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", "-g"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 HAFSAOUI Theo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@

run:
echo "Not yet complete"

run-docker:
sudo docker run -v $(realpath ./assets/latex/output):/app/assets/latex/output anemon:latest

clean:
sudo rm ./assets/latex/output/*

build:
go build

lint:
golangci-lint run ./...

fmt:
gofmt -s -w .

tidy:
go mod tidy

test:
go test ./...
go test -v ./...
159 changes: 33 additions & 126 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,139 +1,46 @@
This project is a simple tool written in Go that generates customized CVs from a directory of Markdown files. The CVs are generated based on a provided `output.yml` file, which specifies different skill sets or features (e.g., "foo" or "bar"). The generated CVs are output in LaTeX format and can be compiled locally or using GitHub Actions.
![Anemon Project](https://github.com/user-attachments/assets/1399b964-5dfc-4dd5-b9ed-f333a3f768fe)

## Project Overview
---

Given a directory structure containing Markdown files for different sections of a CV (e.g., education, projects, work experience), this tool will:
### Description

1. Parse the directory structure and extract relevant sections for both English and French CVs.
2. Use the provided `output.yml` configuration to determine which features or skills to prioritize in different versions of the CV.
3. For each type (e.g., "foo", "bar") specified in `output.yml`, search the corresponding sections for matching lines. These lines will be moved higher in the CV and emphasized (e.g., through formatting) to draw attention to them.
4. Generate CVs for each type specified in the `output.yml`. The number of CVs generated will depend on the number of types defined. For instance, if there are two types (e.g., "foo" and "bar"), four CVs will be generated (Foo in English, Foo in French, Bar in English, Bar in French). If there are more types, the number of CVs will increase accordingly.
5. The generated CVs are first output in LaTeX format, which can then be compiled into a final PDF.
![Preview Image](https://github.com/user-attachments/assets/845cbda0-89ee-4603-8374-0414a9c50a4a)

## Example `output.yml`
### Getting Started
#### GitHub (Recommended)
To create your CV:
1. **Fork** this repository.
2. Update the `params.yaml` file with your information.
3. Once updated, the CI/CD pipeline will compile the CVs and publish them as artifacts on GitHub.
- Navigate to the **Actions** tab (next to the Pull Requests tab).
- Select the **Compile LaTeX Document** workflow.
- Inside the workflow, click on the job corresponding to your desired CV and download the `compiled-pdf.zip` file from the artifacts section.

Below is an example of an `output.yml` configuration file:
![Action Tab](https://github.com/user-attachments/assets/f15c7c71-022b-4bf2-b79d-2e5ef5f1e65e)

```yaml
info:
name:aNemoN
first_anem:NoName
phone_number:+33....
ect..
foo:
- FooFeature1
- FooFeature2
- FooFeature3
#### Local
You can run Anemon locally using one of the following methods:

bar:
- BarFeature1
- BarFeature2
- BarFeature3
```
1. **Using Docker**
Build the Docker image and run it using the provided `Makefile`. This setup creates a volume to simplify PDF extraction.

This configuration file indicates that for each "foo" and "bar" type CV, the tool will search the relevant sections for "FooFeature1", "FooFeature2", "FooFeature3" (and similarly for "Bar"). Any line containing these features will be moved higher in the CV and emphasized (e.g., bolded or italicized) in the LaTeX output. The number of CVs generated depends on the number of types (e.g., "foo" and "bar") specified.
```bash
docker build -t anemon .
make run-docker
```

## Example Directory Structure
2. **Running Natively**
Alternatively, build and run Anemon natively using the `Makefile`:

Here’s an example of a canonical directory structure for the CV content:
```bash
./anemon -g
```

```
cv/
├── eng
│ ├── education.md
│ ├── project.md
│ └── work.md
└── fr
├── education.md
├── project.md
└── work.md
```
This approach requires a local installation of LaTeX and its necessary packages. Refer to the `Dockerfile` for the list of required dependencies and install their equivalents for your system.

The structure includes separate directories for English (`eng`) and French (`fr`) versions of the CV. Each directory contains Markdown files for different sections of the CV, such as `education.md`, `project.md`, and `work.md`.
### Personalization
You may want to customize the templates to fit your needs. You’re free to modify or create new templates, but ensure the `%something%` placeholders remain intact, as these serve as anchors for Anemon.

## Workflow

### Conceptual Flow

The following sequence diagram outlines the process flow of the tool:

```mermaid
sequenceDiagram
CV->>+DirectoryReader: Ask to read the output.yml
DirectoryReader-->>-CV: Return the Output
CV->>+DirectoryReader: Ask to read the CV directory tree
DirectoryReader-->>-CV: Return the Sections
CV->>CV: Search for features and prioritize them
CV->>CV: Create the LaTeX CV variants
CV -->>System: Launch the compilation of the CVs
```

### Class Design

The following class diagram illustrates the key components of the system:

```mermaid
classDiagram
direction RL
CV -- ProjectSection
CV -- SkillsSection
CV -- EducationSection
CV -- DirectoryReader
CV -- Output
CV -- ProfessionalSection
class CV{
Section sections
generateLatexCV()
compileLatexCV()
}
class Output{
map[string]string Target
}
class DirectoryReader{
Array<Section> getSections()
Output getOutput()
}
namespace Section {
class ProjectSection {
String Title
String Description
String Skill
String Link
void SortFor(output)
}
class ProfessionalSection {
String Title
String Description
String Skill
String Link
void SortFor(output)
}
class SkillsSection {
Array<String> Skill
void SortFor(output)
}
class EducationSection {
String Title
String Description
String Link
void SortFor(output)
}
}
```

## How to Use

1. **Clone the Repository**: Clone this repository to your local machine.
2. **Prepare Your Directory**: Structure your directory with Markdown files as shown in the example above.
3. **Create Your `output.yml`**: Define your CV variations and the features to prioritize in an `output.yml` file.
4. **Run the Tool**: Execute the Golang program to generate LaTeX files, where specified features are prioritized and emphasized.
5. **Compile the LaTeX Files**: Compile the generated LaTeX files to produce your final CV PDFs. This can be done locally or using GitHub Actions.
### Contribute
Anemon has room for improvement and expansion. Contributions to enhance functionality or fix issues are welcome. Many parts of the project are currently implemented with workaround solutions that could be improved.
Feel free to propose changes that add value to the project!
103 changes: 35 additions & 68 deletions assets/latex/template/template.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
%-------------------------
% Resume in Latex
% Author : Jake Gutierrez
% Based off of: https://github.com/sb2nov/resume
% License : MIT
%------------------------

\documentclass[letterpaper,11pt]{article}

\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
Expand All @@ -21,34 +16,13 @@
\usepackage{xcolor}
\usepackage[english]{babel}
\usepackage{tabularx}
\definecolor{Nblack}{HTML}{3b4252}
\definecolor{NBLACK}{HTML}{2e3440}
\definecolor{Nwhite}{HTML}{eceff4}
\definecolor{nwhite}{HTML}{e5e9f0}
\definecolor{Nblue}{HTML}{5e81ac}
\definecolor{Nurl}{HTML}{8fbcbb}
\definecolor{nblue}{HTML}{005A92}
\definecolor{nblue}{HTML}{005A92}
\input{glyphtounicode}


%----------FONT OPTIONS----------
% sans-serif
% \usepackage[sfdefault]{FiraSans}
% \usepackage[sfdefault]{roboto}
% \usepackage[sfdefault]{noto-sans}
% \usepackage[default]{sourcesanspro}

% serif
% \usepackage{CormorantGaramond}
% \usepackage{charter}


\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyhf{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
Expand Down Expand Up @@ -106,9 +80,7 @@
}

\newcommand{\resumeSubItem}[1]{\resumeItem{#1}\vspace{-4pt}}

\renewcommand\labelitemii{$\vcenter{\hbox{\tiny$\bullet$}}$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=0.15in, label={}]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
Expand All @@ -120,43 +92,38 @@

\begin{document}

\begin{center}
\textbf{\Huge \scshape \textcolor{nblue}{Anemon Vincent}} \\ \vspace{1pt}
\small +33 6 26 26 50 07 $|$ \href{mailto:anemon@pm.me}{\underline{anemon@pm.me}} \\
\href{https://linkedin.com/in/anemon/}{\underline{linkedin.com/in/anemon}} $|$
\href{https://github.com/anemon}{\underline{github.com/anemon}}
\end{center}
%VARS%
\begin{center}
\textbf{\Huge \scshape \textcolor{nblue}{\Name \ \FirstName}} \\ \vspace{1pt}
\small \Number \ $|$ \href{mailto:\Mail}{\underline{\Mail}} \\
\href{\LinkedIn}{\underline{linkedin.com/in/\Name}} $|$
\href{\GitHub}{\underline{github.com/\Name}}
\end{center}

%-----------EDUCATION-----------
\section{EDUCATION}
\resumeSubHeadingListStart
%EDUCATION_SECTIONS%
\resumeSubHeadingListEnd

%-----------EXPERIENCE-----------
\section{EXPERIENCE}
\resumeSubHeadingListStart
%EXPERIENCE_SECTIONS%
\resumeSubHeadingListEnd

%-----------PROJECTS-----------
\section{Projects}
\resumeSubHeadingListStart
%PROJECTS_SECTIONS%
\resumeSubHeadingListEnd

%-----------PROGRAMMING SKILLS-----------
\section{Skills}
\begin{itemize}[leftmargin=0.15in, label={}]
%SKILL_SECTIONS%
\end{itemize}

%-------------------------------------------


%-----------EDUCATION-----------
\section{EDUCATION}
\resumeSubHeadingListStart
%EDUCATION_SECTIONS%
\resumeSubHeadingListEnd


%-----------EXPERIENCE-----------
\section{EXPERIENCE}
\resumeSubHeadingListStart
%EXPERIENCE_SECTIONS%
\resumeSubHeadingListEnd



%-----------PROJECTS-----------
\section{Projects}
\resumeSubHeadingListStart
%PROJECTS_SECTIONS%
\resumeSubHeadingListEnd



%
%-----------PROGRAMMING SKILLS-----------
\section{Technical Skills}
\begin{itemize}[leftmargin=0.15in, label={}]
%SKILL_SECTIONS%
\end{itemize}

%-------------------------------------------
\end{document}
Loading

0 comments on commit 12f75a7

Please sign in to comment.