From 8aa543b1911efd181c8ef5a33f98e4e01020eac1 Mon Sep 17 00:00:00 2001 From: Pavel Kulyov Date: Fri, 5 Jun 2020 20:58:25 +0300 Subject: link: handle custom-id and headling links Signed-off-by: Pavel Kulyov --- ox-jira.el | 4 ++++ ox-jira.org | 4 ++++ test/ox-jira-test.el | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ox-jira.el b/ox-jira.el index 71ab613..f49c281 100644 --- a/ox-jira.el +++ b/ox-jira.el @@ -284,6 +284,10 @@ INFO is a plist holding contextual information. See (concat type ":" raw-path)) ((string= type "file") (org-export-file-uri raw-path)) + ((string= type "custom-id") + (if desc (concat "#" desc) (concat "#" raw-path))) + ((string-prefix-p "*" raw-path) + (concat "#" (seq-subseq raw-path 1))) (t raw-path)))) (cond ;; Link with description diff --git a/ox-jira.org b/ox-jira.org index 8196fe5..8004485 100644 --- a/ox-jira.org +++ b/ox-jira.org @@ -492,6 +492,10 @@ but we must make a token effort. A lot of this code is cribbed from (concat type ":" raw-path)) ((string= type "file") (org-export-file-uri raw-path)) + ((string= type "custom-id") + (if desc (concat "#" desc) (concat "#" raw-path))) + ((string-prefix-p "*" raw-path) + (concat "#" (seq-subseq raw-path 1))) (t raw-path)))) (cond ;; Link with description diff --git a/test/ox-jira-test.el b/test/ox-jira-test.el index 688ed4a..293095d 100644 --- a/test/ox-jira-test.el +++ b/test/ox-jira-test.el @@ -123,7 +123,15 @@ h1. {color:red}{{TODO}}{color} This is another headline {color:blue}{{:FOO:BAR:} (should (equal "fi [http://jira.atlassian.com] fo\n" (to-jira "fi [[http://jira.atlassian.com]] fo"))) (should (equal "fi [Jira|http://jira.atlassian.com] fo\n" - (to-jira "fi [[http://jira.atlassian.com][Jira]] fo")))) + (to-jira "fi [[http://jira.atlassian.com][Jira]] fo"))) + (should (equal "see [#Heading Name] for details\n" + (to-jira "see [[*Heading Name]] for details"))) + (should (equal "see [This Thing|#Heading Name] for details\n" + (to-jira "see [[*Heading Name][This Thing]] for details"))) + (should (equal "see [#Heading Name] for details\n" + (to-jira "see [[#Heading Name]] for details"))) + (should (equal "see [This Thing|#This Thing] for details\n" + (to-jira "see [[#Heading Name][This Thing]] for details")))) ;; Check that text in paragraphs does not have hard newlines. ;; -- cgit v1.2.3