kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo
https://ox-hugo.scripter.co
GNU General Public License v3.0
867 stars 130 forks source link

#+caption doesnt work with #+begin_quote #683

Closed andreyorst closed 1 year ago

andreyorst commented 1 year ago

Actual Behavior

Writing:

#+caption: John Doe
#+begin_quote
famous quote
#+end_quote

Doesn't produce any caption in the resulting Markdown.

Expected Behavior

A caption is added similarly to source code blocks

How to Reproduce the Issue

Export to markdown

Example Org File

#+caption: John Doe
#+begin_quote
famous quote
#+end_quote

Generated Markdown File or Error

> famous quote

Ox-Hugo Debug Information

Debug Info # Debug information for `ox-hugo` ## Emacs Version GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2022-10-23 (commit a01bd1a208a5199fd1d76baade373f7f12f912a2) ## Org Version Org mode version 9.5.5 (release_9.5.5 @ /home/alist/.local/share/emacs/29.0.50/lisp/org/) ## Hugo Version hugo v0.93.3+extended linux/amd64 BuildDate=unknown ### Org `load-path` shadows No Org mode shadows found in `load-path` ## `ox-hugo` defcustoms
org-hugo-section "posts"
org-hugo-use-code-for-kbd nil
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format "toml"
org-hugo-default-static-subdirectory-for-externals "ox-hugo"
org-hugo-external-file-extensions-allowed-for-copying ("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")
org-hugo-date-format "%Y-%m-%dT%T%z"
org-hugo-paired-shortcodes ""
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format "toml"
kaushalmodi commented 1 year ago

Hello,

Org doesn't expect a caption for quote blocks. You can see the Ascii, Markdown and HTML outputs using ox-ascii, ox-md and ox-html exports respectively:

image


How do you visualize the ox-hugo exported Markdown to render the quote block caption? Or how would you have manually written the quote+caption in Markdown?

andreyorst commented 1 year ago

Org doesn't expect a caption for quote blocks. You can see the Ascii, Markdown and HTML outputs using ox-ascii, ox-md and ox-html exports respectively:

Oh, sorry, should have checked that

How do you visualize the ox-hugo exported Markdown to render the quote block caption? Or how would you have manually written the quote+caption in Markdown?

An example from my blog:

image

I have manually written the caption for this in org mode via html export:

#+begin_quote
CL packages are the wrong way to implement packages in Lisp.
As I explained in a discussion two years ago, packages implemented using obarrays (or equivalent) don't work reliably.

We have a much better basis for Lisp packages in the shorthands mechanism.
It only needs to be completed.
#+end_quote
#+begin_export html
<div class="src-block-caption">
<span>Richard Stallman on </span><a href="https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01786.html">CL packages landed</a>
</div>
#+end_export
kaushalmodi commented 1 year ago

Canonically, <cite> is used with <blockquote>. Example: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite

I have this ox-hugo test:

#+begin_quote
He puts his claw against the divider. "Fist my bump."
#+begin_cite
Andy Weir, Project Hail Mary
#+end_cite
#+end_quote

which renders to https://ox-hugo.scripter.co/test/posts/special-blocks/#inline-html5-elements.

Would that #+begin_cite: .. #+end_cite fit your usecase too?

kaushalmodi commented 1 year ago

Alternatively, this will export pretty close to what you have manually put inside the #+begin_export html (it will just not have the <span> tags):

#+begin_quote
CL packages are the wrong way to implement packages in Lisp.
As I explained in a discussion two years ago, packages implemented using obarrays (or equivalent) don't work reliably.

We have a much better basis for Lisp packages in the shorthands mechanism.
It only needs to be completed.
#+end_quote
#+begin_src-block-caption
Richard Stallman on [[https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01786.html][CL packages landed]]
#+end_src-block-caption
andreyorst commented 1 year ago

I think these options will work for me. Thanks for the help!