From 1be13d57dc8357576a8285c6dadc03db9e3ed7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Tue, 25 Aug 2015 12:27:35 +0200 Subject: Imported Upstream version 8.3.1 --- contrib/lisp/ox-confluence.el | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'contrib/lisp/ox-confluence.el') diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el index 538fe02..9b96d5f 100644 --- a/contrib/lisp/ox-confluence.el +++ b/contrib/lisp/ox-confluence.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2012, 2014 Sébastien Delafond -;; Author: Sébastien Delafond +;; Author: Sébastien Delafond ;; Keywords: outlines, confluence, wiki ;; This file is not part of GNU Emacs. @@ -45,7 +45,9 @@ (footnote-reference . org-confluence-empty) (headline . org-confluence-headline) (italic . org-confluence-italic) + (item . org-confluence-item) (link . org-confluence-link) + (property-drawer . org-confluence-property-drawer) (section . org-confluence-section) (src-block . org-confluence-src-block) (strike-through . org-confluence-strike-through) @@ -70,6 +72,11 @@ (defun org-confluence-italic (italic contents info) (format "_%s_" contents)) +(defun org-confluence-item (item contents info) + (concat (make-string (1+ (org-confluence--li-depth item)) ?\-) + " " + (org-trim contents))) + (defun org-confluence-fixed-width (fixed-width contents info) (format "\{\{%s\}\}" contents)) @@ -93,6 +100,11 @@ (t raw-link)) "]"))) + +(defun org-confluence-property-drawer (property-drawer contents info) + (and (org-string-nw-p contents) + (format "\{\{%s\}\}" contents))) + (defun org-confluence-section (section contents info) contents) @@ -138,6 +150,22 @@ contents "\{code\}\n")) +(defun org-confluence--li-depth (item) + "Return depth of a list item; -1 means not a list item" + ;; FIXME check whether it's worth it to cache depth + ;; (it gets recalculated quite a few times while + ;; traversing a list) + (let ((depth -1) + (tag)) + (while (and item + (setq tag (car item)) + (or (eq tag 'item) ; list items interleave with plain-list + (eq tag 'plain-list))) + (when (eq tag 'item) + (incf depth)) + (setq item (org-export-get-parent item))) + depth)) + ;; main interactive entrypoint (defun org-confluence-export-as-confluence (&optional async subtreep visible-only body-only ext-plist) -- cgit v1.2.1