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 4e3fed8
Show file tree
Hide file tree
Showing 33 changed files with 2,015 additions and 912 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 ./...
207 changes: 68 additions & 139 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,139 +1,68 @@
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.
![Anemon Project](https://github.com/user-attachments/assets/1399b964-5dfc-4dd5-b9ed-f333a3f768fe)

# Anemon: CV Management and Generation

Anemon is a simple tool designed to help you manage and generate tailored CVs.
Crafting personalized CVs for every job application can be tedious and time-consuming, but Anemon aims to simplifies the process by focusing on two key features:

1. **Language Support**
Anemon allows you to maintain CVs in multiple languages. Each language is represented by a separate directory (e.g., `eng` for English, `fr` for French),
where you can organize the corresponding sections of your CV.

2. **Variant Support**
Variants make each CV unique by emphasizing specific keywords that align with a given application.
Anemon helps highlight these keywords and prioritizes relevant content to bring your skills to the forefront.

If your CV becomes too lengthy, Anemon can automatically trim it by removing sections that lack or have insufficient emphasis on your chosen keywords.
This allows you to be detailed in your Markdown source files without worrying about verbosity—irrelevant details will be excluded in the final CV.

![Preview image](https://github.com/user-attachments/assets/19161e85-c666-40d1-978c-df4857075f13)

### Getting Started

#### How to Create Your CV
To create your own CV, it is recommended to start with this repository, as the structure should be, I hope, intuitive.
Two critical elements need your attention:
1. **The CV Directory**
Each language has its own directory inside the `CV` folder. Within each language directory, you'll find Markdown documents representing
mandatory sections of the CV. These sections may vary in structure as some require more details (e.g., dates or years). The existing examples should suffice, but if you have any questions, don't hesitate to open an issue.
2. **The `params.yaml` File**
This file contains your personal information and the profile(s) you want to generate CVs for. Each profile will create a new CV.

#### Using GitHub (Recommended)
To create your CV:
1. **Fork** this repository.
2. Update the `params.yaml` and CV 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.

![Action Tab](https://github.com/user-attachments/assets/f15c7c71-022b-4bf2-b79d-2e5ef5f1e65e)

#### Running Locally
You can run Anemon locally using one of the following methods:

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

```bash
docker build -t anemon .
make run-docker
```

2. **Running Natively**
Alternatively, build and run Anemon natively using the `Makefile`:
```bash
./anemon -g
```
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.

### Personalization
You may want to customize the templates to fit your needs. Feel free to modify or create new templates, but ensure the `%something%` placeholders remain intact,
as these serve as anchors for Anemon. If you want you can even share it by...

### Contribute
Anemon has room for improvement and expansion. Contributions to enhance functionality or fix issues are welcome.
Many parts of the project were initially designed as workarounds for personal use and can be improved.
For example, the limited templates available reflect its original focus on personal needs.
Loading

0 comments on commit 4e3fed8

Please sign in to comment.