Skip to content

Commit

Permalink
Add latex IO and CI
Browse files Browse the repository at this point in the history
also readme
  • Loading branch information
Theo-Hafsaoui committed Aug 21, 2024
1 parent 4eaabb9 commit 55148da
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
push:

jobs:
lint:
name: Run Linter
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
- name: Run linter
run: make lint

22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test

on:
push:

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Run tests
run: make test

139 changes: 139 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
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.
163 changes: 163 additions & 0 deletions assets/latex/template/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
%-------------------------
% 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}
\usepackage{fontawesome5}
\usepackage{xfakebold}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\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}
\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
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}
\hypersetup{
filecolor=magenta,
urlcolor=Nblack,
pdftitle={Overleaf Example},
pdfpagemode=FullScreen,
}
\urlstyle{same}

\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]

% Ensure that generate pdf is machine readable/ATS parsable
\pdfgentounicode=1

%-------------------------
% Custom commands
\newcommand{\resumeItem}[1]{
\item\small{
{#1 \vspace{-2pt}}
}
}

\newcommand{\resumeSubheading}[4]{
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l@{\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{\small#3} & \textit{\small #4} \\
\end{tabular*}\vspace{-7pt}
}

\newcommand{\resumeSubSubheading}[2]{
\item
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
\textit{\small#1} & \textit{\small #2} \\
\end{tabular*}\vspace{-7pt}
}

\newcommand{\resumeProjectHeading}[2]{
\item
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
\small#1 & #2 \\
\end{tabular*}\vspace{-7pt}
}

\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}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}

%-------------------------------------------
%%%%%% RESUME STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\begin{center}
\textbf{\Huge \scshape \textcolor{nblue}{Hafsaoui Theo}} \\ \vspace{1pt}
\small +33 6 26 26 50 07 $|$ \href{mailto:theo.ha@pm.me}{\underline{theo.ha@pm.me}} \\
\href{https://linkedin.com/in/theo-dev/}{\underline{linkedin.com/in/theo-dev}} $|$
\href{https://github.com/Theo-Hafsaoui}{\underline{github.com/Theo-Hafsaoui}}
\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={}]
\small{\item{
}}
\end{itemize}

%-------------------------------------------
\end{document}
26 changes: 26 additions & 0 deletions internal/parser/latex.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package parser

import "os"

//Apply a section to a section type on a latex template
//func (section section, type section_type, template string)

//to write this template
//func write(template string, name string)
//Todo

//Read the template file in the assets directory
func read_template()(string,error) {
file, err := os.ReadFile("../../assets/latex/template/template.tex")
if err != nil {
return "", err
}
return string(file), nil
}

//Write the template file in the assets directory
func writeTemplate(template string, name string)error{
err := os.WriteFile("../../assets/latex/output/"+name+".tex",
[]byte(template), 0644)
return err
}
Loading

0 comments on commit 55148da

Please sign in to comment.