Hello, Marc Ihm <m...@ihm.name> writes:
> attached please find a patch for contrib/ox-confluence.el (authored by > Sébastien Delafond); the patch simply translates and fixes some selected > enhancements from ox-confluence-en.el (authored by Correl Roush). > > As a result ox-confluence.el encodes square brackets in checkboxes or > inactive timestamps, so that they no longer collide with the native > link-syntax of atlassian confluence. > > It would be great, if someone could review and apply this patch if > appropriate. Thank you. Comments follow. > + :filters-alist '((:filter-final-output . org-confluence-fix-timestamps)) Why do you use a final filter? It is a pretty gross tool, couldn't you simply generate the correct output from the plain-list or item translator? > + (cl-case plain-list > + (descriptive > + (concat (make-string depth ?-) " " checkbox-possibly > + (org-export-data (org-element-property :tag item) info) ": " > + (org-trim contents))) > + (ordered > + (concat (make-string depth ?#) " " checkbox-possibly > + (org-trim contents))) > + (t > + (concat (make-string depth ?-) > + " " checkbox-possibly > + (org-trim contents)))))) Nitpick: I think the code above could be de-duplicated. > (when (org-export-table-row-starts-header-p table-row info) > "|") > - contents "|"))) > + " " contents " |"))) This doesn't seem related to the description of the problem in your message, does it? > (defun org-confluence-template (contents info) > (let ((depth (plist-get info :with-toc))) > @@ -199,6 +215,23 @@ > (setq item (org-export-get-parent item))) > depth)) > > +;; Define output filter > +(defun org-confluence-fix-timestamps (text back-end info) > + "Mask brackets of timestamps in final output, so that > + confluence does not misinterpret them as links." > + (with-temp-buffer > + (insert text) > + (goto-char (point-min)) > + (while (search-forward-regexp org-ts-regexp-both nil t)) > + (goto-char (match-beginning 0)) > + (when (string= (char-to-string (following-char)) "[") > + (delete-char 1) > + (insert "(") > + (goto-char (match-end 0)) > + (delete-char -1) > + (insert ")")) > + (buffer-substring (point-min) (point-max)))) See above. Regards, -- Nicolas Goaziou