From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] ox-confluence.el: Handle checkboxes and inactive timestamps correctly Date: Wed, 01 Mar 2017 14:51:23 +0100 Message-ID: <87tw7dayw4.fsf@nicolasgoaziou.fr> References: <8660ju2kx4.fsf@ihm.name> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj4fA-0000a0-HN for emacs-orgmode@gnu.org; Wed, 01 Mar 2017 08:51:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cj4f9-0003dH-GV for emacs-orgmode@gnu.org; Wed, 01 Mar 2017 08:51:28 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:43701) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cj4f9-0003d3-Aa for emacs-orgmode@gnu.org; Wed, 01 Mar 2017 08:51:27 -0500 In-Reply-To: <8660ju2kx4.fsf@ihm.name> (Marc Ihm's message of "Tue, 28 Feb 2017 20:08:07 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Marc Ihm Cc: emacs-orgmode@gnu.org Hello, Marc Ihm writes: > attached please find a patch for contrib/ox-confluence.el (authored by > S=C3=A9bastien Delafond); the patch simply translates and fixes some sele= cted > 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)) >=20=20 > +;; 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=3D (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, --=20 Nicolas Goaziou