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 threshold
* Add log to md parser
* Add info flag
  • Loading branch information
Theo-Hafsaoui committed Dec 22, 2024
1 parent 4014157 commit 19f6220
Show file tree
Hide file tree
Showing 32 changed files with 1,864 additions and 910 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"]
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 $(pwd)/assets/latex/output:/app/assets/latex/output anemon:latest

clean:
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 ./...
138 changes: 0 additions & 138 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,139 +1 @@
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.

## Project Overview

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

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.

## Example `output.yml`

Below is an example of an `output.yml` configuration file:

```yaml
info:
name:aNemoN
first_anem:NoName
phone_number:+33....
ect..
foo:
- FooFeature1
- FooFeature2
- FooFeature3

bar:
- BarFeature1
- BarFeature2
- BarFeature3
```
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.
## Example Directory Structure
Here’s an example of a canonical directory structure for the CV content:
```
cv/
├── eng
│ ├── education.md
│ ├── project.md
│ └── work.md
└── fr
├── education.md
├── project.md
└── work.md
```

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`.

## 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.
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{Technical 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 19f6220

Please sign in to comment.