diff --git a/ox-blackfriday.el b/ox-blackfriday.el index 4245304..65d4e0c 100644 --- a/ox-blackfriday.el +++ b/ox-blackfriday.el @@ -556,13 +556,15 @@ information." (parent-type (car parent-element)) (backticks (make-string org-blackfriday--code-block-num-backticks ?`))) (prog1 - (format "%stext\n%s%s" - backticks - (let ((org-src-preserve-indentation t)) - ;; Preserve leading whitespace in the Org Babel Results - ;; blocks. - (org-export-format-code-default fixed-width info)) - backticks) + (org-blackfriday--div-wrap-maybe + fixed-width + (format "%stext\n%s%s" + backticks + (let ((org-src-preserve-indentation t)) + ;; Preserve leading whitespace in the Org Babel Results + ;; blocks. + (org-export-format-code-default fixed-width info)) + backticks)) (when (equal 'quote-block parent-type) ;; If the current example block is inside a quote block, ;; future example/code blocks (especially the ones outside diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org index e743424..d94eae1 100644 --- a/test/site/content-org/all-posts.org +++ b/test/site/content-org/all-posts.org @@ -1539,7 +1539,11 @@ blocks: :PROPERTIES: :EXPORT_FILE_NAME: org-babel-results :END: -*** Small Results block +#+begin_description +Testing the export of Org Babel ~#+results:~ blocks with and without +wrapping with HTML attributes. +#+end_description +*** "Fixed block" Results block Below also tests that the indentation in *results* blocks is preserved. @@ -1553,12 +1557,24 @@ print(str[1:]) The whitespace before "bc" in the results block above should be preserved. -*** Big Results block +**** "Fixed block" Results block with ~#+attr_html~ +#+begin_src python :exports both :results output +str = 'd\tef' +print(str[1:]) +#+end_src + +#+attr_html: :class results-fixed-block +#+attr_css: :color blue +#+results: +: ef + +Above results block will be in _blue_ text. +*** "Example block" Results block #+begin_src nim :exports both :results output echo "abc\ndef\nghi\njkl\nmno\npqr\nstu\nvwx\nyz0\n123\n456\n789" #+end_src -#+RESULTS: +#+results: #+begin_example abc def @@ -1573,7 +1589,30 @@ yz0 456 789 #+end_example +**** "Example block" Results block with ~#+attr_html~ +#+begin_src nim :exports both :results output +echo "ABC\nDEF\nGHI\nJKL\nMNO\nPQR\nSTU\nVWX\nYZ0\n123\n456\n789" +#+end_src + +#+attr_html: :class results-example-block +#+attr_css: :color green +#+results: +#+begin_example +ABC +DEF +GHI +JKL +MNO +PQR +STU +VWX +YZ0 +123 +456 +789 +#+end_example +Above results block will be in _green_ text. ** Indented source block :indented:lists:code_fence:highlight:src_block:@upstream: :PROPERTIES: :EXPORT_FILE_NAME: source-block-indented diff --git a/test/site/content/posts/org-babel-results.md b/test/site/content/posts/org-babel-results.md index 99a1f72..28d641c 100644 --- a/test/site/content/posts/org-babel-results.md +++ b/test/site/content/posts/org-babel-results.md @@ -1,10 +1,14 @@ +++ title = "Org Babel Results" +description = """ + Testing the export of Org Babel `#+results:` blocks with and without + wrapping with HTML attributes. + """ tags = ["src-block", "babel", "results", "indentation", "example-block", "fixed-block"] draft = false +++ -## Small Results block {#small-results-block} +## "Fixed block" Results block {#fixed-block-results-block} Below also tests that the indentation in **results** blocks is preserved. @@ -22,7 +26,27 @@ The whitespace before "bc" in the results block above should be preserved. -## Big Results block {#big-results-block} +### "Fixed block" Results block with `#+attr_html` {#fixed-block-results-block-with-plus-attr-html} + +```python +str = 'd\tef' +print(str[1:]) +``` + + + +
+
+ +```text + ef +``` +
+ +Above results block will be in blue text. + + +## "Example block" Results block {#example-block-results-block} ```nim echo "abc\ndef\nghi\njkl\nmno\npqr\nstu\nvwx\nyz0\n123\n456\n789" @@ -42,3 +66,33 @@ yz0 456 789 ``` + + +### "Example block" Results block with `#+attr_html` {#example-block-results-block-with-plus-attr-html} + +```nim +echo "ABC\nDEF\nGHI\nJKL\nMNO\nPQR\nSTU\nVWX\nYZ0\n123\n456\n789" +``` + + + +
+
+ +```text +ABC +DEF +GHI +JKL +MNO +PQR +STU +VWX +YZ0 +123 +456 +789 +``` +
+ +Above results block will be in green text.