* [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines
@ 2017-05-01 15:29 Marc Ihm
2017-05-02 6:54 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: Marc Ihm @ 2017-05-01 15:29 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 336 bytes --]
Hi,
the attached patch changes ox-confluence.el:
- Export checkboxes in lists to appear in the resulting
confluence-markup (with some minor refactoring of
org-confluence-item).
- Fix spurious closing braces following timestamps in headlines.
Please review and let me know, if you have any comments or questions.
Thanks,
Marc
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Export checkboxes; fix timestamps in headlines --]
[-- Type: text/x-patch, Size: 2641 bytes --]
From 4e638796f39918ade4c8717569315d8b4ca61818 Mon Sep 17 00:00:00 2001
From: "U-IHM-NOTEBOOK\\Olli" <marc@ihm.name>
Date: Mon, 1 May 2017 16:59:10 +0200
Subject: [PATCH 1/1] Export checkboxes; fix timestamps in headlines
---
contrib/lisp/ox-confluence.el | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index c70fe853b..8ee22f5b7 100644
--- a/contrib/lisp/ox-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -83,16 +83,19 @@
(format "_%s_" contents))
(defun org-confluence-item (item contents info)
- (let* ((plain-list (org-export-get-parent item))
- (type (org-element-property :type plain-list))
- (bullet (if (eq type 'ordered) ?\# ?\-)))
- (concat (make-string (1+ (org-confluence--li-depth item)) bullet)
- " "
- (if (eq type 'descriptive)
- (concat "*"
- (org-export-data (org-element-property :tag item) info)
- "* - "))
- (org-trim contents))))
+ (let ((list-type (org-element-property :type (org-export-get-parent item))))
+
+ (concat
+ (make-string (1+ (org-confluence--li-depth item))
+ (if (eq list-type 'ordered) ?\# ?\-))
+ " "
+ (cl-case (org-element-property :checkbox item)
+ ('on "*{{(X)}}* ")
+ ('off "*{{( )}}* ")
+ ('trans "*{{(\\-)}}* "))
+ (when (eq list-type 'descriptive)
+ (concat "*" (org-export-data (org-element-property :tag item) info) "* - "))
+ (org-trim contents))))
(defun org-confluence-fixed-width (fixed-width contents info)
(org-confluence--block
@@ -117,7 +120,7 @@
(string= todo ""))
""
(format "*{{%s}}* " todo))))
- ;; Else: Standard headline.
+
(format "h%s. %s%s\n%s" level todo-text text
(if (org-string-nw-p contents) contents ""))))
@@ -181,7 +184,7 @@ a communication channel."
(defun org-confluence-timestamp (timestamp _contents _info)
"Transcode a TIMESTAMP object from Org to Confluence.
CONTENTS and INFO are ignored."
- (let ((translated (org-timestamp-translate timestamp)))
+ (let ((translated (org-trim (org-timestamp-translate timestamp))))
(if (string-prefix-p "[" translated)
(concat "(" (substring translated 1 -1) ")")
translated)))
@@ -208,7 +211,7 @@ CONTENTS and INFO are ignored."
(or (eq tag 'item) ; list items interleave with plain-list
(eq tag 'plain-list)))
(when (eq tag 'item)
- (incf depth))
+ (cl-incf depth))
(setq item (org-export-get-parent item)))
depth))
--
2.12.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines
2017-05-01 15:29 [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines Marc Ihm
@ 2017-05-02 6:54 ` Nicolas Goaziou
2017-05-03 4:14 ` Marc Ihm
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2017-05-02 6:54 UTC (permalink / raw)
To: Marc Ihm; +Cc: emacs-orgmode
Hello,
Marc Ihm <marc@ihm.name> writes:
> the attached patch changes ox-confluence.el:
>
> - Export checkboxes in lists to appear in the resulting
> confluence-markup (with some minor refactoring of
> org-confluence-item).
> - Fix spurious closing braces following timestamps in headlines.
>
>
> Please review and let me know, if you have any comments or questions.
Thank you.
> + (cl-case (org-element-property :checkbox item)
> + ('on "*{{(X)}}* ")
> + ('off "*{{( )}}* ")
> + ('trans "*{{(\\-)}}* "))
This is a common mistake. Symbols in `cl-case' shouldn't be quoted. 'on
is really (quote on), so you actually wrote
(cl-case (org-element-property :checkbox item)
((quote on) "*{{(X)}}* ")
((quote off) "*{{( )}}* ")
((quote trans) "*{{(\\-)}}* "))
which is not what you want:
(cl-case 'quote ('a 1) ('quote 2) (t 3)) => 1
This is why I prefer `pcase' over `cl-case'.
> + (when (eq list-type 'descriptive)
> + (concat "*" (org-export-data (org-element-property :tag item) info) "* - "))
> + (org-trim contents))))
>
> (defun org-confluence-fixed-width (fixed-width contents info)
> (org-confluence--block
> @@ -117,7 +120,7 @@
> (string= todo ""))
> ""
> (format "*{{%s}}* " todo))))
> - ;; Else: Standard headline.
> +
Mind the spurious blank lines.
> (format "h%s. %s%s\n%s" level todo-text text
> (if (org-string-nw-p contents) contents ""))))
>
> @@ -181,7 +184,7 @@ a communication channel."
> (defun org-confluence-timestamp (timestamp _contents _info)
> "Transcode a TIMESTAMP object from Org to Confluence.
> CONTENTS and INFO are ignored."
> - (let ((translated (org-timestamp-translate timestamp)))
> + (let ((translated (org-trim (org-timestamp-translate timestamp))))
I'm not sure what this is supposed to fix. Does
`org-timestamp-translate' return a string with leading or trailing
blanks?
Anyway, I applied the patch in master branch, with the fix suggested
above.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines
2017-05-02 6:54 ` Nicolas Goaziou
@ 2017-05-03 4:14 ` Marc Ihm
0 siblings, 0 replies; 3+ messages in thread
From: Marc Ihm @ 2017-05-03 4:14 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
> This is a common mistake. Symbols in `cl-case' shouldn't be quoted. 'on
> is really (quote on), so you actually wrote
>
> (cl-case (org-element-property :checkbox item)
> ((quote on) "*{{(X)}}* ")
> ((quote off) "*{{( )}}* ")
> ((quote trans) "*{{(\\-)}}* "))
>
> which is not what you want:
>
> (cl-case 'quote ('a 1) ('quote 2) (t 3)) => 1
>
> This is why I prefer `pcase' over `cl-case'.
>
Interesting (and the docstring of `pcase') !
>> (format "h%s. %s%s\n%s" level todo-text text
>> (if (org-string-nw-p contents) contents ""))))
>>
>> @@ -181,7 +184,7 @@ a communication channel."
>> (defun org-confluence-timestamp (timestamp _contents _info)
>> "Transcode a TIMESTAMP object from Org to Confluence.
>> CONTENTS and INFO are ignored."
>> - (let ((translated (org-timestamp-translate timestamp)))
>> + (let ((translated (org-trim (org-timestamp-translate timestamp))))
>
> I'm not sure what this is supposed to fix. Does
> `org-timestamp-translate' return a string with leading or trailing
> blanks?
Yes, it did return trailing blanks for me.
> Anyway, I applied the patch in master branch, with the fix suggested
> above.
>
> Regards,
Thanx !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-03 4:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-01 15:29 [PATCH] contrib/lisp/ox-confluence.el: Export checkboxes; fix timestamps in headlines Marc Ihm
2017-05-02 6:54 ` Nicolas Goaziou
2017-05-03 4:14 ` Marc Ihm
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.