diff --git a/ox-hugo.el b/ox-hugo.el index f19108a..b12dc65 100644 --- a/ox-hugo.el +++ b/ox-hugo.el @@ -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) diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org index 862b114..01d0a76 100644 --- a/test/site/content-org/all-posts.org +++ b/test/site/content-org/all-posts.org @@ -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: diff --git a/test/site/content-org/keyword-collection.org b/test/site/content-org/keyword-collection.org index 93ad90f..bd2dec9 100644 --- a/test/site/content-org/keyword-collection.org +++ b/test/site/content-org/keyword-collection.org @@ -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= diff --git a/test/site/content/posts/audio-front-matter.md b/test/site/content/posts/audio-front-matter.md new file mode 100644 index 0000000..64dc7f3 --- /dev/null +++ b/test/site/content/posts/audio-front-matter.md @@ -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. diff --git a/test/site/content/posts/images-multiple.md b/test/site/content/posts/images-multiple.md new file mode 100644 index 0000000..85d49b1 --- /dev/null +++ b/test/site/content/posts/images-multiple.md @@ -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. diff --git a/test/site/content/posts/images-single.md b/test/site/content/posts/images-single.md new file mode 100644 index 0000000..f8a6b64 --- /dev/null +++ b/test/site/content/posts/images-single.md @@ -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. diff --git a/test/site/content/posts/keyword-collection.md b/test/site/content/posts/keyword-collection.md index 06dbf93..98325d8 100644 --- a/test/site/content/posts/keyword-collection.md +++ b/test/site/content/posts/keyword-collection.md @@ -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 [12/12] {#keyword-collection-tested-to-work} +## Keyword Collection Tested to work [15/15] {#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` diff --git a/test/site/content/posts/series-multiple.md b/test/site/content/posts/series-multiple.md new file mode 100644 index 0000000..b857605 --- /dev/null +++ b/test/site/content/posts/series-multiple.md @@ -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. diff --git a/test/site/content/posts/series-single.md b/test/site/content/posts/series-single.md new file mode 100644 index 0000000..f50433a --- /dev/null +++ b/test/site/content/posts/series-single.md @@ -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. diff --git a/test/site/content/posts/videos-multiple.md b/test/site/content/posts/videos-multiple.md new file mode 100644 index 0000000..a59604e --- /dev/null +++ b/test/site/content/posts/videos-multiple.md @@ -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. diff --git a/test/site/content/posts/videos-single.md b/test/site/content/posts/videos-single.md new file mode 100644 index 0000000..76d6da2 --- /dev/null +++ b/test/site/content/posts/videos-single.md @@ -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.