Support audio, images, videos and series front-matter

Fixes https://github.com/kaushalmodi/ox-hugo/issues/122
master
Kaushal Modi 8 years ago
parent 4b80d2f893
commit d62d38d11d
  1. 12
      ox-hugo.el
  2. 56
      test/site/content-org/all-posts.org
  3. 17
      test/site/content-org/keyword-collection.org
  4. 9
      test/site/content/posts/audio-front-matter.md
  5. 9
      test/site/content/posts/images-multiple.md
  6. 9
      test/site/content/posts/images-single.md
  7. 8
      test/site/content/posts/keyword-collection.md
  8. 9
      test/site/content/posts/series-multiple.md
  9. 9
      test/site/content/posts/series-single.md
  10. 9
      test/site/content/posts/videos-multiple.md
  11. 9
      test/site/content/posts/videos-single.md

@ -748,6 +748,8 @@ newer."
;; https://gohugo.io/content-management/front-matter/#front-matter-variables
;; aliases
(:hugo-aliases "HUGO_ALIASES" nil nil space)
;; audio
(:hugo-audio "HUGO_AUDIO" nil nil)
;; date
;; "date" is parsed from the Org #+date or subtree property EXPORT_HUGO_DATE
(:date "DATE" nil nil)
@ -761,6 +763,8 @@ newer."
(:hugo-expirydate "HUGO_EXPIRYDATE" nil nil)
;; headless (only for Page Bundles - Hugo v0.35+)
(:hugo-headless "HUGO_HEADLESS" nil nil)
;; images
(:hugo-images "HUGO_IMAGES" nil nil newline)
;; isCJKLanguage
(:hugo-iscjklanguage "HUGO_ISCJKLANGUAGE" nil nil)
;; keywords
@ -784,6 +788,8 @@ newer."
(:hugo-outputs "HUGO_OUTPUTS" nil nil space)
;; publishDate
(:hugo-publishdate "HUGO_PUBLISHDATE" nil nil)
;; series
(:hugo-series "HUGO_SERIES" nil nil newline)
;; slug
(:hugo-slug "HUGO_SLUG" nil nil)
;; taxomonomies - tags, categories
@ -808,6 +814,8 @@ newer."
(:hugo-type "HUGO_TYPE" nil nil)
;; url
(:hugo-url "HUGO_URL" nil nil)
;; videos
(:hugo-videos "HUGO_VIDEOS" nil nil newline)
;; weight
(:hugo-weight "HUGO_WEIGHT" nil nil)))
@ -2645,12 +2653,14 @@ INFO is a plist used as a communication channel."
(data `(;; The order of the elements below will be the order in which the front matter
;; variables will be ordered.
(title . ,(org-hugo--sanitize-title info))
(audio . ,(plist-get info :hugo-audio))
(author . ,author-list)
(description . ,description)
(date . ,(org-hugo--format-date :date info))
(publishDate . ,(org-hugo--format-date :hugo-publishdate info))
(expiryDate . ,(org-hugo--format-date :hugo-expirydate info))
(aliases . ,aliases)
(images . ,(org-hugo--delim-str-to-list (plist-get info :hugo-images)))
(isCJKLanguage . ,(org-hugo--plist-get-true-p info :hugo-iscjklanguage))
(keywords . ,keywords)
(layout . ,(org-export-data (plist-get info :hugo-layout) info))
@ -2658,11 +2668,13 @@ INFO is a plist used as a communication channel."
(linkTitle . ,(org-export-data (plist-get info :hugo-linktitle) info))
(markup . ,(org-export-data (plist-get info :hugo-markup) info))
(outputs . ,outputs)
(series . ,(org-hugo--delim-str-to-list (plist-get info :hugo-series)))
(slug . ,(org-export-data (plist-get info :hugo-slug) info))
(tags . ,tags)
(categories . ,categories)
(type . ,(org-export-data (plist-get info :hugo-type) info))
(url . ,(org-export-data (plist-get info :hugo-url) info))
(videos . ,(org-hugo--delim-str-to-list (plist-get info :hugo-videos)))
(weight . ,weight)
(draft . ,draft)
(headless . ,headless)

@ -4317,6 +4317,62 @@ Post content.
:PROPERTIES:
:EXPORT_FILE_NAME: locale-auto-detect
:END:
** Images :images:
*** Single image :single:
:PROPERTIES:
:EXPORT_FILE_NAME: images-single
:EXPORT_HUGO_IMAGES: "image path with space.png"
:END:
If an image path has spaces in it, wrap the whole path in double
quotes.
*** Multiple images :multiple:
:PROPERTIES:
:EXPORT_FILE_NAME: images-multiple
:EXPORT_HUGO_IMAGES: "image foo.svg"
:EXPORT_HUGO_IMAGES+: images/bar.png
:EXPORT_HUGO_IMAGES+: zoo.jpg
:END:
If an image path has spaces in it, wrap the whole path in double
quotes.
** Videos :videos:
*** Single video :single:
:PROPERTIES:
:EXPORT_FILE_NAME: videos-single
:EXPORT_HUGO_VIDEOS: "video path with space.mp4"
:END:
If a video path has spaces in it, wrap the whole path in double
quotes.
*** Multiple videos :multiple:
:PROPERTIES:
:EXPORT_FILE_NAME: videos-multiple
:EXPORT_HUGO_VIDEOS: "video foo.mp4"
:EXPORT_HUGO_VIDEOS+: bar.mpeg
:END:
If a video path has spaces in it, wrap the whole path in double
quotes.
** Audio :audio:
:PROPERTIES:
:EXPORT_FILE_NAME: audio-front-matter
:EXPORT_HUGO_AUDIO: "audio path with space.mp3"
:END:
If the audio path has spaces in it, wrap the whole path in double
quotes.
** Series :series:
*** Single series :single:
:PROPERTIES:
:EXPORT_FILE_NAME: series-single
:EXPORT_HUGO_SERIES: "Series A"
:END:
If a series name has spaces in it, wrap the whole name in double
quotes.
*** Multiple series :multiple:
:PROPERTIES:
:EXPORT_FILE_NAME: series-multiple
:EXPORT_HUGO_SERIES: "Series A"
:EXPORT_HUGO_SERIES+: "Series B"
:END:
If a series name has spaces in it, wrap the whole name in double
quotes.
** Replace front-matter keys :keys:replace:
*** Replace only "linkTitle" key :linktitle:
:PROPERTIES:

@ -72,10 +72,22 @@
#+hugo_resources: :src "*.png" :byline "bep"
#+hugo_resources: :src "*.jpg" :title "JPEG Image #:counter"
# Images
#+hugo_images: "image 1"
#+hugo_images: "image 2"
# Videos
#+hugo_videos: "video 1"
#+hugo_videos: "video 2"
# Series
#+hugo_series: "series 1"
#+hugo_series: "series 2"
This is a test post that tests that keywords set across multiple Org
keywords get collected.
* Keyword Collection Tested to work [12/12]
* Keyword Collection Tested to work [15/15]
- [X] =#+author=
- [X] =#+hugo_tags=
- [X] =#+hugo_categories=
@ -88,3 +100,6 @@ keywords get collected.
- [X] =#+keywords=
- [X] =#+hugo_outputs=
- [X] =#+hugo_resources=
- [X] =#+hugo_images=
- [X] =#+hugo_videos=
- [X] =#+hugo_series=

@ -0,0 +1,9 @@
+++
title = "Audio"
audio = "audio path with space.mp3"
tags = ["front-matter", "audio"]
draft = false
+++
If the audio path has spaces in it, wrap the whole path in double
quotes.

@ -0,0 +1,9 @@
+++
title = "Multiple images"
images = ["image foo.svg", "images/bar.png", "zoo.jpg"]
tags = ["front-matter", "images", "multiple"]
draft = false
+++
If an image path has spaces in it, wrap the whole path in double
quotes.

@ -0,0 +1,9 @@
+++
title = "Single image"
images = ["image path with space.png"]
tags = ["front-matter", "images", "single"]
draft = false
+++
If an image path has spaces in it, wrap the whole path in double
quotes.

@ -2,10 +2,13 @@
title = "Keyword Collection"
author = ["firstname1 lastname1", "firstname2 lastname2", "firstname3 lastname3"]
aliases = ["/posts/keyword-concatenation", "/posts/keyword-merging"]
images = ["image 1", "image 2"]
keywords = ["keyword1", "keyword2", "three word keywords3"]
outputs = ["html", "json"]
series = ["series 1", "series 2"]
tags = ["mega front-matter", "keys", "collection", "concatenation", "merging"]
categories = ["cat1", "cat2"]
videos = ["video 1", "video 2"]
draft = false
myfoo = "bar"
mybaz = "zoo"
@ -52,7 +55,7 @@ This is a test post that tests that keywords set across multiple Org
keywords get collected.
## Keyword Collection Tested to work <code>[12/12]</code> {#keyword-collection-tested-to-work}
## Keyword Collection Tested to work <code>[15/15]</code> {#keyword-collection-tested-to-work}
- [X] `#+author`
- [X] `#+hugo_tags`
@ -66,3 +69,6 @@ keywords get collected.
- [X] `#+keywords`
- [X] `#+hugo_outputs`
- [X] `#+hugo_resources`
- [X] `#+hugo_images`
- [X] `#+hugo_videos`
- [X] `#+hugo_series`

@ -0,0 +1,9 @@
+++
title = "Multiple series"
series = ["Series A", "Series B"]
tags = ["front-matter", "series", "multiple"]
draft = false
+++
If a series name has spaces in it, wrap the whole name in double
quotes.

@ -0,0 +1,9 @@
+++
title = "Single series"
series = ["Series A"]
tags = ["front-matter", "series", "single"]
draft = false
+++
If a series name has spaces in it, wrap the whole name in double
quotes.

@ -0,0 +1,9 @@
+++
title = "Multiple videos"
tags = ["front-matter", "videos", "multiple"]
videos = ["video foo.mp4", "bar.mpeg"]
draft = false
+++
If a video path has spaces in it, wrap the whole path in double
quotes.

@ -0,0 +1,9 @@
+++
title = "Single video"
tags = ["front-matter", "videos", "single"]
videos = ["video path with space.mp4"]
draft = false
+++
If a video path has spaces in it, wrap the whole path in double
quotes.
Loading…
Cancel
Save