4

I am exporting an org file with org-reveal. I would like to have the following html markup when exporting:

<q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">“The nice thing about standards is that there are so many to choose from”</q>

What is the markup to use in org-mode for that? For blockquote, it would be:

#+BEGIN_QUOTE
"Everything should be made as simple as possible,
but not any simpler" -- Albert Einstein
#+END_QUOTE

How can I generate the <q></q> markup?

2 Answers 2

4

You can achieve your desired result with a macro like this (which should also work for latex, but without the url):

#+MACRO: quote @@html:<q cite="$2">$1</q>@@@@latex:``$1''@@

And then there is: {{{quote(The nice thing about standards is that there are so many to choose from,http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations)}}}.

Note that there is no space after the comma.

You can also simplify it a bit if you can omit the url (which is not shown anyway as far as I know):

#+MACRO: quote @@html:<q>$1</q>@@@@latex:``$1''@@

And then there is: {{{quote(The nice thing about standards is that there are so many to choose from)}}}.

Edit 1: Here is an example of how to define the macro globally (in your emacs configuration, e.g. in ~/.emacs.d/init.el):

(setq org-export-global-macros '((quote . "@@html:<q cite=\"$2\">$1</q>@@@@latex:``$1''@@")))

Edit 2: Simplified the macro definition.

Edit 3: You can also include an org file containing macros:

#+INCLUDE: /path/to/org-macro-collection.org
2
  • Great! Is there a way to define this macros in an emacs config file, and not per-org file, so that I can have a toolset of macros?
    – blueFast
    Jul 25, 2018 at 7:06
  • Yes, you can define them in org-export-global-macros, I will update the answer accordingly.
    – theldoria
    Jul 25, 2018 at 8:20
3

The Org Mode Manual addresses in Section Quoting HTML tags directly the question How to put raw html in an org file.

Use @@html:...@@ for short html snippets where the elipsis ... stands for the html code and HTML export code blocks for longer html code blocks:

#+HTML: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">“The nice thing about standards is that there are so many to choose from”</q>

or

#+BEGIN_EXPORT html
<q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">“The nice thing about standards is that there are so many to choose from”</q>
#+END_EXPORT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.