"Mark W. Johnson" <[email protected]> writes:
> +(defun org-confluence--monospace (content)
> + "Wrap CONTENT in Confluence {{...}} monospace markup.
> +Escapes characters that the Confluence wiki parser mis-interprets
> +even inside {{...}} spans:
> + leading \"--\" → \\-\\- (prevents strikethrough-start mis-parse)
> + * → \\* (prevents bold mis-parse; even a lone trailing *
> + causes Confluence to close monospace early)
> + [ → \\[ (prevents wiki-link-start mis-parse)
> + ] → \\] (prevents wiki-link-end mis-parse)"
> + (let* ((s (if (string-prefix-p "--" content)
> + (concat "\\-\\-" (substring content 2))
> + content))
> + ;; Escape * unconditionally: even a lone trailing * (e.g.
> --allow-new-*)
> + ;; causes the Confluence parser to close the monospace span early
> and
> + ;; start a bold region, producing broken output like
> + ;; <code>--allow-new-</code><strong> flags are *off</strong>
> + ;; The \* keeps the * inside the monospace where it belongs.
> + (s (replace-regexp-in-string "\\*" "\\\\*" s))
> + (s (replace-regexp-in-string "\\[" "\\\\[" s))
> + (s (replace-regexp-in-string "\\]" "\\\\]" s)))
> + (format "\{\{%s\}\}" s)))
> +
> (defun org-confluence-verbatim (verbatim _ _)
> - (let ((content (org-element-property :value verbatim)))
> - (format "\{\{%s\}\}" (string-replace "{" "\\{" content))))
> + (org-confluence--monospace (org-element-property :value verbatim)))
>
> (defun org-confluence-code (code _ _)
> - (let ((content (org-element-property :value code)))
> - (format "\{\{%s\}\}" (string-replace "{" "\\{" content))))
> + (org-confluence--monospace (org-element-property :value code)))
In the old code, { was escaped as well.
This escaping has been removed without justification.
This is also an LLM-generated patch, and I am not familiar enough with
Confluence to blindly trust the vast changes introduced. There might be
other subtle breaking changes lurking around.
Canceled.
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>