aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Brautaset <sbrautaset@laterpay.net>2016-03-22 13:55:11 +0000
committerStig Brautaset <sbrautaset@laterpay.net>2016-03-22 13:55:11 +0000
commited2e320ea392a59461d0fd4474ae98d7b9b2bbd6 (patch)
tree5ea575514e32a620960a517fa29423e666f6ce6d
parenta1d4878494f19e86e25785181126999e01b921a0 (diff)
Basic support for fixed-width text
I use this for very short log line snippets etc.
-rw-r--r--ox-jira.el10
-rw-r--r--ox-jira.org17
-rw-r--r--test/ox-jira-test.el11
-rw-r--r--test/ox-jira-test.org17
4 files changed, 53 insertions, 2 deletions
diff --git a/ox-jira.el b/ox-jira.el
index 8e8e9c8..f217f73 100644
--- a/ox-jira.el
+++ b/ox-jira.el
@@ -44,7 +44,7 @@
(export-block . (lambda (&rest args) (ox-jira--not-implemented 'export-block)))
(export-snippet . (lambda (&rest args) (ox-jira--not-implemented 'export-snippet)))
(final-output . (lambda (&rest args) (ox-jira--not-implemented 'final-output)))
- (fixed-width . (lambda (&rest args) (ox-jira--not-implemented 'fixed-width)))
+ (fixed-width . ox-jira-fixed-width)
(footnote-definition . ox-jira-footnote-definition)
(footnote-reference . ox-jira-footnote-reference)
(headline . ox-jira-headline)
@@ -114,6 +114,14 @@ information."
(format "{noformat}\n%s{noformat}"
(org-export-format-code-default example-block info))))
+(defun ox-jira-fixed-width (fixed-width contents info)
+ "Transcode an FIXED-WIDTH element from Org to Jira.
+CONTENTS is nil. INFO is a plist holding contextual
+information."
+ (format "{noformat}\n%s{noformat}"
+ (org-remove-indentation
+ (org-element-property :value fixed-width))))
+
(defun ox-jira--footnote-anchor (element)
(let ((label (org-element-property :label element)))
(replace-regexp-in-string ":" "" label)))
diff --git a/ox-jira.org b/ox-jira.org
index f65dfdc..52dda65 100644
--- a/ox-jira.org
+++ b/ox-jira.org
@@ -114,7 +114,7 @@
(export-block . (lambda (&rest args) (ox-jira--not-implemented 'export-block)))
(export-snippet . (lambda (&rest args) (ox-jira--not-implemented 'export-snippet)))
(final-output . (lambda (&rest args) (ox-jira--not-implemented 'final-output)))
- (fixed-width . (lambda (&rest args) (ox-jira--not-implemented 'fixed-width)))
+ (fixed-width . ox-jira-fixed-width)
(footnote-definition . ox-jira-footnote-definition)
(footnote-reference . ox-jira-footnote-reference)
(headline . ox-jira-headline)
@@ -217,6 +217,21 @@
(org-export-format-code-default example-block info))))
#+END_SRC
+*** Fixed-width block
+
+ I often use this for short snippets of log lines etc. Let's use the JIRA
+ ={noformat}= tags for it.
+
+ #+BEGIN_SRC emacs-lisp
+ (defun ox-jira-fixed-width (fixed-width contents info)
+ "Transcode an FIXED-WIDTH element from Org to Jira.
+ CONTENTS is nil. INFO is a plist holding contextual
+ information."
+ (format "{noformat}\n%s{noformat}"
+ (org-remove-indentation
+ (org-element-property :value fixed-width))))
+ #+END_SRC
+
*** Footnotes
Footnotes have two parts: the reference, and the definition.
diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el
index 6c03e89..542c259 100644
--- a/test/ox-jira-test.el
+++ b/test/ox-jira-test.el
@@ -203,6 +203,17 @@ formatted
#+end_example
" 'jira))))
+(ert-deftest ox-jira-test/fixed-width-blocks ()
+ (should (equal "{noformat}
+stuff that should
+ not be
+formatted
+{noformat}
+" (org-export-string-as ": stuff that should
+: not be
+: formatted
+" 'jira))))
+
(ert-deftest ox-jira-test/footnotes ()
(should (equal "fi fo{anchor:backfn1}[^1^|#fn1]. Another one{anchor:backfn2}[^2^|#fn2].
diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org
index 1d9fabf..779c355 100644
--- a/test/ox-jira-test.org
+++ b/test/ox-jira-test.org
@@ -327,6 +327,23 @@
" 'jira))))
#+END_SRC
+** Fixed-width
+
+ Fixed-width text is used for short log snippets etc.
+
+ #+BEGIN_SRC emacs-lisp
+ (ert-deftest ox-jira-test/fixed-width-blocks ()
+ (should (equal "{noformat}
+ stuff that should
+ not be
+ formatted
+ {noformat}
+ " (org-export-string-as ": stuff that should
+ : not be
+ : formatted
+ " 'jira))))
+ #+END_SRC
+
** Footnotes
#+BEGIN_SRC emacs-lisp