Skip to content

Commit

Permalink
Add: New src block type
Browse files Browse the repository at this point in the history
  • Loading branch information
Musa Al-hassy committed Dec 24, 2024
1 parent e25e1c9 commit d462959
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
9 changes: 2 additions & 7 deletions org-special-block-extras.org
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ html-export-style:solarized_light
# TODO: Since the implementation is a find-replace, nested blocks do not honor enclosing blocks.
# For example, try placing a `rename` block within an `example` block and see that it is expanded!

Look:
# (setq osbe-example-yaml-cache (make-hash-table :test 'equal))
# 1. osbe-example:~/org-special-block-extras/tests/doc.yaml
# 2. osbe-example:~/org-special-block-extras/tests/rename.yaml

Expand Down Expand Up @@ -3722,13 +3722,10 @@ src_latex[:exports code]{\color{blue}} is a nightmare. )
:CUSTOM_ID: Parallel
:END:

# (setq osbe-example-yaml-cache (make-hash-table :test 'equal))
osbe-example:~/org-special-block-extras/tests/parallel.yaml

#+latex_header: \usepackage{multicol}

#+begin_details Implementation
#+begin_src emacs-lisp -r -n
#+begin_src emacs-lisp -r -n :title Implementation :folded t
(org-defblock parallel (cols "2" bar nil)
"Place ideas side-by-side, possibly with a separator.

Expand Down Expand Up @@ -3798,7 +3795,6 @@ With LaTeX export, the use of ‘#+columnbreak:’ is used to request a column b
contents)
(if (s-contains-p " " cols) "</div>" ""))))))))
#+end_src
#+end_details

** COMMENT Older setup :Possibly_delete:
:PROPERTIES:
Expand Down Expand Up @@ -8427,7 +8423,6 @@ It is said that $e^{i \cdot \pi} + 1 = 0$ is the truth.




* TODO [#A] COMMENT Summary
:PROPERTIES:
:CUSTOM_ID: Summary
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e.el
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,14 @@ my liking, then move the `input' to the relevant yaml file."
(format "<div><div style=\"padding: 1em;background-color: %s;border-radius: 15px;font-size: 0.9em;\"> %s <pre class=\"src src-org\"> %s </pre></div> <div style=\"padding: 1em;background-color: %s;border-radius: 15px;font-size: 0.9em;\"> %s %s </div></div>"
src.color src.title src
tgt.color tgt.title tgt))))

(org-defblock src (language "emacs-lisp" folded nil title "Details")
"yup"
(-let [org--supported-blocks '(details)] ;; to avoid infinite recursive calls for `src'
(-let [discloure (if folded "details" "box")]
(org-export-string-as
(format "\n#+begin_%s %s\n#+begin_src %s \n %s \n#+end_src\n#+end_%s\n" discloure title language raw-contents discloure)
'html
:body-only-please))))


5 changes: 1 addition & 4 deletions tests/parallel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ input: |-
#+end_parallel
# Moreover:
# → In the Soft Columns style above, any ‘#+columnbreak:’ are merely ignored.
# → With LaTeX export, the use of ‘#+columnbreak:’ is used to request a column break.
# \usepackage{multicol}
# In the Soft Columns style above, any ‘#+columnbreak:’ are merely ignored.
expectations:
html: |-
Expand Down

0 comments on commit d462959

Please sign in to comment.