Append "Figure N: " to figure captions

This adds consistency with the table and source block captions.
master
Kaushal Modi 8 years ago
parent d35f53a54a
commit 27397f2f34
  1. 15
      ox-hugo.el
  2. 4
      test/site/content/posts/figure-shortcode-and-attr-html.md
  3. 2
      test/site/content/posts/image-captions.md
  4. 12
      test/site/content/posts/links-to-images.md
  5. 2
      test/site/themes/bare_min

@ -1705,7 +1705,20 @@ and rewrite link paths to make blogging more seamless."
(org-export-data ;Look for caption set using #+caption
(org-export-get-caption (org-export-get-parent-element link))
info))
(plist-get attr :caption))))
(plist-get attr :caption)))
(caption (when (org-string-nw-p caption)
(format "%s%s%s%s"
;; Tue Feb 13 11:32:45 EST 2018 - kmodi
;; Add the span tag once
;; https://github.com/gohugoio/hugo/issues/4406
;; gets resolved.
"" ;"<span class=\\\"figure-number\\\">"
(format (org-html--translate "Figure %d: " info)
(org-export-get-ordinal
useful-parent info
nil #'org-html--has-caption-p))
"" ;"</span>"
caption))))
;; (message "[ox-hugo-link DBG] inline image? %s\npath: %s"
;; inline-image path)
;; (message "[org-hugo-link DBG] attr: %s num of attr: %d"

@ -38,7 +38,7 @@ below image, caption is set using that:
Some text before image.
{{< figure src="/images/org-mode-unicorn-logo.png" caption="A unicorn!" >}}
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Figure 1: A unicorn!" >}}
Some more text, after image.
@ -46,7 +46,7 @@ Below, the same caption is set using the `#+attr_html` method instead:
Some text before image.
{{< figure src="/images/org-mode-unicorn-logo.png" caption="A unicorn!" >}}
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Figure 2: A unicorn!" >}}
_Enter a new line after the image link so that it's in an "Org
paragraph" that contains just that image. That tells Org that that

@ -7,6 +7,6 @@ draft = false
Some text before image.
{{< figure src="/images/org-mode-unicorn-logo.png" caption="A unicorn!" >}}
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Figure 1: A unicorn!" >}}
Some more text, after image.

@ -29,10 +29,10 @@ Here's the same image again, but with a different Org link ID:
will output below (_lorem-ipsum_ added to increase page content so
that the link jump is evident):
<a id="orgccda3d6"></a>
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Org Logo" >}}
<a id="org21b2f71"></a>
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Figure 1: Org Logo" >}}
**Here we refer to image [2](#org7a92cf1).**
**Here we refer to image [2](#orgb4d5cae).**
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque et
quam metus. Etiam in iaculis mi, sit amet pretium magna. Donec ut dui
@ -88,10 +88,10 @@ blandit in.
Here's the same image again, but with a different Org link ID:
<a id="org7a92cf1"></a>
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Same Org Logo" >}}
<a id="orgb4d5cae"></a>
{{< figure src="/images/org-mode-unicorn-logo.png" caption="Figure 2: Same Org Logo" >}}
**Here we refer to image [1](#orgccda3d6).**
**Here we refer to image [1](#org21b2f71).**
---

@ -1 +1 @@
Subproject commit 3f7dcc9619d61c005992fb47f60caa2e1f5e3831
Subproject commit 2d8c4a1e8c08784228305d9b22080e3522cdfbc9
Loading…
Cancel
Save