diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..da3a0cc --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +image: najeraoscar/latex-emacs-min + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +before_script: + - ./installs.sh + +test: + script: + - emacs --batch -Q --script genfiles.el + - cd doc; hugo + except: + - master + + artifacts: + paths: + - doc/public + +pages: + script: + - emacs --batch -Q --script genfiles.el + - cd doc; hugo + - mv doc/public/ public/ + artifacts: + paths: + - public + only: + - master diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..33c882c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "doc/themes/project-landing-page"] + path = doc/themes/project-landing-page + url = https://github.com/Titan-C/github-project-landing-page.git diff --git a/doc/config.toml b/doc/config.toml new file mode 100644 index 0000000..fe1bf62 --- /dev/null +++ b/doc/config.toml @@ -0,0 +1,24 @@ +baseURL = "https://titan-c.gitlab.io/org-cv/" +languageCode = "en-us" +title = "Org CV backend export" +theme = "project-landing-page" + +[params] + description = "Org-mode backend exporters for CV" + author_url = "http://blog.oscarnajera.com" + author = "Titan-C" + project_url = "https://gitlab.com/Titan-C/org-cv/" + logo = "https://upload.wikimedia.org/wikipedia/commons/a/a6/Org-mode-unicorn.svg" + + first_color="#f8f8f8" + first_border_color="#e7e7e7" + first_text_color="#333" + + second_color="white" + second_text_color="#333" + + header_color="#f8f8f8" + header_text_color="rgb(51, 51, 51)" + + header_link_color="#777" + header_link_hover_color="rgb(51, 51, 51)" diff --git a/doc/content/post/basic_config.md b/doc/content/post/basic_config.md new file mode 100644 index 0000000..4ab5c85 --- /dev/null +++ b/doc/content/post/basic_config.md @@ -0,0 +1,82 @@ ++++ +title = "Basic Org file" +author = ["Óscar Nájera"] +draft = false +weight = 1003 ++++ + +The basic structure of an org file containing your CV is shown next. + + +## Personal contact information {#personal-contact-information} + +`TITLE`, `AUTHOR` and `EMAIL` are standard org options. But on `TITLE` you +put your foreseen job. + +
+
+ +| Field | Description | +|----------|----------------------------------------------------| +| TITLE | Desired job | +| AUTHOR | Who you are? | +| EMAIL | Your contact email | +| ADDRESS | Mailing address, this can span over multiple lines | +| HOMEPAGE | URL of your website | +| MOBILE | Mobile phone | +| GITHUB | GitHub user | +| GITLAB | GitLab user | +| LINKEDIN | Linkedin username | +| PHOTO | path to photo file | + +
+ +```org +#+TITLE: My dream job +#+AUTHOR: John Doe +#+email: john@doe.lost + +#+ADDRESS: My Awesome crib +#+ADDRESS: Fantastic city -- Planet Earth +#+MOBILE: (+9) 87654321 +#+HOMEPAGE: example.com +#+GITHUB: Titan-C +#+GITLAB: Titan-C +#+LINKEDIN: oscar-najera +#+PHOTO: smile.png +``` + +You can use org-modes hierarchical structure to describe your CV. To make a +specific subtree an item describing an experience point (Job you have, +degree you pursued, etc.) you use the org properties drawer and with the +`:CV_ENV: cventry` property. You should also include the `FROM` and `TO` +properties defining the span of the event, as `LOCATION` and `EMPLOYER`. + +```org +* Employement +** One job +:PROPERTIES: +:CV_ENV: cventry +:FROM: <2014-09-01> +:TO: <2017-12-07> +:LOCATION: a city, a country +:EMPLOYER: The employer +:END: + +I write about awesome stuff I do. +** Other job +:PROPERTIES: +:CV_ENV: cventry +:FROM: <2013-09-01> +:TO: <2014-08-07> +:LOCATION: my city, your country +:EMPLOYER: The other employer +:END: + +I write about awesome stuff I do. + +* Other stuff I do +- I work a lot +- I sleep a lot +- I eat a lot +``` diff --git a/doc/content/post/goal.md b/doc/content/post/goal.md new file mode 100644 index 0000000..c47b50e --- /dev/null +++ b/doc/content/post/goal.md @@ -0,0 +1,11 @@ ++++ +title = "Goal: Export backend for CV" +author = ["Óscar Nájera"] +draft = false +weight = 1001 ++++ + +This project aims to generate from an org-mode file with reasonably ordered +items a latex file which compiles into a reasonably nice CV. In the same +spirit the org-mode file must export to markdown so that it can be uses for +web based CV. diff --git a/doc/content/post/installation.md b/doc/content/post/installation.md new file mode 100644 index 0000000..154ada4 --- /dev/null +++ b/doc/content/post/installation.md @@ -0,0 +1,23 @@ ++++ +title = "Installation" +author = ["Óscar Nájera"] +draft = false +weight = 1001 ++++ + +This project is not on MELPA so you have to do a manual installation. First +clone this git repository. + +```bash +git clone https://gitlab.com/Titan-C/org-cv.git +``` + +There are various modules to perform the export. As of now `ox-moderncv`, +`ox-altacv`, `ox-hugocv`. Choose any or all that you prefer for install. I +use `use-package` to manage the installation for example of `ox-moderncv`. + +```emacs-lisp +(use-package ox-moderncv + :load-path "path_to_repository/org-cv/" + :init (require 'ox-moderncv)) +``` diff --git a/doc/content/post/latex_export.md b/doc/content/post/latex_export.md new file mode 100644 index 0000000..8c0780a --- /dev/null +++ b/doc/content/post/latex_export.md @@ -0,0 +1,94 @@ ++++ +title = "Latex Exporter" +author = ["Óscar Nájera"] +draft = false +weight = 1004 ++++ + +## Using modern-cv {#using-modern-cv} + +[moderncv](https://www.ctan.org/tex-archive/macros/latex/contrib/moderncv) is a standard \\(\LaTeX\\) package that you can find in many of your +latex distributions. For I maintain for personal purposes a fork of it to +better work with my use case at +Feel free to use any or even your personal fork for your desired use case. + +To configure the export for moderncv you need the addition options in your +org file. + +```org +# CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking' +#+CVSTYLE: banking +# CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black' +#+CVCOLOR: green +``` + +When exporting you can call the following function to get the latex file. + +```emacs-lisp +(org-export-to-file 'moderncv "moderncv.tex") +(org-latex-compile "moderncv.tex") +``` + + +

