Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Export quote blocks as blockquote #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ As a concrete example, the difference between the default exporter and `slimhtml
### blocks


#### quotes

#+BEGIN_QUOTE # <blockquote>content</blockquote>
content
#+END_QUOTE


#### examples

#+BEGIN_EXAMPLE # content
Expand Down
4 changes: 4 additions & 0 deletions ox-slimhtml-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
(should-render-as "<pre><code class=\"sh\">&amp;&lt;&gt;\n</code></pre>"
"#+BEGIN_SRC sh\n &<>\n#+END_SRC"))

(ert-deftest ox-slimhtml-quote-block ()
(should-render-as "<blockquote>this\n</blockquote>"
"#+BEGIN_QUOTE\nthis\n#+END_QUOTE"))

(ert-deftest ox-slimhtml-template ()
(should (org-export-string-as "" 'slimhtml))
(let ((expected-result
Expand Down
20 changes: 19 additions & 1 deletion ox-slimhtml.el
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ CONTENTS is the contents of the paragraph.
INFO is a plist holding contextual information."
(when contents
(if (or (ox-slimhtml--immediate-child-of-p paragraph 'item)
(ox-slimhtml--immediate-child-of-p paragraph 'special-block))
(ox-slimhtml--immediate-child-of-p paragraph 'special-block)
(ox-slimhtml--immediate-child-of-p paragraph 'quote-block))
contents
(if (ox-slimhtml--has-immediate-child-of-p paragraph 'link)
(format "<p>%s</p>" contents)
Expand Down Expand Up @@ -293,6 +294,22 @@ INFO is a plist holding contextual information."
(format "<pre><code class=\"%s\"%s>%s</code></pre>"
language (ox-slimhtml--attr src-block) code))))

;; quote block
;; #+BEGIN_EXAMPLE
;; ,#+BEGIN_QUOTE # <blockquote>
;; quoted text # quoted text
;; ,#+END_QUOTE # </blockquote>
;; #+END_EXAMPLE

(defun ox-slimhtml-quote-block (quote-block contents info)
"Transcode QUOTE-BLOCK from Org to HTML.

CONTENTS is the text of a #+BEGIN_QUOTE...#+END_QUOTE block.
INFO is a plist holding contextual information."
(when contents
(format "<blockquote%s>%s</blockquote>"
(ox-slimhtml--attr quote-block) contents)))

;; body
;; #+BEGIN_EXAMPLE
;; ,#+HTML_PREAMBLE: preamble {{{macro}}} # preamble
Expand Down Expand Up @@ -487,6 +504,7 @@ Return output file name."
(section . ox-slimhtml-section)
(special-block . ox-slimhtml-special-block)
(src-block . ox-slimhtml-src-block)
(quote-block . ox-slimhtml-quote-block)
(template . ox-slimhtml-template)
(verbatim . ox-slimhtml-verbatim))
:menu-entry
Expand Down