The purpose of this small library is to provide functions to turn an XML-like source file of CV information into two formats:
pdflatex
.This allows one to create two versions of a CV from a single .cv file. An example file is given by the file info.cv
in this repository.
The format of a .cv (as seen in info.cv
) is as follows:
<title> Your name </title>
<topic>
Topic 1
<item>
Put something about topic 1 here.
</topic>
<topic>
Topic 2
<item>
<topic>
Subtopic 2a
<item>
Put something about Subtopic 2a here.
</topic>
<topic>
Subtopic 2b
<item>
Put something about Subtopic 2b here. <newline>
Put this <italic> italicized text </italic> on a new line. <newline>
On this new line, the user will see <hyperlink> this text <url> myUrl </hyperlink>
as a link to the url myUrl.
</topic>
</topic>
Each topic are put into the first column of the overall table. The information after <item>
is put into
the second column. The second column is capable of having a sub-table that is captured by using subtopics.
Subtopics are placed after the <item>
tag of the parent topic.
The use of tabs and newlines are up to you. The parser ignores white space after tags (including newlines and tabs).
Furthermore, the newlines are always ignored; so use them freely for formatting. If you wish to put some text on
a newline for the final output, then use the <newline>
tag.
If you wish for text to be italicized, then put it between the <italic>
tag and the </italic>
tag.
For a hyperlink, put the label as it appears to the user between the <hyperlink>
tag and the <url>
tag. Then put the actual url between the <url>
tag and the </hyperlink>
tag.
An example of how to do this is provided in src/Main.hs
inside this repository. After the .cv
file is opened, we parse its contents into the data type CV
using the function parseCV :: String -> Either ParseError CV
. The parsing uses the standard Parsec library, so it keeps track of Errors using the Either
monad.
Then we can use the function convertCV :: CV -> LatexText
and convertCV :: CV -> JekyllText
to turn the CV
type into Latex text and Jekyll text, respectively.
You could have the case that you wish to have different versions of your CV, for example a public CV that doesn't
list your contact information and a private CV that does. Here we will describe how to set up a script to do
so with this project. Suppose your directories are set-up in the following manner (we will be creating a bash script CVS/convertCVs.sh
later).
- CVWriter
- stack.yaml
- CVs
- Private
- info.cv
- Public
- info.cv
- convertCVs.sh
The contents of CVs/convertCVs.sh
will be the following
targetYaml=../CVWriter/stack.yaml
for dir in ./Private/ ./Public/
do
stack --stack-yaml ${targetYaml} exec CVWriter ${dir} info.cv
pdflatex -output-directory ${dir} ${dir}/*.tex
done
Then we can properly run CVWriter
and pdflatex
on each info.cv
file by running the following from
the CVs
directory:
sh convertCVs.sh
These instructions are of course for using Bash scripts, but the idea can be transferred to any appropriate scripting language for your system.