Alternative text - include a link to the PDF!

+
+ + +## Using alta-cv {#using-alta-cv} + +[AltaCV](https://github.com/liantze/AltaCV) is another project to generate a CV, you will need to install it +yourself. I maintain a fork too at +because I need extra features and I encourage to use this fork on the +`sections` branch. + +The style of this CV is more involved and you need some configuration in +your org file to get it to work. First define the margins, the large margin +to the right is to allow for a second column. + +```org +#+LATEX_HEADER: \geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm} +``` + +Content on the right column has the same structure of a org file, but you +need to enclose it in the `\marginpar{}` command as shown next. + +```org +#+latex: \marginpar{ +``` + +```org +* Main Interests +- Free/Libre and Open Source Software (FLOSS) +- Free food +- Free beer + +* Programming +- Python +- C/C++ +- EmacsLisp +- Bash +- JavaScript +- PHP + +* Languages + +- *English* Fluent +- *German* Fluent +- *Spanish* Native +- *French* Intermediate +``` + +```org +#+latex: } +``` + +When exporting you can call the following function to get the latex file. + +```emacs-lisp +(org-export-to-file 'altacv "altacv.tex") +(org-latex-compile "altacv.tex") +``` + + +

Alternative text - include a link to the PDF!

+
diff --git a/doc/smile.png b/doc/smile.png new file mode 100644 index 0000000..96ca071 Binary files /dev/null and b/doc/smile.png differ diff --git a/doc/themes/project-landing-page b/doc/themes/project-landing-page new file mode 160000 index 0000000..24fa397 --- /dev/null +++ b/doc/themes/project-landing-page @@ -0,0 +1 @@ +Subproject commit 24fa3973fe9822c133292fe356132975738c226e diff --git a/genfiles.el b/genfiles.el new file mode 100644 index 0000000..c54be17 --- /dev/null +++ b/genfiles.el @@ -0,0 +1,34 @@ +;; remember the current directory, find-file changes it +(defvar cwd default-directory) +(defvar workdir "/tmp/org-cv-exports/") +(find-file "/tmp/install-org.el") +(eval-buffer) + +(add-to-list 'load-path cwd) + +(require 'ox-moderncv) + +(require 'ox-altacv) + +(let ((readme (concat cwd "readme.org"))) + (find-file readme) + (make-directory workdir t) + (cd workdir) + (org-babel-tangle)) + +(copy-file (concat cwd "doc/smile.png") workdir) + +(defun export-latex (backend file) + (let ((workfile (concat workdir file)) + (outfile (concat workdir file ".tex"))) + (message (format "%s exists: %s" workfile (file-exists-p workfile))) + (find-file workfile) + (org-mode) + (org-export-to-file backend outfile) + (shell-command (format "pdflatex %s" outfile) "*Messages*" "*Messages*") + (copy-file (concat file ".pdf") (concat cwd "/doc/static/" (concat file ".pdf"))) + )) + +(make-directory (concat cwd "/doc/static/") t) +(export-latex 'altacv "altacv.org") +(export-latex 'moderncv "moderncv.org") diff --git a/installs.sh b/installs.sh new file mode 100755 index 0000000..698087a --- /dev/null +++ b/installs.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +wget https://github.com/gohugoio/hugo/releases/download/v0.39/hugo_0.39_Linux-64bit.deb +dpkg -i hugo*.deb + +echo "Installed Hugo:" +hugo version + +# Latex +latexdir=/root/texmf/tex/latex +mkdir -p $latexdir +echo "Install altacv" +wget https://github.com/Titan-C/AltaCV/archive/sections.zip +unzip -j sections.zip -d $latexdir/AltaCV +echo "Install moderncv" +wget https://github.com/Titan-C/moderncv/archive/master.zip +unzip -j master.zip -d $latexdir/moderncv diff --git a/ox-altacv.el b/ox-altacv.el index ce242f6..7ce90e2 100644 --- a/ox-altacv.el +++ b/ox-altacv.el @@ -139,7 +139,8 @@ holding export options." "\\personalinfo{\n" ;; address (let ((address (org-export-data (plist-get info :address) info))) - (when address (format "\\mailaddress{%s}\n" (mapconcat (lambda (line) (format "%s" line)) + (when (org-string-nw-p address) (format "\\mailaddress{%s}\n" + (mapconcat (lambda (line) (format "%s" line)) (split-string address "\n") " -- ")))) ;; email (let ((email (and (plist-get info :with-email) diff --git a/readme.org b/readme.org index 380bee2..5a8408d 100644 --- a/readme.org +++ b/readme.org @@ -1,59 +1,215 @@ #+TITLE: Org exporter for curriculum vitae #+AUTHOR: Óscar Nájera #+EMAIL: hello@oscarnajera.com -#+DATE: 2018 Mar 22 -#+LATEX_HEADER: \usepackage[top=2cm,bottom=2.5cm,left=3cm,right=3cm]{geometry} -#+LATEX_HEADER: \usepackage{indentfirst} -#+LATEX_CLASS_OPTIONS: [a4paper,12pt] -#+STARTUP: hideblocks -#+OPTIONS: toc:nil num:nil -# This is for syntax highlight -#+LaTeX_HEADER: \usepackage{minted} -#+LaTeX_HEADER: \usemintedstyle{friendly} -#+LaTeX_HEADER: \newminted{common-lisp}{fontsize=\footnotesize} -This project aims on generating from an orgmode file with reasonably ordered -items of live to export to a latex file which compiles into a reasonably -nice CV. +#+HUGO_BASE_DIR: doc +#+HUGO_SECTION: post +#+HUGO_WEIGHT: auto -* Update readme -** TODO examples [0/2] -*** TODO pictures -*** TODO scripts -* TODO Make a package -Complete the file with license and how to load it. -* DONE Base environment -- State "DONE" from "TODO" [2018-03-22 Thu 17:57] -I have the basic cv template that gets exported -* DONE org-exporter for latex -- State "DONE" from "TODO" [2018-04-05 Thu 03:04] -:LOGBOOK: -CLOCK: [2018-03-22 Thu 23:17]--[2018-03-23 Fri 03:25] => 4:08 -CLOCK: [2018-03-22 Thu 17:58]--[2018-03-22 Thu 18:37] => 0:39 +* Goal: Export backend for CV + :PROPERTIES: + :EXPORT_FILE_NAME: goal + :END: +This project aims to generate from an org-mode file with reasonably ordered +items a latex file which compiles into a reasonably nice CV. In the same +spirit the org-mode file must export to markdown so that it can be uses for +web based CV. +* Installation + :PROPERTIES: + :EXPORT_FILE_NAME: installation + :END: +This project is not on MELPA so you have to do a manual installation. First +clone this git repository. +#+BEGIN_SRC bash +git clone https://gitlab.com/Titan-C/org-cv.git +#+END_SRC + +There are various modules to perform the export. As of now =ox-moderncv=, +=ox-altacv=, =ox-hugocv=. Choose any or all that you prefer for install. I +use =use-package= to manage the installation for example of =ox-moderncv=. + +#+BEGIN_SRC emacs-lisp +(use-package ox-moderncv + :load-path "path_to_repository/org-cv/" + :init (require 'ox-moderncv)) +#+END_SRC + +* Basic Org file + :PROPERTIES: + :EXPORT_FILE_NAME: basic_config + :END: +The basic structure of an org file containing your CV is shown next. +** Personal contact information +=TITLE=, =AUTHOR= and =EMAIL= are standard org options. But on =TITLE= you +put your foreseen job. + +#+attr_html: :class table table-striped +| Field | Description | +|----------+----------------------------------------------------| +| TITLE | Desired job | +| AUTHOR | Who you are? | +| EMAIL | Your contact email | +| ADDRESS | Mailing address, this can span over multiple lines | +| HOMEPAGE | URL of your website | +| MOBILE | Mobile phone | +| GITHUB | GitHub user | +| GITLAB | GitLab user | +| LINKEDIN | Linkedin username | +| PHOTO | path to photo file | + +#+BEGIN_SRC org :tangle basic_cv.org +,#+TITLE: My dream job +,#+AUTHOR: John Doe +,#+email: john@doe.lost + +,#+ADDRESS: My Awesome crib +,#+ADDRESS: Fantastic city -- Planet Earth +,#+MOBILE: (+9) 87654321 +,#+HOMEPAGE: example.com +,#+GITHUB: Titan-C +,#+GITLAB: Titan-C +,#+LINKEDIN: oscar-najera +,#+PHOTO: smile.png +#+END_SRC + +You can use org-modes hierarchical structure to describe your CV. To make a +specific subtree an item describing an experience point (Job you have, +degree you pursued, etc.) you use the org properties drawer and with the +=:CV_ENV: cventry= property. You should also include the =FROM= and =TO= +properties defining the span of the event, as =LOCATION= and =EMPLOYER=. +#+BEGIN_SRC org :tangle workcontent.org +,* Employement +,** One job +:PROPERTIES: +:CV_ENV: cventry +:FROM: <2014-09-01> +:TO: <2017-12-07> +:LOCATION: a city, a country +:EMPLOYER: The employer :END: -I'm comparing the contents of the template export function. It looks that -this one give the genera document layout and this is where I shall insert -them data. -comparing ox-latex, ox-beamer, ox-koma -I learned quite a lot from the main latex and koma files. Currently I -already reproduce latex export, which is not much as that was already a -working output. But now I have the specific keywords for the personal -information part. -** DONE Process headings with properties into cventries -- State "DONE" from "TODO" [2018-03-24 Sat 03:02] -:LOGBOOK: -CLOCK: [2018-03-23 Fri 22:54]--[2018-03-24 Sat 03:05] => 4:11 -CLOCK: [2018-03-23 Fri 14:41]--[2018-03-23 Fri 19:05] => 4:24 +I write about awesome stuff I do. +,** Other job +:PROPERTIES: +:CV_ENV: cventry +:FROM: <2013-09-01> +:TO: <2014-08-07> +:LOCATION: my city, your country +:EMPLOYER: The other employer :END: -I'm constructing the entries quite fine but somehow the intermedia function -refuses to get written even when it appears that its output is correct. -I don't fully understand. But it appear that I need to call the exporter -again within the exporting of the headings. This maybe is what helps -getting down the subtrees and getting to the latex output. -** DONE Incorporate from beamer how the do the theme settings -- State "DONE" from "TODO" [2018-03-23 Fri 16:01] -This looks like a fancy way to avoid repetition. Have a look too trying to -imitate that behavior for the other personal tags of social media,url,phones. -* DONE Markdown exporter for integration with hugo blog +I write about awesome stuff I do. + +,* Other stuff I do +- I work a lot +- I sleep a lot +- I eat a lot +#+END_SRC +* Latex Exporter + :PROPERTIES: + :EXPORT_FILE_NAME: latex_export + :END: + +** Using modern-cv +[[https://www.ctan.org/tex-archive/macros/latex/contrib/moderncv][moderncv]] is a standard \(\LaTeX\) package that you can find in many of your +latex distributions. For I maintain for personal purposes a fork of it to +better work with my use case at https://github.com/Titan-C/moderncv.git +Feel free to use any or even your personal fork for your desired use case. + +To configure the export for moderncv you need the addition options in your +org file. +#+BEGIN_SRC org :tangle moderncv.org +# CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking' +,#+CVSTYLE: banking +# CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black' +,#+CVCOLOR: green +#+END_SRC + +# Next block is to generate exports +#+BEGIN_SRC org :exports none :tangle moderncv.org +#+include: basic_cv.org +#+include: sideactivities.org +#+include: workcontent.org +#+END_SRC +When exporting you can call the following function to get the latex file. +#+BEGIN_SRC emacs-lisp +(org-export-to-file 'moderncv "moderncv.tex") +(org-latex-compile "moderncv.tex") +#+END_SRC + +#+BEGIN_EXPORT md + +

