~bzg/dev

Org-contrib: lisp/ox-confluence.el: escape braces in org-confluence-code/verbatim v1 APPLIED

Lungang Fang: 1
 lisp/ox-confluence.el: escape braces in org-confluence-code/verbatim

 1 files changed, 4 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~bzg/dev/patches/42816/mbox | git am -3
Learn more about email & git

[PATCH Org-contrib] lisp/ox-confluence.el: escape braces in org-confluence-code/verbatim Export this patch

In ={hello} world= and ~hi {0} {1} {2}~, "{hello}" and "{0}" etc. are expected
to be exported verbatim. However, currently they are exported to "{{{hello}
world}}" and "{{hi {0} {1} {2}}}" respectively. As a result, "{hello}", "{0}"
etc. are treated by confluence wiki as macros and hence cause errors like
"Unknown macro: {hello}".

This fix is to escape the openning curly braces, i.e. adding a back slash before
them. The results are "{{\{hello} world}}" and "{{hi \{0} \{1} \{2}}}".
---
 lisp/ox-confluence.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-confluence.el b/lisp/ox-confluence.el
index 127a6c5..52b0102 100644
--- a/lisp/ox-confluence.el
+++ b/lisp/ox-confluence.el
@@ -108,10 +108,12 @@
   (org-trim (org-element-property :value fixed-width))))

(defun org-confluence-verbatim (verbatim contents info)
  (format "\{\{%s\}\}" (org-element-property :value verbatim)))
  (let ((content (org-element-property :value verbatim)))
    (format "\{\{%s\}\}" (string-replace "{" "\\{" content))))

(defun org-confluence-code (code contents info)
  (format "\{\{%s\}\}" (org-element-property :value code)))
  (let ((content (org-element-property :value code)))
    (format "\{\{%s\}\}" (string-replace "{" "\\{" content))))

(defun org-confluence-headline (headline contents info)
  (let* ((low-level-rank (org-export-low-level-p headline info))
-- 
2.39.2 (Apple Git-143)
Hi Lungang,

Lungang Fang <lungang.fang@gmail.com> writes: