diff options
| author | Stig Brautaset <sbrautaset@laterpay.net> | 2016-02-25 15:43:27 +0000 |
|---|---|---|
| committer | Stig Brautaset <sbrautaset@laterpay.net> | 2016-02-25 15:43:27 +0000 |
| commit | 64405259658a20361bb5425ecb5eaa07ef3ae930 (patch) | |
| tree | 1075b02872ce83d1aff150f883fc073026458e66 | |
| parent | 73814322282ed706635164314ae2e13e6105da84 (diff) | |
Add support, and simple test, for quotation blocks
JIRA has two forms:
- a `bq.` prefix for single-paragraph quotes, and
- {quote}fi fo fa fum{quote} for m multi-paragraph quotes
We always use the latter, since it's the most general form. I don't know
if there's any benefit to the single-paragraph form at all.
| -rw-r--r-- | ox-jira.el | 7 | ||||
| -rw-r--r-- | ox-jira.org | 11 | ||||
| -rw-r--r-- | test/ox-jira-test.el | 12 | ||||
| -rw-r--r-- | test/ox-jira-test.org | 17 |
4 files changed, 47 insertions, 0 deletions
@@ -44,6 +44,7 @@ (headline . org-jira-headline) (italic . org-jira-italic) (paragraph . org-jira-paragraph) + (quote-block . org-jira-quote-block) (underline . org-jira-underline) (verbatim . org-jira-verbatim) (section . org-jira-section)) @@ -101,6 +102,12 @@ CONTENTS is the contents of the section, as a string. INFO is the plist used as a communication channel." contents) +(defun org-jira-quote-block (quote-block contents info) + "Transcode a QUOTE-BLOCK element from Org to Jira. +CONTENTS holds the contents of the block. INFO is a plist +holding contextual information." + (format "{quote}\n%s\n{quote}" contents)) + (defun org-jira-export-as-jira (&optional async subtreep visible-only body-only ext-plist) "Export current buffer as a Jira buffer. diff --git a/ox-jira.org b/ox-jira.org index f8eaf5b..b793625 100644 --- a/ox-jira.org +++ b/ox-jira.org @@ -133,6 +133,7 @@ (headline . org-jira-headline) (italic . org-jira-italic) (paragraph . org-jira-paragraph) + (quote-block . org-jira-quote-block) (underline . org-jira-underline) (verbatim . org-jira-verbatim) (section . org-jira-section)) @@ -236,6 +237,16 @@ contents) #+END_SRC +**** Quote block + + #+BEGIN_SRC emacs-lisp + (defun org-jira-quote-block (quote-block contents info) + "Transcode a QUOTE-BLOCK element from Org to Jira. + CONTENTS holds the contents of the block. INFO is a plist + holding contextual information." + (format "{quote}\n%s{quote}" contents)) + #+END_SRC + *** End-user functions This is our main export function. This can be called from diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el index 0ddad5a..7068391 100644 --- a/test/ox-jira-test.el +++ b/test/ox-jira-test.el @@ -40,6 +40,18 @@ (should (equal "this is {{inline code}}\n" (org-export-string-as "this is ~inline code~" 'jira))) (should (equal "this is {{verbatim}} text\n" (org-export-string-as "this is =verbatim= text" 'jira)))) +(ert-deftest ox-jira-test/quotations () + (should (equal "{quote} +This is a quote. + +It can have multiple paragraphs. +{quote} +" (org-export-string-as "#+BEGIN_QUOTE +This is a quote. + +It can have multiple paragraphs. +#+END_QUOTE" 'jira)))) + (provide 'ox-jira-test) ;;; ox-jira.el-test.el ends here diff --git a/test/ox-jira-test.org b/test/ox-jira-test.org index dd832c9..ae46c19 100644 --- a/test/ox-jira-test.org +++ b/test/ox-jira-test.org @@ -98,6 +98,23 @@ (should (equal "this is {{verbatim}} text\n" (org-export-string-as "this is =verbatim= text" 'jira)))) #+END_SRC + Quotations are a bit more elaborate, so let's test those separately. They + can have other text effects inside them too. + + #+BEGIN_SRC emacs-lisp + (ert-deftest ox-jira-test/quotations () + (should (equal "{quote} + This is a quote. + + It can have multiple paragraphs. + {quote} + " (org-export-string-as "#+BEGIN_QUOTE + This is a quote. + + It can have multiple paragraphs. + ,#+END_QUOTE" 'jira)))) + #+END_SRC + *** Provide Announce that =ox-jira-test= is a feature of the current Emacs. |
