From ed2e320ea392a59461d0fd4474ae98d7b9b2bbd6 Mon Sep 17 00:00:00 2001 From: Stig Brautaset Date: Tue, 22 Mar 2016 13:55:11 +0000 Subject: Basic support for fixed-width text I use this for very short log line snippets etc. --- ox-jira.el | 10 +++++++++- ox-jira.org | 17 ++++++++++++++++- test/ox-jira-test.el | 11 +++++++++++ test/ox-jira-test.org | 17 +++++++++++++++++ 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 -- cgit v1.2.3