Alternative text - include a link to the PDF!

+
+#+END_EXPORT +** Using alta-cv +[[https://github.com/liantze/AltaCV][AltaCV]] is another project to generate a CV, you will need to install it +yourself. I maintain a fork too at https://github.com/Titan-C/AltaCV.git +because I need extra features and I encourage to use this fork on the +=sections= branch. + +The style of this CV is more involved and you need some configuration in +your org file to get it to work. First define the margins, the large margin +to the right is to allow for a second column. +#+BEGIN_SRC org :tangle altacv.org +,#+LATEX_HEADER: \geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm} +#+END_SRC +# Next block is to generate exports +#+BEGIN_SRC org :exports none :tangle altacv.org +#+include: basic_cv.org +#+END_SRC +Content on the right column has the same structure of a org file, but you +need to enclose it in the =\marginpar{}= command as shown next. +#+BEGIN_SRC org :tangle altacv.org +,#+latex: \marginpar{ +#+END_SRC +#+BEGIN_SRC org :tangle sideactivities.org +,* Main Interests +- Free/Libre and Open Source Software (FLOSS) +- Free food +- Free beer + +,* Programming +- Python +- C/C++ +- EmacsLisp +- Bash +- JavaScript +- PHP + +,* Languages + +- *English* Fluent +- *German* Fluent +- *Spanish* Native +- *French* Intermediate +#+END_SRC +# Next block is to generate exports +#+BEGIN_SRC org :exports none :tangle altacv.org +#+include: sideactivities.org +#+END_SRC +#+BEGIN_SRC org :tangle altacv.org +,#+latex: } +#+END_SRC +# Next block is to generate exports +#+BEGIN_SRC org :exports none :tangle altacv.org +#+include: workcontent.org +#+END_SRC + +When exporting you can call the following function to get the latex file. +#+BEGIN_SRC emacs-lisp +(org-export-to-file 'altacv "altacv.tex") +(org-latex-compile "altacv.tex") +#+END_SRC + +#+BEGIN_EXPORT md + +

Alternative text - include a link to the PDF!

+
+#+END_EXPORT + + +* Local Variables :ARCHIVE: +# Local Variables: +# eval: (add-hook 'after-save-hook #'org-hugo-export-wim-to-md-after-save :append :local) +# End: