fix hugo export string replace and build

fix hugo

hugo fix collective environments
This commit is contained in:
Oscar Najera 2023-10-22 04:01:41 +02:00
parent d89628c2ed
commit a94bf0e5ad
4 changed files with 33 additions and 15 deletions

View file

@ -16,4 +16,8 @@ exclude some tags during export.
(org-export-to-file 'hugocv "hugocv.md"))
```
You are responsible for styling your website.
You are responsible for styling your website. Use all the CSS magic you know.
Each entry is inside a `div` container and each element of the properties has
its own class.
\#+end_src

View file

@ -19,20 +19,24 @@
(require 'ox-awesomecv)
(require 'ox-awesomecv2))
(defun export-latex (backend file)
(defun export-with (backend file ext)
(let ((workfile (concat cv-workdir file))
(outfile (concat cv-workdir file ".tex"))
(pdffile (concat cv-workdir file ".pdf")))
(outfile (concat cv-workdir file ext)))
(message (format "%s exists: %s" workfile (file-exists-p workfile)))
(with-current-buffer
(find-file-noselect workfile)
(org-mode)
(message "back %S, out %S" backend outfile)
(org-export-to-file backend outfile)
(message (format "%s exists: %s" outfile (file-exists-p outfile)))
(shell-command (format "xelatex --output-directory=%s %s" cv-workdir outfile) "*Messages*" "*Messages*")
(message (format "%s exists: %s" pdffile (file-exists-p pdffile)))
(copy-file pdffile (concat cv-cwd "/doc/static/" (concat file ".pdf")) t))))
(org-export-to-file backend outfile))
outfile))
(defun export-latex (backend file)
(let ((outfile (export-with backend file ".tex"))
(pdffile (concat cv-workdir file ".pdf")))
(message (format "%s exists: %s" outfile (file-exists-p outfile)))
(shell-command (format "xelatex --output-directory=%s %s" cv-workdir outfile) "*Messages*" "*Messages*")
(message (format "%s exists: %s" pdffile (file-exists-p pdffile)))
(copy-file pdffile (concat cv-cwd "/doc/static/" (concat file ".pdf")) t)))
(let ((readme (concat cv-cwd "readme.org")))
(make-directory cv-workdir t)
@ -43,10 +47,9 @@
(copy-file (concat cv-cwd "doc/smile.png") cv-workdir t)
(make-directory (concat cv-cwd "/doc/static/") t)
(message "alta %s" (featurep 'ox-altacv))
(export-latex 'altacv "altacv.org")
(export-latex 'moderncv "moderncv.org")
(export-latex 'awesomecv2 "awesomecv.org")
(export-latex 'awesomecv "awesomecv.org")
(export-latex 'awesomecv "awesome-letter.org")
(export-latex 'hugocv "hugocv.org")
(export-with 'hugocv "hugocv.org" ".md")

View file

@ -59,10 +59,11 @@
(cl-ecase field
(host
(-some->> (alist-get 'host entry)
(org-string-nw-p)
(format "%s\n{.cv-host}")))
(date
(-some->>
(org-cv-utils--format-time-window (alist-get 'from-date entry) (alist-get 'to-date entry))
(alist-get 'date entry)
(format "%s\n{.cv-date}")))
(location
(-some->> (alist-get 'location entry)
@ -74,7 +75,7 @@
CONTENTS holds the contents of the headline. INFO is a plist used
as a communication channel."
(let* ((environment (org-export-get-tags headline info))
(env-class (string-replace "cv" "" (cl-find-if (lambda (s) (string-prefix-p "cv" s)) environment)))
(env-class (replace-regexp-in-string "^cv" "" (cl-find-if (lambda (s) (string-prefix-p "cv" s)) environment)))
(entry (org-cv-utils--parse-cventry headline info))
(loffset (string-to-number (plist-get info :hugo-level-offset))) ;"" -> 0, "0" -> 0, "1" -> 1, ..
(level (org-export-get-relative-level headline info))
@ -98,7 +99,10 @@ as a communication channel."
(let ((environment (cons (org-element-property :CV_ENV headline)
(org-export-get-tags headline info))))
(cond
((cl-find-if (lambda (s) (string-prefix-p "cv" s)) environment)
((cl-find-if (lambda (s) (and (string-prefix-p "cv" s)
;; avoid conflict with awesomecv block environments
(not (member s '("cventries" "cvhonors")))))
environment)
(org-hugocv--format-cventry headline contents info))
((org-export-with-backend 'hugo headline contents info))))))

View file

@ -453,7 +453,14 @@ exclude some tags during export.
(org-export-to-file 'hugocv "hugocv.md"))
#+END_SRC
You are responsible for styling your website.
You are responsible for styling your website. Use all the CSS magic you know.
Each entry is inside a =div= container and each element of the properties has
its own class.
#+begin_src org :exports none :tangle hugocv.org
,#+HTML_HEAD: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
#+end_src
# Next block is to generate exports
#+BEGIN_SRC org :exports none :tangle hugocv.org
#+include: basic_cv.org