emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Marc Ihm <marc@ihm.name>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ox-confluence.el: Handle checkboxes and inactive timestamps correctly
Date: Wed, 01 Mar 2017 14:51:23 +0100	[thread overview]
Message-ID: <87tw7dayw4.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <8660ju2kx4.fsf@ihm.name> (Marc Ihm's message of "Tue, 28 Feb 2017 20:08:07 +0100")

Hello,

Marc Ihm <marc@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

  reply	other threads:[~2017-03-01 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 19:08 [PATCH] ox-confluence.el: Handle checkboxes and inactive timestamps correctly Marc Ihm
2017-03-01 13:51 ` Nicolas Goaziou [this message]
2017-03-01 13:54   ` Nicolas Goaziou
2017-03-01 20:48     ` Marc Ihm
2017-03-02 19:33     ` Marc Ihm
2017-03-02 21:16       ` Nicolas Goaziou
2017-03-03 20:50         ` Marc Ihm
2017-03-05 17:41           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tw7dayw4.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=marc@ihm.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).